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

Fabian Deutsch fabiand at redhat.com
Fri Jun 21 07:41:49 UTC 2013


Hey Ricky,

Am Freitag, den 21.06.2013, 04:05 +0000 schrieb Bohai (ricky):
> 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.

Thanks for the patch! That's probably something others are interested in
too.
Could you push your patch (and the other one) to the ovirt-node project
on our gerrit instance (http://gerrit.ovirt.org)?
This wiki page explains how to work with gerrit:
http://www.ovirt.org/Working_with_oVirt_Gerrit

Thanks
fabian

> 
> 
> 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
> 
> _______________________________________________
> node-devel mailing list
> node-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/node-devel





More information about the node-devel mailing list