Oh hey Thomas,

I totally didn't see your mail. It got lost between all the gridengine mailing list mails. Those guys got one active mailing list - or a lot of issues.

Anyhow, I agree with your criticism, I don't even remember why I did it like that as I'm pretty aware of VG's being able to have all sorts of names. My config itself doesn't even use "vg[0-9]" .

So if you want to submit a patch, go ahead

VG (get it? Hah)
Kerim

On 08/29/2014 02:28 PM, Thomas Neumann wrote:
Hello Kerim

Can you please explain the following line from Commands.pm?
   my $tmp_vg = `pvdisplay $raid | grep "VG Name" | grep -o "vg[0-9]"`;

Does this really mean you only consider volume groups with a name of
'vg<digit>....' as valid values for $tmp_vg?


This is how I would do it. Maybe there is something I'm missing.

#!/usr/bin/perl

use strict;
use warnings;

my $raid = shift;

# ------------------- the code -------------------------
# fetch the pvdisplay output
my @output = `pvdisplay $raid`;
chomp @output;

# iterate output, looking for volume group name
my $tmp_vg;
for my $line (@output) {
   if ($line =~ /\A \s+ VG[ ]Name \s+ (.+) \z/xms) {
     # found a matching line - extract vg name
     $tmp_vg = $1;
   }
}

defined $tmp_vg
   or croak("Unable to determine volume group for '$raid'");
# ------------------- the code -------------------------

print "$raid -> $tmp_vg\n";



bye
thomas

Reply via email to