[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [et-mgmt-tools] [PATCH] report block size in add hardware summary



> First this will need to be duplicated in create.py for the 
> guest creation wizard. I'd recommend breaking it out into
> it's own function as well so we don't start adding a lot
> of logic to the relatively simple get_config_* functions.
This is complete, though for the logic part im not really sure the best
way to handle the different varieties that can be seen here
> 
> Also, could you wrap this code in a try...except block, just
> log an error if we can't detect the size, and return None.
Complete as well 

> Actually could you just bring this up in bz 453061? It's basically
> covering the same issue.

Sure thing I've appended this issue to the above BZ.

Please let me know your thoughts on the latest patch

Thanks
-- 
              _|-  |  _  _
             _\|_()|<(/__\
 .----------------------------------.
( astokes redhat com || 919.754.4187 )
 `----------------------------------'
diff -r 6815a5f94048 src/virtManager/addhardware.py
--- a/src/virtManager/addhardware.py	Thu Jul 31 16:02:39 2008 -0400
+++ b/src/virtManager/addhardware.py	Mon Aug 04 06:45:00 2008 -0400
@@ -276,7 +276,22 @@
         else:
             return self.window.get_widget("storage-file-address").get_text()
 
+    def get_config_partition_size(self):
+        try:
+            partition_address = self.get_config_disk_image()
+            fd = open(partition_address,"rb")
+            fd.seek(0,2)
+            block_size = fd.tell() / 1024 / 1024
+            return block_size
+        except Exception, e:
+            details = "Unable to verify partition size: '%s'" % \
+                      "".join(traceback.format_exc())
+            logging.error(details)
+            return None
+        
     def get_config_disk_size(self):
+        if self.window.get_widget("storage-partition").get_active():
+            return self.get_config_partition_size()
         if not self.window.get_widget("storage-file-backed").get_active():
             return None
         if not self.window.get_widget("storage-file-size").get_editable():
diff -r 6815a5f94048 src/virtManager/create.py
--- a/src/virtManager/create.py	Thu Jul 31 16:02:39 2008 -0400
+++ b/src/virtManager/create.py	Mon Aug 04 06:45:00 2008 -0400
@@ -388,7 +388,22 @@
         else:
             return self.window.get_widget("storage-file-address").get_text()
 
+    def get_config_partition_size(self):
+        try:
+            partition_address = self.get_config_disk_image()
+            fd = open(partition_address,"rb")
+            fd.seek(0,2)
+            block_size = fd.tell() / 1024 / 1024
+            return block_size
+        except Exception, e:
+            details = "Unable to verify partition size: '%s'" % \
+                      "".join(traceback.format_exc())
+            logging.error(details)
+            return None
+        
     def get_config_disk_size(self):
+        if self.window.get_widget("storage-partition").get_active():
+            return self.get_config_partition_size()
         if not self.window.get_widget("storage-file-backed").get_active():
             return None
         if not self.window.get_widget("storage-file-size").get_editable():

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]