[node-patches] Change in ovirt-node[master]: Fix error occurred when initialzing confirmation_page

hadong0720 at gmail.com hadong0720 at gmail.com
Wed Jun 18 11:46:27 UTC 2014


hadong has uploaded a new change for review.

Change subject: Fix error occurred when initialzing confirmation_page
......................................................................

Fix error occurred when initialzing confirmation_page

Change-Id: If894e5545e211b1a11f5a619fe869c595fecc717
Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=1110762
Signed-off-by: hadong <hadong at redhat.com>
---
M src/ovirt/node/installer/core/confirmation_page.py
M src/ovirt/node/utils/system.py
2 files changed, 17 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/93/28893/1

diff --git a/src/ovirt/node/installer/core/confirmation_page.py b/src/ovirt/node/installer/core/confirmation_page.py
index c56a872..0b7bc9a 100644
--- a/src/ovirt/node/installer/core/confirmation_page.py
+++ b/src/ovirt/node/installer/core/confirmation_page.py
@@ -33,8 +33,8 @@
     def __init__(self, app):
         super(Plugin, self).__init__(app)
         self.storage_discovery = StorageDiscovery(app.args.dry)
-        self.storage_discovery.start()
-        self._header = "{!s:8.8} {!s:48.48} {!s:9.9}"
+        self.storage_discovery.run()
+        self._header = "{bus!s:8.8} {name!s:48.48} {size!s:9.9}"
 
     def name(self):
         return "Confirm disk selections"
@@ -140,9 +140,8 @@
     def get_details(self, dev):
         all_devices = self._plugin.storage_discovery.all_devices()
         device = all_devices[dev]
-
-        txt = self._plugin._header.format(device.bus, device.name,
-                                          "%sGB" % device.size)
+        txt = self._plugin._header.format(bus=device.bus, name=device.name,
+                                          size="%sGB" % device.size)
 
         self.text(txt)
 
diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 1b13d61..0cc1ddd 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -878,9 +878,16 @@
 
     @classmethod
     def _query_lvm(self, option, pv=None):
-        if pv:
-            return [x.strip() for x in process.check_output(["lvm", "vgs",
-                    "--noheadings", "-o", option, pv]).split("\n")]
-        else:
-            return [x.strip() for x in process.check_output(["lvm", "vgs",
-                    "--noheadings", "-o", option]).split("\n")]
+        try:
+            with open(os.devnull, 'wb') as DEVNULL:
+                if pv:
+                    return [x.strip() for x in process.check_output(["lvm",
+                            "vgs", "--noheadings", "-o", option, pv],
+                            stderr=DEVNULL).split("\n")]
+                else:
+                    return [x.strip() for x in process.check_output(["lvm",
+                            "vgs", "--noheadings", "-o", option],
+                            stderr=DEVNULL).split("\n")]
+        except process.CalledProcessError as e:
+            LOGGER.debug("Failed to query lvm: %s" % e.cmd, exc_info=True)
+        return []


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If894e5545e211b1a11f5a619fe869c595fecc717
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