Opened 11 years ago

Closed 11 years ago

#696 closed defect (fixed)

LVM check

Reported by: victor gattegno Owned by: Bruno Cornec
Priority: normal Milestone: 3.0.4
Component: mondo Version: 3.0.3
Severity: normal Keywords: LVM
Cc: victor gattegno, rue

Description

About mondo 3.0.3, in libmondo-devices.c, line 1909 :

mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);

I think that it should be :

mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);

Change History (4)

comment:1 by victor gattegno, 11 years ago

About: grep -E \"/dev/mapper/%s-

If we have for example /dev/mapper/XXXXX-YYYYY then %s=XXXXX and "grep /dev/mapper/%s-" will work.

But it should be replaced by %s because %s- will not work if the name is a wwid (or an user alias) in /dev/mapper (with multipath it can be defined in "multipaths" section of /etc/multipath.conf) ; because there could be no '-' in the alias, for example:

/dev/mapper/36050468008b0423a0000400003ab0000

or : /dev/mapper/vgdbdisk01

if we have in /etc/multipath.conf :

multipaths {
        wwid    36050468008b0423a0000400003ab0000
        alias   vgdbdisk01
}
Last edited 11 years ago by victor gattegno (previous) (diff)

comment:2 by victor gattegno, 11 years ago

Also I don't see why %%s in the awk, instead, it should be %s

Example, with %%s we get a wrong result:

# mount 2>/dev/null|grep -E "/dev/mapper/VGDD" |awk '{printf("%%s ", $3)}END{print ""}'
%s %s %s %s 

And with %s we get the good result:

# mount 2>/dev/null|grep -E "/dev/mapper/VGDD" |awk '{printf("%s ", $3)}END{print ""}' 
/mnt/data0 /mnt/data1 /mnt/data2 /mnt/data3
Last edited 11 years ago by victor gattegno (previous) (diff)

comment:3 by victor gattegno, 11 years ago

So two modifications should be done, if you agree.

Last edited 11 years ago by victor gattegno (previous) (diff)

comment:4 by Bruno Cornec, 11 years ago

Resolution: fixed
Status: newclosed

I agree with the first one, not the second. For the second in C, you need to prepend a % by another % sign to be correct, thus the double %%

Wrt the first part, it is now in rev [3152], thanks for tracking it down !

Note: See TracTickets for help on using tickets.