[node-patches] Change in ovirt-node[ovirt-3.5]: Making the install device selection page use only disk devices.

fabiand at redhat.com fabiand at redhat.com
Tue Sep 15 12:59:57 UTC 2015


Hello Anatoly Litovsky,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/46174

to review the following change.

Change subject: Making the install device selection page use only disk devices.
......................................................................

Making the install device selection page use only disk devices.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1179085

Change-Id: If1e398ff28b984093163c13c13af125eb7428bec
Signed-off-by: Tolik Litovsky <tlitovsk at redhat.com>
---
M src/ovirt/node/utils/storage.py
1 file changed, 11 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/74/46174/1

diff --git a/src/ovirt/node/utils/storage.py b/src/ovirt/node/utils/storage.py
index 4df851a..39e1d12 100644
--- a/src/ovirt/node/utils/storage.py
+++ b/src/ovirt/node/utils/storage.py
@@ -22,6 +22,7 @@
 from ovirt.node import base
 from ovirt.node.utils.fs import File
 from ovirt.node.utils import system
+import subprocess
 import os
 
 
@@ -127,11 +128,21 @@
         if self._fake_devices:
             return self._fake_devices
         from ovirtnode.ovirtfunctions import translate_multipath_device
+        from ovirtnode.ovirtfunctions import subprocess_closefds
         dev_names, disk_dict = self._storage.get_udev_devices()
         devices = {}
         for _dev in dev_names:
             dev = translate_multipath_device(_dev)
             self.logger.debug("Checking device %s (%s)" % (dev, _dev))
+            disk_type_cmd = ["lsblk", "-ino", "TYPE", dev, "--nodeps"]
+            disk_type_popen = subprocess_closefds(disk_type_cmd,
+                                                  stdout=subprocess.PIPE,
+                                                  stderr=subprocess.STDOUT)
+            dev_type, dev_type_err = disk_type_popen.communicate()
+            if not dev_type.strip() in ("disk", "mpath"):
+                self.logger.warning("Type is %s" % dev_type)
+                self.logger.warning("Device is not disk %s" % dev)
+                continue
             if dev in devices:
                 self.logger.warning("Device is already in dict: %s" % dev)
                 continue


-- 
To view, visit https://gerrit.ovirt.org/46174
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1e398ff28b984093163c13c13af125eb7428bec
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list