'sameas:<device>' broken, fix included

Thomas Neumann blacky+fai at fluffbunny.de
Tue Jun 24 15:17:49 CEST 2014


Hello

The bug: sameas:disk1 works, sameas:sda does not 
Proposed patches and sample config attached to mail.


Output for sameas:disk1

# cat /var/lib/fai/config/disk_config/SAMEAS_DISK1 
disk_config disk1 disklabel:msdos align-at:4k
primary -       1G-50%         -                         -
primary -       1G-50%         -                         -

disk_config disk2 sameas:disk1

# setup-storage -X -f /var/lib/fai/config/disk_config/SAMEAS_DISK1 
Starting setup-storage 1.5
Using config file: /var/lib/fai/config/disk_config/SAMEAS_DISK1
Executing: wipefs -a /dev/sdb1
Executing: wipefs -a /dev/sdb2
Executing: parted -s /dev/sdb mklabel msdos
Executing: parted -s /dev/sdb mkpart primary "" 1048576B 107374706687B
Executing: parted -s /dev/sdb mkpart primary "" 107374706688B 214748364799B
Executing: wipefs -a /dev/sda1
Executing: wipefs -a /dev/sda2
Executing: parted -s /dev/sda mklabel msdos
Executing: parted -s /dev/sda mkpart primary "" 1048576B 107374706687B
Executing: parted -s /dev/sda mkpart primary "" 107374706688B 214748364799B

Output for sameas:sda

# cat /var/lib/fai/config/disk_config/SAMEAS_SDA 
disk_config sda disklabel:msdos align-at:4k
primary -       1G-50%         -                         -
primary -       1G-50%         -                         -

disk_config sdb sameas:sda

# setup-storage -X -f /var/lib/fai/config/disk_config/SAMEAS_SDA 
Starting setup-storage 1.5
Using config file: /var/lib/fai/config/disk_config/SAMEAS_SDA
Undefined subroutine &Storable::clone called at (eval 93) line 3547, 
<$config_file> line 1.

The only change is replacing 'disk1' with 'sda'.

'patch2_fix' is the actual fix. (replace call to clone with dclone), 
patch1_indentation fixes the indentation of Parser.pm (replace all leading tabs 
with spaces, since that's the intended style.), patch3_rewrite get's rid of 
the distinction between 'sameas:disk(\d+)' and sameas:(\S+) and changes the 
code into something I consider to be an improvement. YMMV.

Result after patching:

# setup-storage -X -f /var/lib/fai/config/disk_config/SAMEAS_SDA 
Starting setup-storage 1.5
Using config file: /var/lib/fai/config/disk_config/SAMEAS_SDA
Executing: wipefs -a /dev/sdb1
Executing: wipefs -a /dev/sdb2
Executing: parted -s /dev/sdb mklabel msdos
Executing: parted -s /dev/sdb mkpart primary "" 1048576B 107374706687B
Executing: parted -s /dev/sdb mkpart primary "" 107374706688B 214748364799B
Executing: wipefs -a /dev/sda1
Executing: wipefs -a /dev/sda2
Executing: parted -s /dev/sda mklabel msdos
Executing: parted -s /dev/sda mkpart primary "" 1048576B 107374706687B
Executing: parted -s /dev/sda mkpart primary "" 107374706688B 214748364799B

# setup-storage -X -f /var/lib/fai/config/disk_config/SAMEAS_DISK1 
Starting setup-storage 1.5
Using config file: /var/lib/fai/config/disk_config/SAMEAS_DISK1
Executing: wipefs -a /dev/sdb1
Executing: wipefs -a /dev/sdb2
Executing: parted -s /dev/sdb mklabel msdos
Executing: parted -s /dev/sdb mkpart primary "" 1048576B 107374706687B
Executing: parted -s /dev/sdb mkpart primary "" 107374706688B 214748364799B
Executing: wipefs -a /dev/sda1
Executing: wipefs -a /dev/sda2
Executing: parted -s /dev/sda mklabel msdos
Executing: parted -s /dev/sda mkpart primary "" 1048576B 107374706687B
Executing: parted -s /dev/sda mkpart primary "" 107374706688B 214748364799B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch1_indentation
Type: text/x-patch
Size: 4165 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20140624/db355a75/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch2_fix
Type: text/x-patch
Size: 824 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20140624/db355a75/attachment-0001.bin>
-------------- next part --------------
disk_config disk1 disklabel:msdos align-at:4k
primary -       1G-50%         -                         -
primary -       1G-50%         -                         -

disk_config disk2 sameas:disk1
-------------- next part --------------
disk_config sda disklabel:msdos align-at:4k
primary -       1G-50%         -                         -
primary -       1G-50%         -                         -

disk_config sdb sameas:sda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch3_rewrite
Type: text/x-patch
Size: 3755 bytes
Desc: not available
URL: <http://lists.uni-koeln.de/pipermail/linux-fai-devel/attachments/20140624/db355a75/attachment-0002.bin>


More information about the linux-fai-devel mailing list