[et-mgmt-tools] [PATCH] checking for file-size

Saori Fukuta fukuta.saori at jp.fujitsu.com
Thu Jun 7 06:14:52 UTC 2007


Hi,

I add to check for the file-size of the disk.
If the file-size is less than or equal to 0, it will show the following
message:
    ERROR:  Size of the disk image must be greater than 0
and ask again.

Signed-off-by: Saori Fukuta <fukuta.saori at jp.fujitsu.com>

Thanks,
Saori Fukuta


diff -r 797e92fd5e0d virtinst/Guest.py
--- a/virtinst/Guest.py Thu May 31 14:20:33 2007 -0400
+++ b/virtinst/Guest.py Thu Jun 07 14:19:54 2007 +0900
@@ -57,6 +57,8 @@ class VirtualDisk:
             if not os.path.exists(self.path):
                 if size is None:
                     raise ValueError, "Must provide a size for non-existent disks"
+                if size <= 0:
+                    raise ValueError, "Size of the disk image must be greater than 0"
                 self._type = VirtualDisk.TYPE_FILE
             else:
                 if stat.S_ISBLK(os.stat(self.path)[stat.ST_MODE]):




More information about the et-mgmt-tools mailing list