dom0/qvm-usb: now use vm.run() to call vusb-ctl bind/unbind
This commit is contained in:
parent
a0e3e55787
commit
2741201e24
@ -11,6 +11,8 @@ 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: /usr/lib64/python2.6/site-packages/xen
|
||||
|
||||
# Load PVUSB backend
|
||||
modprobe xen-usbback
|
||||
|
||||
|
@ -31,12 +31,18 @@ else:
|
||||
backendvm_xid=0
|
||||
|
||||
# FIXME: command injection
|
||||
os.system("xenstore-write /local/domain/%s/backend/vusb/%s/%s/port/%s %s"
|
||||
os.system("xenstore-write /local/domain/%s/backend/vusb/%s/%s/port/%s '%s'"
|
||||
% (backendvm_xid, frontendvm_xid, controller, port, backendvm_device))
|
||||
|
||||
# FIXME: vm.run
|
||||
cmd = "sudo /usr/lib/qubes/vusb-ctl.py bind %s" % backendvm_device
|
||||
cmd = "/usr/lib/qubes/vusb-ctl.py bind '%s'" % backendvm_device
|
||||
if backendvm_xid == 0:
|
||||
os.system(cmd)
|
||||
os.system("sudo %s" % cmd)
|
||||
else:
|
||||
os.system("qvm-run -p %s '%s'" % (backendvm_name, cmd))
|
||||
from qubes.qubes import QubesVmCollection
|
||||
qvm_collection = QubesVmCollection()
|
||||
qvm_collection.lock_db_for_reading()
|
||||
qvm_collection.load()
|
||||
qvm_collection.unlock_db()
|
||||
|
||||
# launch
|
||||
qvm_collection.get_vm_by_name(backendvm_name).run("root: %s" % cmd)
|
||||
|
Loading…
Reference in New Issue
Block a user