I was required to auto map a USB DoK to a KVM VM (specific VM, mind you!), as a result of connecting this device to the host. I’ve looked it up on the Internet, and the closest I could get there was this link. It was almost a complete solution, but it had a few bugs, so I will re-describe the whole process, with the fixes I’ve added to the process and udev rules file. While this guide is rather old, it did solve my requirement, which was to map a specific set of devices (“known USB devices”) to the VM, and not any and every USB device (or even – USB DoK) connected to the system.
In my example, I’ve used SanDisk Corp. Ultra Fit, which its USB identifier is 0781:5583, as can be seen using ‘lsusb’ command:
[root@localhost ~]# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 020: ID 0781:5583 SanDisk Corp. Ultra Fit
My VM is called “centos7.0” in this example. I am using integrated KVM+QEMU+LIBVIRT on a generic CentOS 7.5 system.
Preparation
You will need to prepare two files:
USB definitions file (for easier config of libvirt)
UDEV rules file (which will be triggered by add/remove operation, and will call the USB definitions file)
USB Definitions file
I’ve placed it in /opt/autousb/hostdev-0781:5583.xml , and it holds the following (mind the USB device identifiers!)
I’ve created a file /etc/udev/rules.d/90-libvirt-usb.rules with the content below. Note that the device identifiers are there, but in the “remove” section they appear differently. Remove leading zero(s) and change the string. This is caused because on removal, the device does not report all its properties to the OS. Also – you cannot connect more than three (3) such devices to a VM, so when you fail to detach three devices (following a consecutive insert/remove operations, for example), you will not be able to attach a fourth time.
I was wandering for a long while about the connection between NetApp’s LUN Serial and the identifier the host sees, aka “Word 83”. There was an obvious connection, but I figured it out only today. The LUN Serial is an ASCII representation of the hexadecimal Word 83, or, to be exact, the last 22 hex…
It’s sort of a relationship between myself and this Tyan. Same server, changing demands. This time, we’ve had to install on this server RHEL4 32bit. Net-installing RHEL4 Update 3 was impossible. See here, so we’ve installed it from CDs (didn’t have PCI-X network card handy). When booting the server, it showed us only a single…
I have always liked IBM DS series management suite. I have claimed once that your first storage (and with it – your way of thinking about storage abstraction, I assume) is your favorite storage. I have been using the Storage Manager 9 for years now, even before it was 9 (I think that it was…
A nice and informative note about how to obtain OracleASM attributes, including “hidden attributes” can be found here. Including the special attribute “_rebalance_compact” which affects the post-rebalance ‘compact’ ASM operation, when altering DiskGroups (per-DiskGroup, of course). Just a reminder about this specific attribute – when ASM performs rebalance operation (adding or dropping disks) it attempts…
While DL140 G3 is quite a new piece of hardware, RHEL4, even with the later updates, is rather old. When you decide to install RHEL4 on a DL140 G3 server, my first recommendation is this: if you decide to use the embedded SATA-II RAID controller – don’t. This is a driver-based RAID, much like the…
Modern Linux LVM offers great abilities to maintain snapshots of existing logical volumes. Unlike NetApp “Write Anywhere File Layout” (WAFL), Linux LVM uses “Copy-on-Write” (COW) to allow snapshots. The process, in general, can be described in this pdf document. I have issues several small tests, just to get real-life estimations of what is the actual…
One Comment