免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2168 | 回复: 0
打印 上一主题 下一主题

[KVM] ubuntu15.10 kvm给guest分配usb设备不成功 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-03-31 14:42 |只看该作者 |倒序浏览
本帖最后由 ForCalm 于 2016-03-31 18:14 编辑

环境如下:
Host: Ubuntu15.10 i386
Guest: RedHat6.3-i686/winXP-32

根据ubuntu官方的介绍检查/etc/apparmor.d/abstractions/libvirt-qemu文件,描述的配置都存在:
/sys/bus/usb/devices/ r,
/sys/devices/*/*/usb[0-9]*/** r,
/dev/bus/usb/*/[0-9]* rw,

/dev/bus/usb/ r,
/etc/udev/udev.conf r,
/sys/bus/ r,
/sys/class/ r,

用virt-manager添加了usb host,但是guest系统始终无法获得此设备:


反而用sudo qemu-system-i386 winxp.img -usb -usbdevide host:14cd:1212 的方法启动guest系统倒是可以识别,刚开始也怀疑是权限的问题,可是查看guest启动之后的设备信息,发现属主和组都已经改变了:

重新修改了rhel6的domain配置,还是不可用,有谁经历过ubuntu上的这种问题知道该怎么弄吗:
  1. <domain type='kvm' id='16'>
  2.   <name>rhel6</name>
  3.   <uuid>8bcfc45a-38ae-449f-8ba3-8aeef867c693</uuid>
  4.   <memory unit='KiB'>524288</memory>
  5.   <currentMemory unit='KiB'>524288</currentMemory>
  6.   <vcpu placement='static'>2</vcpu>
  7.   <resource>
  8.     <partition>/machine</partition>
  9.   </resource>
  10.   <os>
  11.     <type arch='i686' machine='pc-i440fx-vivid'>hvm</type>
  12.     <boot dev='hd'/>
  13.   </os>
  14.   <features>
  15.     <acpi/>
  16.     <apic/>
  17.     <pae/>
  18.   </features>
  19.   <cpu mode='custom' match='exact'>
  20.     <model fallback='allow'>n270</model>
  21.   </cpu>
  22.   <clock offset='utc'>
  23.     <timer name='rtc' tickpolicy='catchup'/>
  24.     <timer name='pit' tickpolicy='delay'/>
  25.     <timer name='hpet' present='no'/>
  26.   </clock>
  27.   <on_poweroff>destroy</on_poweroff>
  28.   <on_reboot>restart</on_reboot>
  29.   <on_crash>restart</on_crash>
  30.   <pm>
  31.     <suspend-to-mem enabled='no'/>
  32.     <suspend-to-disk enabled='no'/>
  33.   </pm>
  34.   <devices>
  35.     <emulator>/usr/bin/kvm-spice</emulator>
  36.     <disk type='file' device='disk'>
  37.       <driver name='qemu' type='qcow2'/>
  38.       <source file='/home/ma/rhel6.img'/>
  39.       <backingStore/>
  40.       <target dev='vda' bus='virtio'/>
  41.       <alias name='virtio-disk0'/>
  42.       <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
  43.     </disk>
  44.     <disk type='file' device='cdrom'>
  45.       <driver name='qemu' type='raw'/>
  46.       <source file='/home/ma/software/rhel-server-6.3-i386-dvd.iso'/>
  47.       <backingStore/>
  48.       <target dev='hda' bus='ide'/>
  49.       <readonly/>
  50.       <alias name='ide0-0-0'/>
  51.       <address type='drive' controller='0' bus='0' target='0' unit='0'/>
  52.     </disk>
  53.     <controller type='pci' index='0' model='pci-root'>
  54.       <alias name='pci.0'/>
  55.     </controller>
  56.     <controller type='ide' index='0'>
  57.       <alias name='ide'/>
  58.       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
  59.     </controller>
  60.     <controller type='virtio-serial' index='0'>
  61.       <alias name='virtio-serial0'/>
  62.       <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
  63.     </controller>
  64.     <controller type='usb' index='0' model='ehci'>
  65.       <alias name='usb'/>
  66.       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
  67.     </controller>
  68.     <interface type='network'>
  69.       <mac address='52:54:00:4c:de:61'/>
  70.       <source network='default' bridge='virbr0'/>
  71.       <target dev='vnet0'/>
  72.       <model type='virtio'/>
  73.       <alias name='net0'/>
  74.       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
  75.     </interface>
  76.     <serial type='pty'>
  77.       <source path='/dev/pts/21'/>
  78.       <target port='0'/>
  79.       <alias name='serial0'/>
  80.     </serial>
  81.     <console type='pty' tty='/dev/pts/21'>
  82.       <source path='/dev/pts/21'/>
  83.       <target type='serial' port='0'/>
  84.       <alias name='serial0'/>
  85.     </console>
  86.     <channel type='spicevmc'>
  87.       <target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
  88.       <alias name='channel0'/>
  89.       <address type='virtio-serial' controller='0' bus='0' port='1'/>
  90.     </channel>
  91.     <input type='tablet' bus='usb'>
  92.       <alias name='input0'/>
  93.     </input>
  94.     <input type='mouse' bus='ps2'/>
  95.     <input type='keyboard' bus='ps2'/>
  96.     <graphics type='spice' port='5901' autoport='yes' listen='127.0.0.1'>
  97.       <listen type='address' address='127.0.0.1'/>
  98.     </graphics>
  99.     <video>
  100.       <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
  101.       <alias name='video0'/>
  102.       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
  103.     </video>
  104.     <hostdev mode='subsystem' type='usb' managed='yes'>
  105.       <source>
  106.         <vendor id='0x14cd'/>
  107.         <product id='0x1212'/>
  108.         <address bus='2' device='4'/>
  109.       </source>
  110.       <alias name='hostdev0'/>
  111.       <address type='usb' bus='0' port='4'/>
  112.     </hostdev>
  113.     <redirdev bus='usb' type='spicevmc'>
  114.       <alias name='redir0'/>
  115.     </redirdev>
  116.     <memballoon model='virtio'>
  117.       <alias name='balloon0'/>
  118.       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
  119.     </memballoon>
  120.   </devices>
  121.   <seclabel type='dynamic' model='apparmor' relabel='yes'>
  122.     <label>libvirt-8bcfc45a-38ae-449f-8ba3-8aeef867c693</label>
  123.     <imagelabel>libvirt-8bcfc45a-38ae-449f-8ba3-8aeef867c693</imagelabel>
  124.   </seclabel>
  125. </domain>
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP