openstack实例添加物理USB设备

lsusb来查看usb设备的编号

[root@localhost ~]# lsusb

Bus 002 Device 006: ID 03f0:5a07 Hewlett-Packard

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

第一种方法:

usb.xml

<hostdev mode='subsystem' type='usb'>

         <source>

             <vendor id='0x03f0'/>

             <product id='0x5a07'/>

         </source>

       </hostdev>

第二种方法:

usb1.xml



<hostdev mode='subsystem' type='usb'>

         <source>

             <address bus='002' device='006'/>

         </source>

       </hostdev>

2 挂载usb设备

virsh attach-device instance-00000051 usb.xml

虚拟机里面也会看到相应的u盘设备,如下在控制台里面,看到虚拟机识别到u盘为sdb,mount u盘分区后,可以看到u盘的内容。

 

3 卸载usb设备

virsh detach-device instance-00000051 usb.xml

猜你喜欢

转载自blog.csdn.net/hutiewei2008/article/details/88663616
今日推荐