|
|
首先安装usb- u2 i+ t! G s$ ^: Q Y0 f* Z
rpm -ivh usbutils-007-5.el7.x86_64.rpm
: A l% |# l7 r) H) T+ b) Y/ q& j- l3 O4 l使用lsusb命令查看:8 M) }2 t8 W1 ^. q r7 x
(nova-libvirt)[root@compute07 /]# lsusb -v1 K! ~( b; l; T+ u# C! |
9 L# V7 ~7 ? Y; ?$ c7 r4 O$ ~Bus 002 Device 003: ID 0781:5588 SanDisk Corp. # L/ i& U8 E" z0 e# P* `
Device Descriptor:7 P) |' N6 K0 m& i3 i
bLength 188 r T& ]5 E+ j
bDescriptorType 1
: H' `- P2 k1 f" B+ ` bcdUSB 2.10
9 r6 `3 Q( S4 C9 i: O bDeviceClass 0 (Defined at Interface level)# h/ g( k0 e( B: c
bDeviceSubClass 0
6 l8 h1 w3 }% i bDeviceProtocol 0
: _. N( M; f% k1 V* O9 h. _ bMaxPacketSize0 64
' S6 B( H8 }4 ? T% K: ? i4 G idVendor 0x0781 SanDisk Corp.# A: _( W* [" _) h6 V
idProduct 0x5588
5 H4 R |; u K- D& |+ O bcdDevice 1.00
& ~9 h% Z, F8 C6 p: x iManufacturer 2 SanDisk( G( w9 Q( {% z7 P
iProduct 3 USB Extreme Pro
9 j% R+ ]# z! g# h" B iSerial 1 00000000000000000000
4 |4 X4 M/ N! j1 T! r bNumConfigurations 16 B% o- ]6 Y& I9 {& u ?
Configuration Descriptor:+ J3 F" | C" R E
bLength 94 O& R8 W; U0 @! ]. M
bDescriptorType 2
- S' ^1 r( H* O; G R! o0 o! {9 j wTotalLength 322 y Z0 P7 J R: u3 p: [
bNumInterfaces 14 k1 v Q$ P) }7 d( U
bConfigurationValue 1+ B# j/ u5 D- `& w b" I% }( \2 a
iConfiguration 0
' a8 }/ @: P: m bmAttributes 0xc0$ `6 P$ }( F/ l! `% l0 P
Self Powered6 L5 k# V' N& P5 f
MaxPower 0mA! H6 j$ a8 \& _# M
Interface Descriptor:
\8 j6 \* f* s5 ]( k- R4 Q% j bLength 9
; A# ^- i+ ]" g' z( m; F3 n bDescriptorType 4+ U; F( q& B9 n" T* o/ ~ j6 c. R
bInterfaceNumber 0
5 o* | j$ Z1 T0 @ bAlternateSetting 04 L6 B5 f1 ?, |, N* r
bNumEndpoints 2% c) y1 L3 t7 z8 I% l! W
bInterfaceClass 8 Mass Storage1 D6 b0 \" D5 k1 g! |) q
bInterfaceSubClass 6 SCSI
7 |& }$ \/ f* P. H) N" m2 U8 N bInterfaceProtocol 80 Bulk-Only
& c1 k6 m1 o4 e6 e5 W iInterface 0
2 p& R& D' j' }2 u8 \% r! ?' K, c Endpoint Descriptor:
* k1 |2 n0 E; C2 y' i! e bLength 7
: u6 R+ |. U7 H6 E+ M: q bDescriptorType 5
) e% ], s& L. q* S/ L L$ p bEndpointAddress 0x81 EP 1 IN: H+ W% u5 y" o `
bmAttributes 2
; I$ r2 Y+ _9 [4 [! _+ h Transfer Type Bulk
1 W9 e% P. } q7 L( Y' [0 M Synch Type None
/ t7 {" j4 j5 T% {8 [+ ? Usage Type Data
, @) a4 m8 o2 b( i5 b wMaxPacketSize 0x0200 1x 512 bytes7 q" v1 j0 w! M( ?6 N2 ]4 d: ~
bInterval 0' B2 l8 `% B/ }
Endpoint Descriptor:
* \- D2 e$ G8 ~( l8 z. }& q bLength 76 X9 r/ z- q8 P# W+ b* W
bDescriptorType 5
6 X J0 ] E2 D9 A- w; i6 g bEndpointAddress 0x02 EP 2 OUT
0 c8 I" \& C8 B0 | bmAttributes 2- R. N9 r; Y9 J6 j' D
Transfer Type Bulk- D# _6 a1 n* p4 U) V+ H
Synch Type None
" R: I$ m+ h: n/ V) ` Usage Type Data! T& j. |; `3 ], ]4 L, `# P
wMaxPacketSize 0x0200 1x 512 bytes% x3 w G# E0 @' Q$ R2 R
bInterval 00 u9 x' [6 u& S. Z/ t
Binary Object Store Descriptor:
0 x; P( d- N: t2 \3 i u' g bLength 5
! S) J1 v/ \1 i: y) T% [' k bDescriptorType 15
& z$ E/ _$ U3 L, q wTotalLength 22! F# }6 |+ s( y$ g8 A l
bNumDeviceCaps 2
+ J; _ D% L" C USB 2.0 Extension Device Capability:4 A4 n* h+ ^2 I+ A' g
bLength 7
5 }; [5 q$ r3 E+ i' f" v6 U; e bDescriptorType 16
[* D+ c$ n; I6 v( S9 p1 T bDevCapabilityType 2
& D9 O+ i; a1 f5 X- j2 G bmAttributes 0x0000f41e
: G; S" e1 \+ n9 M5 m& f8 w Link Power Management (LPM) Supported
0 b! E9 `2 A( u W6 C4 B5 z SuperSpeed USB Device Capability:0 i r u2 S/ S
bLength 10
1 a' m$ E u+ C6 g bDescriptorType 16
: Q1 n! v; Z, c* ]2 f2 E7 r bDevCapabilityType 3/ d4 n7 q; m% G
bmAttributes 0x00% _) L+ ?# p/ v
wSpeedsSupported 0x000e
2 _" @ |9 x' s4 w) c% y% f Device can operate at Full Speed (12Mbps)
. L, B" R4 D \' F! t" _ Device can operate at High Speed (480Mbps)
& z# v8 t+ C6 P1 t Device can operate at SuperSpeed (5Gbps)) [( U5 B: A! W
bFunctionalitySupport 1
/ b* t( q9 N% f Lowest fully-functional device speed is Full Speed (12Mbps)
1 Q: B+ F% |: M. H9 I f7 j1 b bU1DevExitLat 10 micro seconds
) W) e( u w8 t$ K bU2DevExitLat 2047 micro seconds; W; x0 P9 {+ i3 v7 }9 j" g! Q T+ @
Device Status: 0x0001
0 M- ?9 X! ^" p Self Powered" @ N: _; y1 N- d) v( ~ x
8 b9 L- t* C+ ~- F: Y& h
编辑xml文件:2 h. H/ x! Y) Q, c2 l+ ?' V
) k% ?) \3 T' ^* j* [4 j, I; i(nova-libvirt)[root@compute07 /]# vim usb.xml
* N5 b; e( X: t! {% L# G<hostdev mode='subsystem' type='usb'>. b* K8 }+ W+ A$ f
<source startupPolicy='optional'>( h0 n2 Q l; S3 d
<vendor id='0x0781'/>
3 j, J/ l5 Y; q, I- J& U<product id='0x5588'/>8 h5 c% s$ ]" D/ M6 l; T' N$ h
</source>
9 V) I7 a6 l3 V1 h: F% B8 m. h9 S</hostdev>* Q0 d$ c3 \& L1 p1 Z* S4 ^" E
: B4 p9 q4 ~* k, I
添加usb到虚机
) @0 @. N# [- a
^ Q* H- Z% {3 g, M(nova-libvirt)[root@compute07 /]# virsh attach-device instance-00000162 usb.xml: X( a. i9 Y- Y! e) y \" Q
Device attached successfully4 C* h7 O: N$ B; W) A( h( H& J- c
4 k/ n4 O H. z# i& m0 K(nova-libvirt)[root@compute07 /]# virsh detach-device instance-00000162 usb.xml
: O" s, d" c2 cDevice detached successfully. E5 {& I$ P' j" ?" l; s8 L1 p8 [+ W
* G. w: m. l7 A% Q, U; b% g
6 e+ m' d. e! o) ~4 V D0 h9 s- B" V/ l3 b
& p, x' l4 }' b# z+ o
$ o$ ^* J. Y* y/ \/ M* Q
. d: d) g6 X# `; d |
|