How to use USB device inside VM under Rosa Virtualisation (oVirt 3.5)

From Rosalab Wiki
Jump to: navigation, search
 
Line 1: Line 1:
<!-- Смело пишите здесь свою заметку. Можно использовать все возможности вики, включать картинки и другие статьи — все они автоматически отреплицируются наружу -->
 
 
 
<!-- Когда статья будет готова к публикации, сотрите эту строчку и раскомментируйте следующую -->
 
[[Category:ToROSAPlanet]]
 
[[Category:ROSA Enterprise Linux Server]]
 
 
 
In our HOWTO we describe a task when you can use some USB device in VM under Rosa Virtualization (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).
  
Line 18: Line 11:
 
* Virtual machine, which use USB device, will be running on the same host, where USB device has been attached.
 
* 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.
 
* 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.
+
* 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 unavailable 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.
+
* You must edit VM properties to enable USB support (in Console options menu), we recommend 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.
 
* We did not check an ability to use any USB 3.0 devices. We do not have an appropriate hardware on our DCs.
  
Line 29: Line 22:
  
  
VM, which we use USB device for, is named rels67_min (ip — 192.168.231.108, FQDN — "rels76minimal").
+
VM which we use USB device for, is named <tt>rels67_min</tt> (ip — <tt>192.168.231.108</tt>, FQDN — <tt>rels76minimal</tt>).
  
 
At least, our HOWTO (you must be root or use sudo to grant access):
 
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")
+
* 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:
+
----
 +
* 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:
 +
----
  
 
<code-bash>
 
<code-bash>
Line 41: Line 36:
 
</code-bash>
 
</code-bash>
  
3. On your oVirt-engine host run:
+
* 3. On your oVirt-engine host run:
  
 
<code-bash>
 
<code-bash>
Line 51: Line 46:
 
In our case we choose 3.5 (press 6 on keyboard).
 
In our case we choose 3.5 (press 6 on keyboard).
  
4. Run on oVirt-engine host (on host "head"):
+
* 4. Run on oVirt-engine host (on host "head"):
  
 
<code-bash>
 
<code-bash>
Line 58: Line 53:
  
  
5. Run on host system (run on host "hammer2", where USB device has been attached):
+
* 5. Run on host system (run on host "hammer2", where USB device has been attached):
  
 
<code-bash>
 
<code-bash>
Line 65: Line 60:
  
  
6. Check USB device on host system:
+
* 6. Check USB device on host system:
  
 
<code-bash>
 
<code-bash>
Line 71: Line 66:
 
</code-bash>
 
</code-bash>
  
(if you can not run '''lsusb''' install '''usbutils''' package: '''yum install usbutils''')
+
(if you can not run '''lsusb''' install '''usbutils''' package: <tt>yum install usbutils</tt>)
  
 
In our example we see our USB device as:
 
In our example we see our USB device as:
  
'''Bus 001 Device 004: ID 8564:1000 Transcend Information, Inc. JetFlash'''
+
  Bus 001 Device 004: ID 8564:1000 Transcend Information, Inc. JetFlash
  
 
Look at '''Picture 1.'''
 
Look at '''Picture 1.'''
Line 81: Line 76:
  
  
7. Open VM properties (right mouse click and choose Edit in menu). Virtual machine must be powered off, when you edit its properties.
+
* 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.
 
Attach your VM to specific host (see on '''Picture 3''', we choose host "hammer2"), where your USB device is.
Line 89: Line 84:
  
  
8. In '''Custom Properties''' menu a new option '''Please select a key''' appears.  
+
* 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'''.
 
Choose '''hostusb''' and write USB device ID, but do not forget to write prefix '''0x'''.
 
So in our case we write '''0x8564:0x1000'''
 
So in our case we write '''0x8564:0x1000'''
Line 98: Line 93:
  
  
9. Run your VM as usual, use SSH, VNC, SPICE, etc, to check  USB device status:
+
* 9. Run your VM as usual, use SSH, VNC, SPICE, etc, to check  USB device status:
  
  
 
<code-bash>
 
<code-bash>
 
lsusb
 
lsusb
</code-bash>Категория
+
</code-bash>
  
 
Look at '''Picture 1'''.
 
Look at '''Picture 1'''.
  
 
[[File:USB-rosavirt-Снимок-1.png|640px|center|thumb|Снимок-1]]
 
[[File:USB-rosavirt-Снимок-1.png|640px|center|thumb|Снимок-1]]
 
  
 
Now you can mount your USB device inside your VM.
 
Now you can mount your USB device inside your VM.
  
[[Category:ROSA Enterprise Linux Server]]
 
 
{{wl-publish: 2015-11-19 21:00:19 +0400 | K.kalmykov }}
 
{{wl-publish: 2015-11-19 21:00:19 +0400 | K.kalmykov }}
 +
 +
[[Category:ToROSAPlanet]]
 +
[[Category:ROSA Enterprise Linux Server]]

Revision as of 20:22, 19 November 2015

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 unavailable for host system, after you mount your device inside your VM.
  • You must edit VM properties to enable USB support (in Console options menu), we recommend 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).

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"):
/etc/init.d/ovirt-engine restart


  • 5. Run on host system (run on host "hammer2", where USB device has been attached):
/etc/init.d/vdsmd restart


  • 6. Check USB device on host system:
lsusb

(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.

Picture 3


  • 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

Picture 4


  • 9. Run your VM as usual, use SSH, VNC, SPICE, etc, to check USB device status:


lsusb

Look at Picture 1.

Снимок-1

Now you can mount your USB device inside your VM.

[ List view ]Comments

(no items)

Please login to comment.