[node-devel] support directly specify cdrom device to start livcd

Bohai (ricky) bohai at huawei.com
Fri Jun 21 04:05:56 UTC 2013


Hi:

Now overt node only support to start livecd by specifing CDLABEL.
Like this:
root=live:CDLABEL=node-image

But do not support to directly specify the cdrom device.
Like this:
root=live:/dev/sr0

This improve aims to support it.


diff --git a/src/ovirtnode/ovirtfunctions.py b/src/ovirtnode/ovirtfunctions.py
index 4285757..4b27b68 100644
--- a/src/ovirtnode/ovirtfunctions.py
+++ b/src/ovirtnode/ovirtfunctions.py
@@ -465,14 +465,19 @@ def mount_live():
                 # /dev/live if not exist alternative
                 client = gudev.Client(['block'])
                 cmdline = open("/proc/cmdline")
-                cdlabel = re.search('CDLABEL\=([a-zA-Z0-9_\.-]+)', cmdline.read())
-                cdlabel = cdlabel.group(0).split("=")[1]
-                cmdline.close()
-                for device in client.query_by_subsystem("block"):
-                    if device.has_property("ID_CDROM"):
-                        dev = device.get_property("DEVNAME")
-                        if system("blkid '%s'|grep -q '%s'" % (dev, cdlabel)):
-                            live_dev = dev
+                cmdline_data = cmdline.read()
+                cdlabel = re.search('CDLABEL\=([a-zA-Z0-9_\.-]+)', cmdline_data)
+                if cdlabel is None:
+                    cdlabel = re.search('live\:([a-zA-Z0-9_\.-\/]+)', cmdline_data)
+                    live_dev = cdlabel.group(0).split(":")[1]
+                else:
+                    cdlabel = cdlabel.group(0).split("=")[1]
+                    cmdline.close()
+                    for device in client.query_by_subsystem("block"):
+                        if device.has_property("ID_CDROM"):
+                            dev = device.get_property("DEVNAME")
+                            if system("blkid '%s'|grep -q '%s'" % (dev, cdlabel)):
+                                live_dev = dev
             except:
                 pass
             if not live_dev:

bohai(ricky)
boh.ricky at gmail.com




More information about the node-devel mailing list