mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-25 06:03:55 +03:00
domain: Fix changing USB device model
Broken before v1.2.0
This commit is contained in:
parent
2168f33799
commit
776c1d97c6
@ -954,22 +954,21 @@ class vmmDomain(vmmLibvirtObject):
|
||||
|
||||
def _change_model():
|
||||
if editdev.type == "usb":
|
||||
guest = self._make_xmlobj_to_define()
|
||||
ctrls = guest.get_devices("controller")
|
||||
ctrls = xmlobj.get_devices("controller")
|
||||
ctrls = [x for x in ctrls if (x.type ==
|
||||
VirtualController.TYPE_USB)]
|
||||
for dev in ctrls:
|
||||
guest.remove_device(dev)
|
||||
xmlobj.remove_device(dev)
|
||||
|
||||
if model == "ich9-ehci1":
|
||||
for dev in VirtualController.get_usb2_controllers(
|
||||
guest.conn):
|
||||
guest.add_device(dev)
|
||||
xmlobj.conn):
|
||||
xmlobj.add_device(dev)
|
||||
else:
|
||||
dev = VirtualController(guest.conn)
|
||||
dev = VirtualController(xmlobj.conn)
|
||||
dev.type = "usb"
|
||||
dev.model = model
|
||||
guest.add_device(dev)
|
||||
xmlobj.add_device(dev)
|
||||
|
||||
else:
|
||||
editdev.model = model
|
||||
|
Loading…
x
Reference in New Issue
Block a user