Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Red Hat Install (http://www.linux-archive.org/red-hat-install/)
-   -   (take II) Update format of cdrom devices when looking for repos on media (#566269) (http://www.linux-archive.org/red-hat-install/345764-take-ii-update-format-cdrom-devices-when-looking-repos-media-566269-a.html)

Radek Vykydal 03-23-2010 01:43 PM

(take II) Update format of cdrom devices when looking for repos on media (#566269)
 
This is needed when repo location is changed to CD/DVD in repo UI
and the media was inserted after last storage population (e.g.
just during repo UI step).

Second take, using iutil.notify_kernel rather then udev_trigger,
with logging added - as Dave Lehman suggested. It's tested.

---
image.py | 1 +
storage/devicetree.py | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/image.py b/image.py
index e15de12..60f03aa 100644
--- a/image.py
+++ b/image.py
@@ -257,6 +257,7 @@ def scanForMedia(tree, storage):
if dev.type != "cdrom":
continue

+ storage.devicetree.updateDeviceFormat(dev)
try:
dev.format.mount(mountpoint=tree)
except:
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 386d23f..fd3613d 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -37,6 +37,7 @@ import devicelibs.lvm
import devicelibs.mpath
from udev import *
from .storage_log import log_method_call
+import iutil

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -1780,6 +1781,15 @@ class DeviceTree(object):
elif device.format.type == "multipath_member":
self.handleMultipathMemberFormat(info, device)

+ def updateDeviceFormat(self, device):
+ log.debug("updating format of device: %s" % device)
+ iutil.notify_kernel("/sys%s" % device.sysfsPath)
+ udev_settle()
+ info = udev_get_device(device.sysfsPath)
+ self.handleUdevDeviceFormat(info, device)
+ if device.format.type:
+ log.debug("got format: %s" % device.format)
+
def _handleInconsistencies(self):
def reinitializeVG(vg):
# First we remove VG data
--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 05:16 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.