Merge branch 'master' into pvusb2
This commit is contained in:
commit
8ce7a91649
@ -408,6 +408,7 @@ def block_detach_all(vm, vm_xid = None):
|
|||||||
|
|
||||||
usb_ver_re = re.compile(r"^(1|2)$")
|
usb_ver_re = re.compile(r"^(1|2)$")
|
||||||
usb_device_re = re.compile(r"^[0-9]+-[0-9]+(_[0-9]+)?$")
|
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):
|
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():
|
if not port.isdigit():
|
||||||
print >> sys.stderr, "Invalid port in VM %s frontend %s" % (vm, frontend)
|
print >> sys.stderr, "Invalid port in VM %s frontend %s" % (vm, frontend)
|
||||||
continue
|
continue
|
||||||
xs_encoded_dev = xs.read(xs_trans, '/local/domain/%d/backend/vusb/%s/%s/port/%s' % (backend_vm, vm, frontend_dev, port))
|
dev = xs.read(xs_trans, '/local/domain/%d/backend/vusb/%s/%s/port/%s' % (backend_vm, vm, frontend_dev, port))
|
||||||
if xs_encoded_dev == "":
|
if dev == "":
|
||||||
continue
|
continue
|
||||||
# Sanitize device id
|
# 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" % \
|
print >> sys.stderr, "Invalid device id in backend VM %d @ %s/%s/port/%s" % \
|
||||||
(backend_vm, vm, frontend_dev, port)
|
(backend_vm, vm, frontend_dev, port)
|
||||||
continue
|
continue
|
||||||
if usb_decode_device_from_xs(xs_encoded_dev) == device:
|
if dev == device:
|
||||||
frontend = "%s-%s" % (frontend_dev, port)
|
frontend = "%s-%s" % (frontend_dev, port)
|
||||||
vm_name = xl_ctx.domid_to_name(int(vm))
|
vm_name = xl_ctx.domid_to_name(int(vm))
|
||||||
if vm_name is None:
|
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)
|
print >> sys.stderr, "Invalid port in VM %d frontend_dev %d" % (vm_xid, frontend_dev)
|
||||||
continue
|
continue
|
||||||
port = int(port)
|
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
|
# 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" % \
|
print >> sys.stderr, "Invalid device id in backend VM %d @ %d/%d/port/%d" % \
|
||||||
(backend_vm_xid, vm_xid, frontend_dev, port)
|
(backend_vm_xid, vm_xid, frontend_dev, port)
|
||||||
continue
|
continue
|
||||||
if xs_encoded_dev == "":
|
if dev == "":
|
||||||
return '%d-%d' % (frontend_dev, port)
|
return '%d-%d' % (frontend_dev, port)
|
||||||
last_frontend_dev = frontend_dev
|
last_frontend_dev = frontend_dev
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ def main():
|
|||||||
if options.template is not None:
|
if options.template is not None:
|
||||||
template = qvm_collection.get_vm_by_name(options.template)
|
template = qvm_collection.get_vm_by_name(options.template)
|
||||||
if template is None:
|
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)
|
exit (1)
|
||||||
if not template.is_template():
|
if not template.is_template():
|
||||||
print >> sys.stderr, "VM '{0}' is not a TemplateVM".format(options.template)
|
print >> sys.stderr, "VM '{0}' is not a TemplateVM".format(options.template)
|
||||||
@ -121,7 +121,7 @@ def main():
|
|||||||
|
|
||||||
elif not options.hvm:
|
elif not options.hvm:
|
||||||
if qvm_collection.get_default_template() is None:
|
if qvm_collection.get_default_template() is None:
|
||||||
print >> sys.stderr, "No default TempleteVM defined!"
|
print >> sys.stderr, "No default TemplateVM defined!"
|
||||||
exit (1)
|
exit (1)
|
||||||
else:
|
else:
|
||||||
template = qvm_collection.get_default_template()
|
template = qvm_collection.get_default_template()
|
||||||
|
@ -53,11 +53,12 @@ def main():
|
|||||||
print >> sys.stderr, "******* WARNING *** WARNING *** WARNING *** WARNING *******"
|
print >> sys.stderr, "******* WARNING *** WARNING *** WARNING *** WARNING *******"
|
||||||
print >> sys.stderr, "*** ***"
|
print >> sys.stderr, "*** ***"
|
||||||
print >> sys.stderr, "*** PVUSB passthrough kernel support is still unstable. ***"
|
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, "***********************************************************"
|
||||||
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, ""
|
print >> sys.stderr, ""
|
||||||
prompt = raw_input ("Do you want enable PV USB support? ")
|
prompt = raw_input ("Do you want enable PV USB support? ")
|
||||||
if prompt == "YES":
|
if prompt == "YES":
|
||||||
|
Loading…
Reference in New Issue
Block a user