Guest: Drop add_device set_defaults option
Was only used to fix one bug, but has too many side effects. Just fix it at the caller.
This commit is contained in:
parent
695c4b7189
commit
bf7773ce58
|
@ -73,11 +73,12 @@ tpm_widget_mappings = {
|
|||
|
||||
|
||||
class vmmAddHardware(vmmGObjectUI):
|
||||
def __init__(self, vm):
|
||||
def __init__(self, vm, is_customize_dialog):
|
||||
vmmGObjectUI.__init__(self, "vmm-add-hardware.ui", "vmm-add-hardware")
|
||||
|
||||
self.vm = vm
|
||||
self.conn = vm.conn
|
||||
self.is_customize_dialog = is_customize_dialog
|
||||
|
||||
self.storage_browser = None
|
||||
|
||||
|
@ -1340,13 +1341,14 @@ class vmmAddHardware(vmmGObjectUI):
|
|||
return self.err.val_err(_("Storage parameter error."), e)
|
||||
|
||||
# Generate target
|
||||
used = []
|
||||
disks = (self.vm.get_disk_devices() +
|
||||
self.vm.get_disk_devices(inactive=True))
|
||||
for d in disks:
|
||||
used.append(d.target)
|
||||
if not self.is_customize_dialog:
|
||||
used = []
|
||||
disks = (self.vm.get_disk_devices() +
|
||||
self.vm.get_disk_devices(inactive=True))
|
||||
for d in disks:
|
||||
used.append(d.target)
|
||||
|
||||
disk.generate_target(used)
|
||||
disk.generate_target(used)
|
||||
|
||||
isfatal, errmsg = disk.is_size_conflict()
|
||||
if not isfatal and errmsg:
|
||||
|
|
|
@ -1724,7 +1724,7 @@ class vmmCreate(vmmGObjectUI):
|
|||
self.conn, disk.path)
|
||||
|
||||
self.disk = disk
|
||||
self.guest.add_device(self.disk, set_defaults=True)
|
||||
self.guest.add_device(self.disk)
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -1518,7 +1518,7 @@ class vmmDetails(vmmGObjectUI):
|
|||
def add_hardware(self, src_ignore):
|
||||
try:
|
||||
if self.addhw is None:
|
||||
self.addhw = vmmAddHardware(self.vm)
|
||||
self.addhw = vmmAddHardware(self.vm, self.is_customize_dialog)
|
||||
|
||||
self.addhw.show(self.topwin)
|
||||
except Exception, e:
|
||||
|
|
|
@ -330,7 +330,7 @@ class Guest(XMLBuilder):
|
|||
newlist.append(i)
|
||||
return newlist
|
||||
|
||||
def add_device(self, dev, set_defaults=False):
|
||||
def add_device(self, dev):
|
||||
"""
|
||||
Add the passed device to the guest's device list.
|
||||
|
||||
|
@ -341,15 +341,6 @@ class Guest(XMLBuilder):
|
|||
self._add_child(dev)
|
||||
self._recalculate_device_xpaths()
|
||||
|
||||
if set_defaults:
|
||||
origdev = self._devices
|
||||
try:
|
||||
self._devices = [dev]
|
||||
self._set_device_defaults()
|
||||
except:
|
||||
self._devices = origdev
|
||||
|
||||
|
||||
def _track_device(self, dev):
|
||||
self._devices.append(dev)
|
||||
|
||||
|
|
Loading…
Reference in New Issue