Error in setup-storage in FAI 4.1

Thomas Neumann blacky+fai at fluffbunny.de
Wed Jun 18 16:59:51 CEST 2014


Hello

<subject>: Fixed in 4.2?!

config used for testing:

disk_config disk1

#<type> <mountpoint> <size> <filesystem> <mount_options> <fs_options>
primary -            4G-    -            -

disk_config lvm
vg vg_system disk1.1
vg_system-root     -          1G      - -


first run - no LVM volumes configured
(just to set up the volumes - works without patching)

Starting setup-storage 1.4
Using config file: /var/lib/fai/config/disk_config/DISK_TYPE3_2
Executing: parted -s /dev/sda unit TiB print
Executing: parted -s /dev/sda unit B print free
Executing: parted -s /dev/sda unit chs print free
    Finding all volume groups
  No volume groups found
Executing: mdadm --examine --scan --verbose -c partitions
Executing: parted -s /dev/sda mklabel msdos
Executing: parted -s /dev/sda mkpart primary "" 1048576B 10737418239B
Executing: parted -s /dev/sda set 1 lvm on
Executing: pvcreate -ff -y  /dev/sda1
Executing: vgcreate  vg_system  /dev/sda1
Executing: vgchange -a y vg_system
Executing: lvcreate  -n root -L 1024 vg_system

second run - right after the first one
(this always failed)

Starting setup-storage 1.4
Using config file: /var/lib/fai/config/disk_config/DISK_TYPE3_2
Executing: parted -s /dev/sda unit TiB print
Executing: parted -s /dev/sda unit B print free
Executing: parted -s /dev/sda unit chs print free
    Finding all volume groups
    Finding volume group "vg_system"
    Finding all volume groups
    Finding volume group "vg_system"
    Finding all volume groups
    Finding volume group "vg_system"
    Finding all volume groups
    Finding volume group "vg_system"
Executing: mdadm --examine --scan --verbose -c partitions
Executing: vgchange -a n vg_system
Executing: lvremove -f vg_system/root
Executing: vgremove vg_system
Executing: pvremove  /dev/sda1
Executing: wipefs -a /dev/sda1
Executing: wipefs -a /dev/sda1
Executing: parted -s /dev/sda mklabel msdos
Executing: parted -s /dev/sda mkpart primary "" 1048576B 10737418239B
Executing: parted -s /dev/sda set 1 lvm on
Executing: pvcreate -ff -y  /dev/sda1
Executing: vgcreate  vg_system  /dev/sda1
Executing: vgchange -a y vg_system
Executing: lvcreate  -n root -L 1024 vg_system

Hurray! setup-storage successfully deletes existing logical volumes and volume 
groups! 

There were 2 bugs which prevented this.

a) command stack was built wrongly

'cmd' => 'lvremove -f vg_system/root',
'post' => 'lv_rm_vg_system/root,self_cleared_/dev/vg_system/root',
'pre' => 'wipefs_vg_system/root'

'cmd' => 'true',
'post' => 'self_cleared_VG_vg_system',
'pre' => 'vgchange_a_n_VG_vg_system,[...],self_cleared_root'

'self_cleared_root' is wrong, it should be 'self_cleared_/dev/vg_system/root' 
I think this one is related to the change in LVM 2.02.89.

b) disable volume group, then trying to wipe a logical volume

I don't know where this is coming from, but it's impossible that this could 
have ever worked. As soon as you disable a volume group all related volumes 
are not available any longer. Either wipe-then-disable or just-disable. I 
decided for the latter. 

Patch is attached, it was built against the 4.2 package. I haven't checked 
what happens if you try anything funny. May need some additional adjustments 
(e.g. for preserving volumes).

bye
thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup-storage_lvm-patch
Type: text/x-patch
Size: 2399 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20140618/3215ec1b/attachment.bin>


More information about the linux-fai mailing list