FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 11-02-2011, 10:56 PM
David Lehman
 
Default Try to fix up detection of live backing devices. (#750469)

/run/initramfs/tmp/root.info has disappeared, so now we're going
to protect any iso9660 fs, along with devices with filesystems
labeled "LIVE" and also whatever /dev/live might point to. Don't
be fooled - this is precision engineering.
---
pyanaconda/storage/devicetree.py | 46 +++++++++++++------------------------
1 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 7b411e6..5930eff 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1016,47 +1016,33 @@ class DeviceTree(object):
log.error("Unknown block device type for: %s" % name)
return

- def get_live_backing_device_path():
- """ Return a path to the live block device or an empty string.
-
- The line we're looking for will be of the form
-
- root='block:/dev/disk/by-uuid/<UUID>'
-
- """
- root_info = "/run/initramfs/tmp/root.info"
+ def is_live_backing_device(info):
dev_live = "/dev/live"
- root_path = ""
- if os.path.exists(dev_live):
- root_path = os.path.realpath(dev_live)
- elif os.path.exists(root_info):
- prefix = "root='"
- for line in open(root_info):
- if not line.startswith(prefix) or
- (line[6:12] != "block:" and line[6:11] != "live:"):
- continue
+ if os.path.exists(dev_live) and
+ os.path.realpath(dev_live) == info["DEVNAME"]:
+ return True

- start_idx = line.index(":") + 1
- root_path = os.path.realpath(line[start_idx:-1])
- root_name = devicePathToName(root_path)
- if root_name.startswith("dm-"):
- root_name = dm.name_from_dm_node(root_name)
- root_path = "/dev/mapper/%s" % root_name
+ if udev_device_get_format(info) == "iso9660":
+ return True

- break
+ if udev_device_get_label(info) == "LIVE":
+ return True

- return root_path
+ return False

# If this device is protected, mark it as such now. Once the tree
# has been populated, devices' protected attribute is how we will
# identify protected devices.
- if device and device.name in self.protectedDevNames:
+ is_live = is_live_backing_device(info)
+ if device and (device.name in self.protectedDevNames or is_live):
+ log.debug("protecting %s" % device.name)
device.protected = True
# if this is the live backing device we want to mark its parents
# as protected also
- live_path = get_live_backing_device_path()
- if live_path and device.path == live_path:
+ if is_live:
+ log.debug("%s looks like a live backing device" % name)
for parent in device.parents:
+ log.debug("protecting %s" % parent.name)
parent.protected = True

# Don't try to do format handling on drives without media or
--
1.7.6

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

Thread Tools




All times are GMT. The time now is 01:12 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org