[et-mgmt-tools] [PATCH] Check dom0 partitions (/boot, /) overwrite, when guest OS installing.

Takahashi Tomohiro takatom at jp.fujitsu.com
Mon Apr 23 12:42:45 UTC 2007


Hi,

I made the patch that corrected the following problem.

It is a problem that can be installed in dom0 and boot partition.
when I install guest OS on virt-manager.
This code uses absolute path name.
If you have any comments, please suggest me.

Signed-off-by: Tomohiro Takahashi <takatom at jp.fujitsu.com>

Thanks,
Tomohiro Takahashi

---------------------------------------
diff -r 053429952481 -r 45ddb2a9466d src/virtManager/create.py
--- a/src/virtManager/create.py Mon Apr 16 11:31:48 2007 -0400
+++ b/src/virtManager/create.py Mon Apr 23 20:56:08 2007 +0900
@@ -58,6 +58,7 @@ PAGE_SUMMARY = 8
 PAGE_SUMMARY = 8

 KEYBOARD_DIR = "/etc/sysconfig/keyboard"
+MTAB = "/etc/mtab"

 class vmmCreateMeter(progress.BaseMeter):
     def __init__(self, asyncjob):
@@ -865,6 +866,26 @@ class vmmCreate(gobject.GObject):
                                                _("Do you really want to use
the disk ?"))
                return res

+            try:
+                f = open(MTAB, "r")
+            except IOError, e:
+                logging.debug('Could not open "/etc/mtab" ' + str(e))
+            else:
+                while 1:
+                    s = f.readline()
+                    if s == "":
+                        break
+                    mtab = s.split(" ")
+                    if mtab[1] == "/" and disk == mtab[0]:
+                        self._validation_error_box(_('Disk "%s" is used by
dom0 !' % disk), \
+                                                   _("You must specify
another partition for the guest install"))
+                        return False
+                    if mtab[1] == "/boot" and disk == mtab[0]:
+                        self._validation_error_box(_('Disk "%s" is used by
boot partition !' % disk), \
+                                                   _("You must specify
another partition for the guest install"))
+                        return False
+                f.close
+
         elif page_num == PAGE_NETWORK:






More information about the et-mgmt-tools mailing list