Hi,
The virt-manager specify the Domain's disk sources.
But the virt-manager doesn't check that the disk sources are
conflicted among the other domains.
The attached patch resolve this issue in the following way:
1) Count that the making domian's disk src is already use
the exists domain's disk source.
2) if disk src is already use, confirmation message.
Disk "/dev/xxx" is already in use by another guest!
Do you really want to use the disk ?
3) if select yes then leave disk source as it is,
else(no) specify disk source again.
Signed-off-by: Tomohiro Takahashi <takatom@xxxxxxxxxxxxxx>
Thanks,
Tomohiro Takahashi.
diff -uNrp virt-manager--devel_442.orig/src/virtManager/create.py
virt-manager--devel_442/src/virtManager/create.py
--- virt-manager--devel_442.orig/src/virtManager/create.py 2007-03-28
13:42:41.000000000 +0900
+++ virt-manager--devel_442/src/virtManager/create.py 2007-03-28
20:58:52.000000000 +0900
@@ -57,6 +57,8 @@ PAGE_SUMMARY = 8
KEYBOARD_DIR = "/etc/sysconfig/keyboard"
+BUTTON_YES = -8
+
class vmmCreateMeter(progress.BaseMeter):
def __init__(self, asyncjob):
# progress meter has to run asynchronously, so pass in the
@@ -817,6 +819,13 @@ class vmmCreate(gobject.GObject):
self._validation_error_box(_("Storage Address Is
Directory"), \
_("You chose 'Simple File'
storage for your storage method, but chose a directory instead of a file.
Please enter a new filename or choose an existing file."))
return False
+
+ d = virtinst.VirtualDisk(self.get_config_disk_image(),
self.get_config_disk_size(), sparse = self.is_sparse_file())
+ if d.is_conflict_disk(self.connection.vmm) is True:
+ res = self._validation_error_box_YES_NO(_('Disk "%s" is
already in use by another guest!' % disk), \
+ _("Do you really want to use
the disk ?"))
+ return res
+
elif page_num == PAGE_NETWORK:
if self.window.get_widget("net-type-network").get_active():
if self.window.get_widget("net-network").get_active()
== -1:
@@ -844,6 +853,22 @@ class vmmCreate(gobject.GObject):
message_box.format_secondary_text(text2)
message_box.run()
message_box.destroy()
+
+ def _validation_error_box_YES_NO(self, text1, text2=None):
+ #import pdb; pdb.set_trace()
+ message_box =
gtk.MessageDialog(self.window.get_widget("vmm-create"), \
+ 0, \
+ gtk.MESSAGE_WARNING, \
+ gtk.BUTTONS_YES_NO, \
+ text1)
+ if text2 != None:
+ message_box.format_secondary_text(text2)
+ if message_box.run()== BUTTON_YES:
+ res = True
+ else:
+ res = False
+ message_box.destroy()
+ return res
def populate_opt_media(self, model):
# get a list of optical devices with data discs in, for FV installs