dvp/qvm-usb: converted installer scripts into RPM

This commit is contained in:
Alexandre Bezroutchko 2012-10-21 15:10:40 +02:00
parent f4422eae65
commit 7f7e9999f4
7 changed files with 23 additions and 114 deletions

View File

@ -13,35 +13,6 @@ In dom0, once:
After each dom0 reboot:
qvm-start usbvm
Confirm it finds all the devices
Installation (short way)
~~~~~~~~~~~~~~~~~~~~~~~~
Check install-pvusb.sh, change parameters on the top. Defaults are:
dom0_usbvm=y # deploy pvusb backend in dom0
usbvms="usbvm" # deploy pvusb backend in these domUs
appvms="netvm qdvp" # deploy pvusb frontend in these domUs
Run it in dom0 (it will use sudo inside as needed):
./install-pvusb.sh
Installation (long way)
~~~~~~~~~~~~~~~~~~~~~~~
In dom0, after each dom0 reboot:
sudo ./install-pvusb-dom0.sh
FIXME: merge the installer into some rpm
In usbvm, after each reboot:
sudo ./install-pvusb-backend.sh
FIXME: convert the installer into "qubes-pvusb-backend" rpm?
In appvms, after each reboot:
sudo ./install-pvusb-frontend.sh
FIXME: convert the installer into "qubes-pvusb-frontend" rpm?
List
~~~~
@ -75,15 +46,24 @@ Example:
Known issues
~~~~~~~~~~~~
List/attach/detach operations seem to work ok, devices are recognized by the target VM etc. But actual usage of the attached devices is unstable at best. In fact the only working device I saw was one USB stick (and this only after it took a minute to time out and reset the bus couple times). Kernel crashes are normal as well. I have not investigated these issues yet, I had similar experience with Marek's scripts.
List/attach/detach operations seem to work ok, devices are recognized by the target VM etc.
But actual usage of the attached devices is unstable at best. In fact the only working device
I saw was one USB stick (and this only after it took a minute to time out and reset the bus
couple times). Kernel crashes are normal as well. I have not investigated these issues yet,
I had similar experience with Marek's scripts.
* The content of backend/vusb does not get cleaned on domain shutdown (?)
* System keyboard / mouse are listed and can be detached away
* Virtual USB devices (ones created by PVUSB frontend) may be listed
* The installation/configuration is not persistent, not retained between reboots
* No debugging / logging / audit trail
* When an attached device is physically unplugged, USB port remains mapped but not displayed in the list. If device is plugged back it continues to work. Unlisted device cannot be detached.
* When an attached device is physically unplugged, USB port remains mapped but not displayed
in the list. If device is plugged back it continues to work. Unlisted device cannot be detached.
* We are not attaching actual devices, but USB ports (different behavior from VMWare, might be confusing)
* After device is detached from the frontend and returned back to the backend it is not alwayws usable there
* Code changing configuration of pvusb fe/be and vusb bind/unbind helper are located misc/xl-qvm-usb-attach.py misc/xl-qvm-usb-detach.py misc/vusb-ctl.py. These helpers are deployed into the backend domain. The initialization code is qubesutils.py in usb_setup(), should probably also be moved into an external helper. Perhaps the functionality of these external helpers should be merged into libxl? The is one catch is invokation of vusb helper in the backend domain -- now it relies on qubes-specific API.
* Code changing configuration of pvusb fe/be and vusb bind/unbind helper are located
misc/xl-qvm-usb-attach.py misc/xl-qvm-usb-detach.py misc/vusb-ctl.py. These helpers are
deployed into the backend domain. The initialization code is qubesutils.py in usb_setup(),
should probably also be moved into an external helper. Perhaps the functionality of these
external helpers should be merged into libxl? The is one catch is invokation of vusb helper
in the backend domain -- now it relies on qubes-specific API.

View File

@ -1,23 +0,0 @@
#!/bin/sh -xe
##
## Run this script in usbvm as root.
## FIXME: this has to be done after each reboot
##
# Copy files
cp misc/usb_add_change /usr/lib/qubes/usb_add_change
cp misc/usb_remove /usr/lib/qubes/usb_remove
cp misc/vusb-ctl.py /usr/lib/qubes/vusb-ctl.py
cp misc/qubes_usb.rules /etc/udev/rules.d/99-qubes_usb.rules
# FIXME: need better way to deploy libraries needed by xen.vusb_util
[ -d /usr/lib64/python2.7/site-packages ] &&
tar xzf install-pvusb-xen.tgz -C /usr/lib64/python2.7/site-packages
# Load PVUSB backend
modprobe xen-usbback
# Configure udevd and make it re-populate xenstore
udevadm control --reload-rules
udevadm trigger --action=change

View File

@ -1,13 +0,0 @@
#!/bin/sh -xe
##
## Run this script in dom0
## FIXME: this has to be done after each reboot
##
# Copy files
cp misc/xl-qvm-usb-attach.py /usr/lib/qubes/xl-qvm-usb-attach.py
cp misc/xl-qvm-usb-detach.py /usr/lib/qubes/xl-qvm-usb-detach.py
cp dom0/qvm-core/qubesutils.py /usr/lib64/python2.6/site-packages/qubes/qubesutils.py
cp dom0/qvm-core/qubes.py /usr/lib64/python2.6/site-packages/qubes/qubes.py
cp dom0/qvm-tools/qvm-usb /usr/bin/qvm-usb

View File

@ -1,8 +0,0 @@
#!/bin/sh -xe
##
## Run this script in appvm as root
## FIXME: now this has to be done after each reboot
##
modprobe xen-usbfront

View File

@ -1,37 +0,0 @@
#!/bin/sh -xe
dom0_usbvm=y
usbvms="usbvm"
appvms="netvm qdvp"
# --- Copy files ---------------------------------------------------------
for vm in $usbvms $appvms ; do
(cd .. && tar c qubes-core) | qvm-run -p $vm 'tar x'
done
# --- Init dom0 ----------------------------------------------------------
sudo ./install-pvusb-dom0.sh
# --- Init dom0 as usbvm -------------------------------------------------
if [ "$dom0_usbvm" = "y" ] ; then
sudo ./install-pvusb-backend.sh
fi
# --- Init usbvms --------------------------------------------------------
for usbvm in $usbvms ; do
usbvm_xid=`xl list | awk "(\\$1==\"$usbvm\"){print \\$2}"`
if [ -z "$usbvm_xid" ] ; then
echo "Can't determine xid for $usbvm"
else
xenstore-write /local/domain/${usbvm_xid}/qubes-usb-devices ''
xenstore-chmod /local/domain/${usbvm_xid}/qubes-usb-devices n0 b${usbvm_xid}
fi
qvm-run -p $usbvm 'script -qc "cd qubes-core && sudo ./install-pvusb-backend.sh" /dev/null'
done
# --- Init appvm ---------------------------------------------------------
for appvm in $appvms ; do
qvm-run -p $appvm 'script -qc "cd qubes-core && sudo ./install-pvusb-frontend.sh" /dev/null'
done

View File

@ -1,2 +1,3 @@
modprobe evtchn 2>/dev/null || modprobe xen-evtchn
modprobe xen-blkback 2> /dev/null || modprobe blkbk
modprobe xen-usbfront 2> /dev/null

View File

@ -113,9 +113,11 @@ install -D misc/xenstore-watch $RPM_BUILD_ROOT/usr/bin/xenstore-watch-qubes
install -d $RPM_BUILD_ROOT/etc/udev/rules.d
install -m 0644 misc/qubes_memory.rules $RPM_BUILD_ROOT/etc/udev/rules.d/50-qubes_memory.rules
install -m 0644 misc/qubes_block.rules $RPM_BUILD_ROOT/etc/udev/rules.d/99-qubes_block.rules
install -m 0644 misc/qubes_usb.rules $RPM_BUILD_ROOT/etc/udev/rules.d/99-qubes_usb.rules
install -d $RPM_BUILD_ROOT/usr/lib/qubes/
install misc/qubes_download_dom0_updates.sh $RPM_BUILD_ROOT/usr/lib/qubes/
install misc/{block_add_change,block_remove,block_cleanup} $RPM_BUILD_ROOT/usr/lib/qubes/
install misc/{usb_add_change,usb_remove} $RPM_BUILD_ROOT/usr/lib/qubes/
install misc/qubes_trigger_sync_appmenus.sh $RPM_BUILD_ROOT/usr/lib/qubes/
install -D -m 0644 misc/qubes_trigger_sync_appmenus.action $RPM_BUILD_ROOT/etc/yum/post-actions/qubes_trigger_sync_appmenus.action
mkdir -p $RPM_BUILD_ROOT/usr/lib/qubes
@ -312,6 +314,10 @@ do
continue
fi
if [ $(basename $f) == "99-qubes_usb.rules" ] ; then
continue
fi
if [ $(basename $f) == "90-hal.rules" ] ; then
continue
fi
@ -383,6 +389,7 @@ rm -rf $RPM_BUILD_ROOT
/etc/udev/rules.d/50-qubes_memory.rules
/etc/udev/rules.d/99-qubes_block.rules
/etc/udev/rules.d/99-qubes_network.rules
/etc/udev/rules.d/99-qubes_usb.rules
/etc/xen/scripts/vif-route-qubes
/etc/yum.conf.d/qubes-proxy.conf
/etc/yum.repos.d/qubes.repo
@ -399,6 +406,8 @@ rm -rf $RPM_BUILD_ROOT
/usr/lib/qubes/block_add_change
/usr/lib/qubes/block_cleanup
/usr/lib/qubes/block_remove
/usr/lib/qubes/usb_add_change
/usr/lib/qubes/usb_remove
/usr/lib/qubes/dispvm-prerun.sh
/usr/lib/qubes/sync-ntp-clock
/usr/lib/qubes/prepare-suspend