[node-patches] Change in ovirt-node[master]: Fix only calculate one disk driver size issue

hadong0720 at gmail.com hadong0720 at gmail.com
Fri Aug 23 03:08:15 UTC 2013


hadong has uploaded a new change for review.

Change subject: Fix only calculate one disk driver size issue
......................................................................

Fix only calculate one disk driver size issue

Previously when selecting two disks as HOSTVG, storage_vol_page only
calculate one disk driver size(installation.device.current),
Now fix it as calculating all disk drivers size that was selected by users as
HOSTVG(installation.devices)

Change-Id: I387c6832be086ac6895c94282d1ed711d02500ec
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1000227
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/installer/core/storage_vol_page.py
M src/ovirtnode/storage.py
2 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/39/18439/1

diff --git a/src/ovirt/node/installer/core/storage_vol_page.py b/src/ovirt/node/installer/core/storage_vol_page.py
index ecdb88a..a0026f8 100644
--- a/src/ovirt/node/installer/core/storage_vol_page.py
+++ b/src/ovirt/node/installer/core/storage_vol_page.py
@@ -147,7 +147,7 @@
                     }
         from ovirtnode.storage import Storage
         stor = Storage()
-        self._drive_size = stor.get_drive_size(self.__get_install_drive())
+        self._drive_size = stor.get_drives_size(self.__get_install_drive())
         sizes = {"storage.efi_size": "%s" % stor.EFI_SIZE,
                  "storage.root_size": "%s" % stor.ROOT_SIZE,
                  "storage.swap_size": "%s" % stor.SWAP_SIZE,
@@ -162,7 +162,7 @@
     def __get_install_drive(self):
         app = self.application
         return app.plugins()["Data Device"].model()[
-            "installation.device.current"]
+            "installation.devices"]
 
     def __calculate_free_space(self):
 
diff --git a/src/ovirtnode/storage.py b/src/ovirtnode/storage.py
index ae497d9..76da0c3 100644
--- a/src/ovirtnode/storage.py
+++ b/src/ovirtnode/storage.py
@@ -180,6 +180,14 @@
         logger.debug(size)
         return size
 
+    def get_drives_size(self, drives):
+        logger.debug("Getting Drives Size For: %s" % drives)
+        drives_size = 0
+        for drive in drives:
+            drives_size += int(self.get_drive_size(drive))
+        logger.debug(drives_size)
+        return drives_size
+
     def _lvm_name_for_disk(self, disk):
         name = None
         cmd = "lvm pvs --noheadings --nameprefixes --unquoted -o pv_name,vg_name '%s' 2> /dev/null" % disk


-- 
To view, visit http://gerrit.ovirt.org/18439
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I387c6832be086ac6895c94282d1ed711d02500ec
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list