[SOLVED] Assign USB Devices to an already Running VM

apax

Member
Apr 3, 2019
11
5
23
60
I am extremely happy with proxmox but I have a simple question on which I am stuck searching since several days.

I need my virtual machines to access more than the 5 maximum USB devices in vm.conf and I am using the "device_add" command in qm monitor on the host. This is simply achieved by reading the "info usbhost" result and typing the command (for example "device_add usb-host,bus=xhci.0,hostbus=3,hostport=3.1.2,id=a34") with the appropriate parameter as described in https://pve.proxmox.com/wiki/USB_Devices_in_Virtual_Machines

I need now to automate the 'device_add' and the 'device_del' commands into 'qm monitor'. I have quite some programming skills in multiple languages and I am open to any solution including shell scripts, python, network sockets, or whatever. However I am been unable to send these commands to qm monitor using a script from the command line interface outside qm monitor.

Would anyone have a suggestion on how to achieve this simple task ?

Regards, apax
 
you can use pvesh

Code:
pvesh create /nodes/NODE/qemu/VMID/monitor --command "yourcommandhere"
 
  • Like
Reactions: doge
THANKS !!! It worked perfectly !

You have made my day !

Regards, apax
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!