From bee83bea0d568ccd1eea9a70b90982125f5048b8 Mon Sep 17 00:00:00 2001 From: Alexandre Bezroutchko Date: Sun, 28 Oct 2012 03:49:53 +0100 Subject: [PATCH 1/3] dom0/qvm-create: fixed couple typos --- dom0/qvm-tools/qvm-create | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom0/qvm-tools/qvm-create b/dom0/qvm-tools/qvm-create index d1c4b5ee..42bf67e3 100755 --- a/dom0/qvm-tools/qvm-create +++ b/dom0/qvm-tools/qvm-create @@ -111,7 +111,7 @@ def main(): if options.template is not None: template = qvm_collection.get_vm_by_name(options.template) if template is None: - print >> sys.stderr, "There is no (Templete)VM with the name '{0}'".format(options.template) + print >> sys.stderr, "There is no (Template)VM with the name '{0}'".format(options.template) exit (1) if not template.is_template(): print >> sys.stderr, "VM '{0}' is not a TemplateVM".format(options.template) @@ -121,7 +121,7 @@ def main(): elif not options.hvm: if qvm_collection.get_default_template() is None: - print >> sys.stderr, "No default TempleteVM defined!" + print >> sys.stderr, "No default TemplateVM defined!" exit (1) else: template = qvm_collection.get_default_template() From 14686a02435e619c701c35555d2f910e28e3b8b6 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Thu, 8 Nov 2012 03:52:41 +0100 Subject: [PATCH 2/3] dom0/usb: imporove qvm-usb warning message --- dom0/qvm-tools/qvm-usb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom0/qvm-tools/qvm-usb b/dom0/qvm-tools/qvm-usb index 14a1cf24..b8a83ba6 100755 --- a/dom0/qvm-tools/qvm-usb +++ b/dom0/qvm-tools/qvm-usb @@ -53,11 +53,12 @@ def main(): print >> sys.stderr, "******* WARNING *** WARNING *** WARNING *** WARNING *******" print >> sys.stderr, "*** ***" print >> sys.stderr, "*** PVUSB passthrough kernel support is still unstable. ***" - print >> sys.stderr, "*** It can CRASH your VMs ***" + print >> sys.stderr, "*** It can CRASH your VMs. ***" print >> sys.stderr, "*** ***" print >> sys.stderr, "***********************************************************" print >> sys.stderr, "" - print >> sys.stderr, "If you still want to use it, type capital YES" + print >> sys.stderr, "To use it, you need install kernel from \"unstable\" repository" + print >> sys.stderr, "If you still want to enable it, type capital YES" print >> sys.stderr, "" prompt = raw_input ("Do you want enable PV USB support? ") if prompt == "YES": From 272b6b7e1d6e1135081d8976c12d30721bd00273 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Wed, 7 Nov 2012 17:43:41 +0100 Subject: [PATCH 3/3] dom0/usb: "port" xenstore entry isn't encoded, so don't try to decode it --- dom0/qvm-core/qubesutils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dom0/qvm-core/qubesutils.py b/dom0/qvm-core/qubesutils.py index 4c50829f..555a994a 100644 --- a/dom0/qvm-core/qubesutils.py +++ b/dom0/qvm-core/qubesutils.py @@ -408,6 +408,7 @@ def block_detach_all(vm, vm_xid = None): usb_ver_re = re.compile(r"^(1|2)$") usb_device_re = re.compile(r"^[0-9]+-[0-9]+(_[0-9]+)?$") +usb_port_re = re.compile(r"^$|^[0-9]+-[0-9]+(\.[0-9]+)?$") def usb_setup(backend_vm_xid, vm_xid, devid, usb_ver): """ @@ -548,15 +549,15 @@ def usb_check_attached(xs_trans, backend_vm, device): if not port.isdigit(): print >> sys.stderr, "Invalid port in VM %s frontend %s" % (vm, frontend) continue - xs_encoded_dev = xs.read(xs_trans, '/local/domain/%d/backend/vusb/%s/%s/port/%s' % (backend_vm, vm, frontend_dev, port)) - if xs_encoded_dev == "": + dev = xs.read(xs_trans, '/local/domain/%d/backend/vusb/%s/%s/port/%s' % (backend_vm, vm, frontend_dev, port)) + if dev == "": continue # Sanitize device id - if not usb_device_re.match(xs_encoded_dev): + if not usb_port_re.match(dev): print >> sys.stderr, "Invalid device id in backend VM %d @ %s/%s/port/%s" % \ (backend_vm, vm, frontend_dev, port) continue - if usb_decode_device_from_xs(xs_encoded_dev) == device: + if dev == device: frontend = "%s-%s" % (frontend_dev, port) vm_name = xl_ctx.domid_to_name(int(vm)) if vm_name is None: @@ -609,13 +610,13 @@ def usb_find_unused_frontend(xs_trans, backend_vm_xid, vm_xid, usb_ver): print >> sys.stderr, "Invalid port in VM %d frontend_dev %d" % (vm_xid, frontend_dev) continue port = int(port) - xs_encoded_dev = xs.read(xs_trans, '/local/domain/%d/backend/vusb/%d/%d/port/%d' % (backend_vm_xid, vm_xid, frontend_dev, port)) + dev = xs.read(xs_trans, '/local/domain/%d/backend/vusb/%s/%s/port/%s' % (backend_vm, vm, frontend_dev, port)) # Sanitize device id - if xs_encoded_dev != "" and not usb_device_re.match(xs_encoded_dev): + if not usb_port_re.match(dev): print >> sys.stderr, "Invalid device id in backend VM %d @ %d/%d/port/%d" % \ (backend_vm_xid, vm_xid, frontend_dev, port) continue - if xs_encoded_dev == "": + if dev == "": return '%d-%d' % (frontend_dev, port) last_frontend_dev = frontend_dev