--- scripts/mk-images | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/scripts/mk-images b/scripts/mk-images index f746a29..8879d5d 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -728,6 +728,7 @@ makeinitrd() { instbin $IMGPATH /usr/bin/grep $MBD_DIR /sbin/grep instbin $IMGPATH /usr/bin/kill $MBD_DIR /sbin/kill instbin $IMGPATH /usr/bin/ln $MBD_DIR /sbin/ln + instbin $IMGPATH /usr/bin/mkdir $MBD_DIR /sbin/mkdir instbin $IMGPATH /usr/bin/readlink $MBD_DIR /sbin/readlink instbin $IMGPATH /usr/bin/rm $MBD_DIR /sbin/rm instbin $IMGPATH /usr/bin/rmdir $MBD_DIR /sbin/rmdir
Network devices do not necessarily have a N: and S: entry in the udev info, so we don't want to ignore those right out. Instead, move the decision up into the caller and just have udev_parse_block_entry read all the info and shove it into a hash. --- storage/udev.py | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/storage/udev.py b/storage/udev.py index e97d5d5..b6f6643 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -114,7 +114,7 @@ def udev_get_block_device(sysfs_path):
entry = open(db_path).read() dev = udev_parse_block_entry(entry) - if dev: + if dev.has_key("name"): # XXX why do we do this? is /sys going to move during installation? dev['sysfs_path'] = sysfs_path[4:] # strip off the leading '/sys' dev = udev_parse_uevent_file(dev) @@ -138,8 +138,7 @@ def udev_parse_uevent_file(dev): return dev
def udev_parse_block_entry(buf): - dev = {'name': None, - 'symlinks': []} + dev = {}
for line in buf.splitlines(): line.strip() @@ -150,7 +149,10 @@ def udev_parse_block_entry(buf): if tag == "N": dev['name'] = val elif tag == "S": - dev['symlinks'].append(val) + if dev.has_key('symlinks'): + dev['symlinks'].append(val) + else: + dev['symlinks'] = [val] elif tag == "E": if val.count("=") > 1 and val.count(" ") > 0: # eg: LVM2_LV_NAME when querying the VG for its LVs @@ -174,8 +176,7 @@ def udev_parse_block_entry(buf):
dev[var_name] = var_val
- if dev.get("name"): - return dev + return dev
def udev_settle(timeout=None): argv = ["settle"]
Unfortunately, these values are not necessarily enclosed in quotes but could still include spaces. We don't want the values in our results hash to be lists, so we need to skip splitting for some keys. --- storage/udev.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/storage/udev.py b/storage/udev.py index b6f6643..24b86be 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -170,7 +170,9 @@ def udev_parse_block_entry(buf): if not sep: continue
- if var_val.count(" "): + # Skip splitting for any keys matching MODEL or VENDOR, since + # those values could include embedded, unquoted spaces. + if var_val.count(" ") and var_name.find("MODEL") == -1 and var_name.find("VENDOR") == -1: # eg: DEVLINKS var_val = var_val.split()
--- storage/udev.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/storage/udev.py b/storage/udev.py index 24b86be..051dc21 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -100,7 +100,7 @@ def enumerate_block_devices(): devices.append(sysfs_path) return devices
-def udev_get_block_device(sysfs_path): +def udev_get_block_device(sysfs_path, requireName=True): if not os.path.exists(sysfs_path): log.debug("%s does not exist" % sysfs_path) return None @@ -114,7 +114,7 @@ def udev_get_block_device(sysfs_path):
entry = open(db_path).read() dev = udev_parse_block_entry(entry) - if dev.has_key("name"): + if requireName and dev.has_key("name"): # XXX why do we do this? is /sys going to move during installation? dev['sysfs_path'] = sysfs_path[4:] # strip off the leading '/sys' dev = udev_parse_uevent_file(dev)
We need to use dbus and udev now, instead of the HAL interface. In the future, we need to adapt code from storage/udev.py to be less tied to block devices, since network devices use this same interface now. --- isys/isys.py | 31 ++++++++++++++----------------- 1 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/isys/isys.py b/isys/isys.py index 48909c7..f4aeaec 100755 --- a/isys/isys.py +++ b/isys/isys.py @@ -55,10 +55,6 @@ NM_STATE_CONNECTING = 2 NM_STATE_CONNECTED = 3 NM_STATE_DISCONNECTED = 4
-HAL_SERVICE = "org.freedesktop.Hal" -HAL_PATH = "/org/freedesktop/Hal" -HAL_DEVICE_IFACE = "org.freedesktop.Hal.Device" - DBUS_PROPS_IFACE = "org.freedesktop.DBus.Properties"
mountCount = {} @@ -584,6 +580,7 @@ def getMacAddress(dev):
# Get a description string for a network device (e.g., eth0) def getNetDevDesc(dev): + from storage.udev import udev_get_block_device desc = "Network Interface"
if dev == '' or dev is None: @@ -594,19 +591,19 @@ def getNetDevDesc(dev): devlist = nm.get_dbus_method("GetDevices")()
for path in devlist: - device = bus.get_object(HAL_SERVICE, path) - device_iface = dbus.Interface(device, HAL_DEVICE_IFACE) - device_props = device_iface.get_dbus_method("GetAllProperties")() - - if dev == device_props['net.interface']: - if device_props.has_key('info.product'): - if device_props.has_key('info.vendor'): - desc = "%s %s" % (device_props['info.product'], - device_props['info.vendor'],) - else: - desc = device_props['info.product'] - else: - desc = device_props['info.udi'] + device = bus.get_object(NM_SERVICE, path) + device_iface = dbus.Interface(device, DBUS_PROPS_IFACE) + device_props = device_iface.get_dbus_method("GetAll")(NM_DEVICE_IFACE) + + if dev == device_props['Interface']: + # This is the sysfs path (for now). + udev_path = device_props['Udi'] + dev = udev_get_block_device(udev_path, requireName=False) + + if dev.has_key("ID_VENDOR_ENC") and dev.has_key("ID_MODEL_ENC"): + desc = "%s %s" % (dev["ID_VENDOR_ENC"], dev["ID_MODEL_ENC"]) + elif dev.has_key("ID_VENDOR_FROM_DATABASE") and dev.has_key("ID_MODEL_FROM_DATABASE"): + desc = "%s %s" % (dev["ID_VENDOR_FROM_DATABASE"], dev["ID_MODEL_FROM_DATABASE"])
return desc
On Wednesday, July 29 2009, Chris Lumens said:
# Get a description string for a network device (e.g., eth0) def getNetDevDesc(dev):
- from storage.udev import udev_get_block_device
Having this in the network code is ugly, but it'll do for now. The whole set didn't really have anything jumping out at me as "wrong" although some of it makes me sad
Jeremy
# Get a description string for a network device (e.g., eth0) def getNetDevDesc(dev):
- from storage.udev import udev_get_block_device
Having this in the network code is ugly, but it'll do for now. The whole set didn't really have anything jumping out at me as "wrong" although some of it makes me sad
I hate this line too, but it's easy enough to move some of this stuff out of storage/udev.py and into (say) udev.py when we make it more generic.
I suppose I could get started on that right away. I was more interested in getting anaconda up and installing again as fast as possible.
- Chris
On Wednesday, July 29 2009, Chris Lumens said:
# Get a description string for a network device (e.g., eth0) def getNetDevDesc(dev):
- from storage.udev import udev_get_block_device
Having this in the network code is ugly, but it'll do for now. The whole set didn't really have anything jumping out at me as "wrong" although some of it makes me sad
I hate this line too, but it's easy enough to move some of this stuff out of storage/udev.py and into (say) udev.py when we make it more generic.
I suppose I could get started on that right away. I was more interested in getting anaconda up and installing again as fast as possible.
Nope, I entirely agree that "get back to installing as fast as we can" is the right thing to do. Probably worth filing something, though so that we don't forget to go back and fix it later
Jeremy
Nope, I entirely agree that "get back to installing as fast as we can" is the right thing to do. Probably worth filing something, though so that we don't forget to go back and fix it later
https://bugzilla.redhat.com/show_bug.cgi?id=514592
Filed as an F12Target bug. I'll probably end up doing this eventually.
- Chris
anaconda-devel@lists.fedoraproject.org