[node-patches] Change in ovirt-node[master]: Trigger udevadm in the installer to refresh disk info

rbarry at redhat.com rbarry at redhat.com
Tue May 12 16:39:53 UTC 2015


Ryan Barry has uploaded a new change for review.

Change subject: Trigger udevadm in the installer to refresh disk info
......................................................................

Trigger udevadm in the installer to refresh disk info

To (hopefully) avoid presenting installer pages with partially
populated disk trees, tell udev to trigger a change to check DB
completeness.

Change-Id: I0446e0dfd093528d2a95bfd857c29e2a89f25b41
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1218941
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/installer/core/boot_device_page.py
M src/ovirt/node/utils/storage.py
2 files changed, 16 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/27/40827/1

diff --git a/src/ovirt/node/installer/core/boot_device_page.py b/src/ovirt/node/installer/core/boot_device_page.py
index 209e070..dd6dfa7 100644
--- a/src/ovirt/node/installer/core/boot_device_page.py
+++ b/src/ovirt/node/installer/core/boot_device_page.py
@@ -31,7 +31,7 @@
 
     def __init__(self, app):
         super(Plugin, self).__init__(app)
-        self.storage_discovery = StorageDiscovery(app.args.dry)
+        self.storage_discovery = StorageDiscovery(app.args.dry, refresh=True)
         self.storage_discovery.run()
 
     def name(self):
@@ -157,12 +157,14 @@
 
     tbl_tpl = " {bus!s:15.15}  {name!s:40.40} {size!s:9.9}"
 
-    def __init__(self, do_fake):
+    def __init__(self, do_fake, refresh=False):
         super(StorageDiscovery, self).__init__()
         self.do_fake = do_fake
+        self.refresh = refresh
 
     def run(self):
-        self.devices = utils.storage.Devices(fake=self.do_fake)
+        self.devices = utils.storage.Devices(fake=self.do_fake,
+                                             refresh=self.refresh)
         self._all_devices = self.devices.get_all()
 
     def all_devices(self):
diff --git a/src/ovirt/node/utils/storage.py b/src/ovirt/node/utils/storage.py
index 39e1d12..b9993a7 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
+from ovirt.node.utils import process
 import subprocess
 import os
 
@@ -90,7 +91,7 @@
     _fake_devices = None
     _cached_live_disk_name = None
 
-    def __init__(self, fake=False):
+    def __init__(self, fake=False, refresh=False):
         super(Devices, self).__init__()
         if fake:
             self._fake_devices = {}
@@ -99,6 +100,15 @@
                         "desc", "serial", "model"]
                 self._fake_devices[args[1]] = Device(*tuple(args))
         else:
+            if refresh:
+                try:
+                    process.check_call(["udevadm", "settle"])
+                    process.check_call(["udevadm", "trigger",
+                                        "--action=change",
+                                        "--subsystem-match=block"])
+                except process.CalledProcessError:
+                    self.logger.error("Couldn't refresh udev block devices")
+
             import ovirtnode.storage
             self._storage = ovirtnode.storage.Storage()
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0446e0dfd093528d2a95bfd857c29e2a89f25b41
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list