details: Fix changing media for two different cdroms

We weren't updating the target device of the choosecd dialog, so only
the first targetted device was ever updated.
This commit is contained in:
Cole Robinson 2014-01-14 17:18:02 -05:00
parent 66096a7eeb
commit 79ce0dcdc5
2 changed files with 8 additions and 7 deletions

View File

@ -40,8 +40,10 @@ class vmmChooseCD(vmmGObjectUI):
self.vm = vm
self.conn = self.vm.conn
self.disk = disk
self.storage_browser = None
# This is also overwritten from details.py when targetting a new disk
self.disk = disk
self.media_type = disk.device
self.builder.connect_signals({

View File

@ -1840,32 +1840,31 @@ class vmmDetails(vmmGObjectUI):
if not disk:
return
dev_id_info = disk
curpath = disk.path
devtype = disk.device
try:
if curpath:
# Disconnect cdrom
self.change_storage_media(dev_id_info, None)
self.change_storage_media(disk, None)
return
except Exception, e:
self.err.show_err((_("Error disconnecting media: %s") % e))
return
try:
def change_cdrom_wrapper(src_ignore, dev_id_info, newpath):
return self.change_storage_media(dev_id_info, newpath)
def change_cdrom_wrapper(src_ignore, disk, newpath):
return self.change_storage_media(disk, newpath)
# Launch 'Choose CD' dialog
if self.media_choosers[devtype] is None:
ret = vmmChooseCD(self.vm, dev_id_info)
ret = vmmChooseCD(self.vm, disk)
ret.connect("cdrom-chosen", change_cdrom_wrapper)
self.media_choosers[devtype] = ret
dialog = self.media_choosers[devtype]
dialog.dev_id_info = dev_id_info
dialog.disk = disk
dialog.show(self.topwin)
except Exception, e: