#88 Issue closed: lvmvol with dashes

Labels: bug

wdpoorte opened issue at 2012-05-31 12:02:

If a system has logical volumes with dashes, the translation is not done correctly from the /dev/vg/lv name to the /dev/mapper device name and vice versa. lvmgrps with dashes are working fine.

I think the code need to be adapted on the folowing locations:

/usr/share/rear/layout/save/default/33_remove_exclusions.sh:34:            vg=${dm_vg/--/-}
/usr/share/rear/layout/prepare/GNU/Linux/11_include_lvm_code.sh:98:    vg=${dm_vg/--/-}
/usr/share/rear/layout/prepare/default/31_remove_exclusions.sh:34:            vg=${dm_vg/--/-}
/usr/share/rear/lib/layout-functions.sh:115:                dm_vgrp=${vgrp/-/--}

dagwieers commented at 2012-05-31 13:26:

Can you provide an example of what was incorrectly translated. I noticed that for example it only replaces one instance, while we probably should replace all instances. So it should become vg=${dm_vg//--/-}, but I am not sure this is the problem you are having ?

wdpoorte commented at 2012-05-31 13:36:

I tested with /dev/vg-02/lv-test (/dev/mapper/vg--02-lv--test). The vg part is correctly translated, the lv part not.
If I rename the lv without dashes, it works correctly.
And indeed you're right that you should translate all dashes.

dagwieers commented at 2012-05-31 16:41:

@jhoekx Do you see a cause for this problem ?

jhoekx commented at 2012-05-31 17:16:

Your commit af92078479daedd158ef431d6a4452baddb28e35 fixes it, no?

Just never tested with a dash in both vg and lv.

dagwieers commented at 2012-05-31 21:31:

@wdpoorte Can you confirm that only this fixes it ? I thought the problem was that the LV part was never translated.

dagwieers commented at 2012-06-03 20:48:

@wdpoorte We assume that this issue is fixed now. If this is not the case, please reopen this issue with more detailed information.

wdpoorte commented at 2012-06-04 15:41:

I cannot reopen (no permissions) and did not test yet (no time), but can already say this will not fix the issue. In case of a volume group name with more that 1 dash, this will correct this.
If we however have a logical volume with a dash, the problem is not fixed.

We now have this:

    name=${1#/dev/mapper/}
    dm_vg=${name%-*}
    # Device mapper doubles dashes
    vg=${dm_vg//--/-}
    lv=${name##*-}

but I think we should have this:

    name=${1#/dev/mapper/}
    dm_vg=${name%-*}
    # Device mapper doubles dashes
    vg=${dm_vg//--/-}
    dm_lv=${name##*-}
    lv=${dm_lv//--/-}

[Export of Github issue for rear/rear.]