choosecd: Check path-in-use collision (bz 1028197)

This commit is contained in:
Cole Robinson 2014-01-14 17:11:51 -05:00
parent 765b1ed7d6
commit 66096a7eeb
5 changed files with 13 additions and 4 deletions

View File

@ -1531,7 +1531,7 @@ class vmmAddHardware(vmmGObjectUI):
return False
# Disk collision
names = disk.is_conflict_disk(conn)
names = disk.is_conflict_disk()
if names:
res = self.err.yes_no(
_('Disk "%s" is already in use by other guests %s') %

View File

@ -112,6 +112,15 @@ class vmmChooseCD(vmmGObjectUI):
except Exception, e:
return self.err.val_err(_("Invalid Media Path"), e)
names = self.disk.is_conflict_disk()
if names:
res = self.err.yes_no(
_('Disk "%s" is already in use by other guests %s') %
(self.disk.path, names),
_("Do you really want to use the disk?"))
if not res:
return False
uihelpers.check_path_search_for_qemu(self.err, self.conn, path)
self.emit("cdrom-chosen", self.disk, path)

View File

@ -1817,7 +1817,7 @@ class vmmCreate(vmmGObjectUI):
return False
# Disk collision
names = disk.is_conflict_disk(self.guest.conn)
names = disk.is_conflict_disk()
if names:
res = self.err.yes_no(
_('Disk "%s" is already in use by other guests %s') %

View File

@ -488,7 +488,7 @@ def disk_prompt(conn, origpath, origsize, origsparse,
"""
Check if disk is inuse by another guest
"""
names = dev.is_conflict_disk(conn)
names = dev.is_conflict_disk()
if not names:
return False

View File

@ -798,7 +798,7 @@ class VirtualDisk(VirtualDevice):
return (False, None)
return self._storage_creator.is_size_conflict()
def is_conflict_disk(self, conn):
def is_conflict_disk(self, conn=None):
"""
check if specified storage is in use by any other VMs on passed
connection.