LoginSignup
1
1

More than 3 years have passed since last update.

KVM(WebVirtMgr)のWindowsへのUSBメモリのパススルーがうまくいかない

Posted at

我が家ではUbuntu上にKVMの環境を用意して遊んでいるのですが、このKVMのWindowsにUSBメモリをパススルーで渡そうとしたらうまくいかなくしばらく悪戦苦闘することになったのでその時の解決方法を残しておきます。

WebVirtMgr

WebVirtMgr: https://github.com/retspen/webvirtmgr/wiki/Install-WebVirtMgr

WebVirtMgrはKVMをWebUIから管理できるツールでoVirtとかの仲間です。微妙に機能が充実していなかったりもするのですが、軽量で、UIも今時のクラウドっぽいので気に入って使っています。

  • VMのconfig画面
    スクリーンショット 2019-06-08 23.30.04.png

  • 新規VM作成画面
    スクリーンショット 2019-06-08 23.30.16.png

WebVirtMgrでUSBパススルー

残念ながらWebVirtMgrはWebUIからのUSBパススルー機能のようなものはありません。しかしVMのxmlの編集をWeb上からできるのでここでxmlに設定を追加して行います。

スクリーンショット 2019-06-08 23.35.16.png

USBパススルーがうまくいかない

xmlを編集してパススルーをする場合以下のような設定を<device>の中に追記すると思います。

  <device>
    <!-- ここから下のhostdevをdevice内に追記(要vendor id, product id編集) -->
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x****'/>
        <product id='0x****'/>
      </source>
    </hostdev>
    <!-- ここまで -->
  </device>

ここまでWindowsのVMを起動すると以下のように正しく認識されませんでした。

スクリーンショット 2019-06-08 23.46.43.png

解決方法

xmlの中にtype='usb'controllerの記述があります。

<controller type='usb' index='0' model='piix3-uhci'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>

これを一度VMを停止してからxmlを編集し上記のcontrollerを削除して(削除しなくても良いかも)
同じ場所に

<controller type='usb' index='0' model='nec-xhci'>
</controller>

を追記します(中身は保存すれば勝手に追記される)。
これでVMを再起動するとUSBメモリが見えるようになっているはずです。

これは、USBが2.0ではなく3.0であることが原因のようです。詳しくは
- https://samuel.dalesjo.net/?p=57
- https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/6/html/virtualization_administration_guide/sect-guest_virtual_machine_device_configuration-configuring_device_controllers
あたりが参考になると思います。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1