choosecd: change order of check operations
The current order of check operations is wrong. First we set the new path for the disk in question and after that we check whether some guest already uses a disk with the same path. The issue is that virt-manager returns a cached list of guests in path_in_use_by() and the cached guest has the disk path already updated. Ideally we don't update the path at all, but we do it to run some checks before the path is actually changed. In order to fix the referenced bug, change the order of check operations. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1453094 Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
2d27142c9c
commit
c0710c74ff
|
@ -22,6 +22,8 @@ import logging
|
|||
|
||||
from gi.repository import GObject
|
||||
|
||||
from virtinst import VirtualDisk
|
||||
|
||||
from .baseclass import vmmGObjectUI
|
||||
from .mediacombo import vmmMediaCombo
|
||||
from .storagebrowse import vmmStorageBrowser
|
||||
|
@ -114,22 +116,22 @@ class vmmChooseCD(vmmGObjectUI):
|
|||
return self.err.val_err(_("Invalid Media Path"),
|
||||
_("A media path must be specified."))
|
||||
|
||||
try:
|
||||
self.disk.path = path
|
||||
except Exception as e:
|
||||
return self.err.val_err(_("Invalid Media Path"), e)
|
||||
|
||||
names = self.disk.is_conflict_disk()
|
||||
names = VirtualDisk.path_in_use_by(self.disk.conn, path)
|
||||
if names:
|
||||
res = self.err.yes_no(
|
||||
_('Disk "%s" is already in use by other guests %s') %
|
||||
(self.disk.path, names),
|
||||
(path, names),
|
||||
_("Do you really want to use the disk?"))
|
||||
if not res:
|
||||
return False
|
||||
|
||||
vmmAddStorage.check_path_search(self, self.conn, path)
|
||||
|
||||
try:
|
||||
self.disk.path = path
|
||||
except Exception as e:
|
||||
return self.err.val_err(_("Invalid Media Path"), e)
|
||||
|
||||
self.emit("cdrom-chosen", self.disk, path)
|
||||
self.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue