How to use USB device inside VM under Rosa Virtualisation (oVirt 3.5)
In our HOWTO we describe a task when you can use some USB device in VM under Rosa Virtualization (oVirt 3.5).
- You may want to use some HASP inside your VM for some reason.
- You may want to use other USB device, such as USB Flash drive for your VM, or use other USB storage device.
- You may want to use USB printer or USB cell modem inside your VM.
- You may need to use some other USB tokens, fingerprints devices, card readers, network cards, USB-to-RS232 devices, etc.
Or some more.... even iPod or iPhone :)
Before we start, I have to say about some important restrictions you need to know:
- Virtual machine, which use USB device, will be running on the same host, where USB device has been attached.
- Your USB device must be attached to appropriate host system BEFORE you run VM, when you're plannig to use your USB device.
- If you use USB flash drive, or other USB storage device, and if storage device has been already mounted to host system in some mountpoint, a file system of the device will be unavailiable for host system, after you mount your device inside your VM.
- You must edit VM properties to enable USB support (in Cosole options menu), we recomend to choose "Native" anyway. And you also must use SPICE protocol only to use USB devices, VNC protocol does not support any access to USB devices, attached to the host system.
- We did not check an ability to use any USB 3.0 devices. We do not have an appropriate hardware on our DCs.
In this example we use simple 8GB FAT32 USB flash drive, which is mounted on host system in /mnt
Our host system is named "hammer2" (See on Picture 2).
VM, which we use USB device for, is named rels67_min (ip — 192.168.231.108, FQDN — "rels76minimal").
At least, our HOWTO (you must be root or use sudo to grant access):
1. Attach your USB device to your host system in DC (in our case we use "hammer2")
2. Install on your host system (in our case on "hammer2"), and install on your host running oVirt-engine (in our case we use host "head") vdsm-hook-hostusb package:
yum install vdsm-hook-hostusb
3. On your oVirt-engine host run:
engine-config -s UserDefinedVMProperties='hostusb=[\w:&]+'
After your oVirt-engine will ask you to point appropriate oVirt version.
In our case we choose 3.5 (press 6 on keyboard).
4. Run on oVirt-engine host (on host "head"):
5. Run on host system (run on host "hammer2", where USB device has been attached):
6. Check USB device on host system:
(if you can not run lsusb install usbutils package: yum install usbutils)
In our example we see our USB device as:
Bus 001 Device 004: ID 8564:1000 Transcend Information, Inc. JetFlash
Look at Picture 1.
7. Open VM properties (right mouse click and choose Edit in menu). Virtual machine must be powered off, when you edit its properties.
Attach your VM to specific host (see on Picture 3, we choose host "hammer2"), where your USB device is.
8. In Custom Properties menu a new option Please select a key appears. Choose hostusb and write USB device ID, but do not forget to write prefix 0x. So in our case we write 0x8564:0x1000
See on Picture 4
9. Run your VM as usual, use SSH, VNC, SPICE, etc, to check USB device status:
Look at Picture 1.
Now you can mount your USB device inside your VM.