[Ovirt-devel] [PATCH node] fix install when VG exists on disk

Alan Pevec apevec at gmail.com
Thu Sep 1 16:27:59 UTC 2011


On Thu, Sep 1, 2011 at 1:22 AM, Mike Burns <mburns at redhat.com> wrote:
> -            pvs = system("pvscan -o pv_name,vg_uuid --noheadings | grep \"%s\" | egrep -v -q \"%s%s[0-9]+|%s \"") % (vg, dev, part_delim, dev)
> -            if pvs > 0:
> +            pvs_cmd = "pvs -o pv_name,vg_uuid --noheadings | grep \"%s\" | egrep -v -q \"%s%s[0-9]+|%s \"" % (vg, dev, part_delim, dev)
> +            pvs = subprocess.Popen(pvs_cmd, shell=True, stdout=PIPE, stderr=STDOUT)
> +            pvs_output = pvs.stdout.read()
> +            if pvs_output > 0:

pvs_output is command output, for checking return code use
if pvs.wait() > 0:


> -            wipe_volume_group(vg)
> +            vg_name_cmd = "vgs -o vg_name,vg_uuid --noheadings 2>/dev/null | grep -w \"" + vg + "\" | awk '{print $1}'"
> +            vg_name = subprocess.Popen(vg_name_cmd, shell=True, stdout=PIPE, stderr=STDOUT)
> +            vg_name_output = vg_name.stdout.read()
> +            system("vgchange -an " + vg_name_output)
This should be moved to wipe_volume_group

> +            wipe_volume_group(vg_name_output)
This whole trouble of converting vg_uuid to vg_name could be masked in
wipe_volume_group
But can someone remind me why don't we just take vg_name instead of
vg_uuid in the first place?

Alan




More information about the ovirt-devel mailing list