[Ovirt-devel] [PATCH node] fix install when VG exists on disk
Mike Burns
mburns at redhat.com
Thu Sep 1 17:50:40 UTC 2011
On Thu, 2011-09-01 at 18:27 +0200, Alan Pevec wrote:
> 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:
It's not return code that should be checked. It's whether there is any
output. in bash:
if [ -n "$pvs" ]; then
I just don't know how to translate that to python.
>
>
> > - 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
I put it here because vgchange -an HostVG fails. It might be doable
after all the unmount_logging and other logic though. And considering
we don't support reinstall using the TUI, HostVG shouldn't be there
anyway.
>
> > + 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
Mostly, I did it the way I did to mimic the ovirt-config-storage script
since I know that logic works.
Mike
More information about the ovirt-devel
mailing list