nixos/tests/installer: prevent race between parted and udev

by combining all parted commands into a single parted call.
This eliminates one cause of non-deterministic failure.
This commit is contained in:
Uli Baum 2018-09-22 01:32:06 +02:00
parent 3748c250bb
commit a5183762c5

View File

@ -282,9 +282,9 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary linux-swap 1M 1024M",
"parted --script /dev/vda -- mkpart primary ext2 1024M -1s",
"parted --script /dev/vda -- mklabel msdos"
. " mkpart primary linux-swap 1M 1024M"
. " mkpart primary ext2 1024M -1s",
"udevadm settle",
"mkswap /dev/vda1 -L swap",
"swapon -L swap",
@ -299,11 +299,11 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted --script /dev/vda mklabel gpt",
"parted --script /dev/vda -- mkpart ESP fat32 1M 50MiB", # /boot
"parted --script /dev/vda -- set 1 boot on",
"parted --script /dev/vda -- mkpart primary linux-swap 50MiB 1024MiB",
"parted --script /dev/vda -- mkpart primary ext2 1024MiB -1MiB", # /
"parted --script /dev/vda -- mklabel gpt"
. " mkpart ESP fat32 1M 50MiB" # /boot
. " set 1 boot on"
. " mkpart primary linux-swap 50MiB 1024MiB"
. " mkpart primary ext2 1024MiB -1MiB", # /
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
@ -321,11 +321,11 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted --script /dev/vda mklabel gpt",
"parted --script /dev/vda -- mkpart ESP fat32 1M 50MiB", # /boot
"parted --script /dev/vda -- set 1 boot on",
"parted --script /dev/vda -- mkpart primary linux-swap 50MiB 1024MiB",
"parted --script /dev/vda -- mkpart primary ext2 1024MiB -1MiB", # /
"parted --script /dev/vda -- mklabel gpt"
. " mkpart ESP fat32 1M 50MiB" # /boot
. " set 1 boot on"
. " mkpart primary linux-swap 50MiB 1024MiB"
. " mkpart primary ext2 1024MiB -1MiB", # /
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
@ -345,10 +345,10 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary ext2 1M 50MB", # /boot
"parted --script /dev/vda -- mkpart primary linux-swap 50MB 1024M",
"parted --script /dev/vda -- mkpart primary ext2 1024M -1s", # /
"parted --script /dev/vda -- mklabel msdos"
. " mkpart primary ext2 1M 50MB" # /boot
. " mkpart primary linux-swap 50MB 1024M"
. " mkpart primary ext2 1024M -1s", # /
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
@ -366,10 +366,10 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary ext2 1M 50MB", # /boot
"parted --script /dev/vda -- mkpart primary linux-swap 50MB 1024M",
"parted --script /dev/vda -- mkpart primary ext2 1024M -1s", # /
"parted --script /dev/vda -- mklabel msdos"
. " mkpart primary ext2 1M 50MB" # /boot
. " mkpart primary linux-swap 50MB 1024M"
. " mkpart primary ext2 1024M -1s", # /
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
@ -402,9 +402,9 @@ in {
createPartitions =
''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary linux-swap 1M 1024M",
"parted --script /dev/vda -- mkpart primary 1024M -1s",
"parted --script /dev/vda -- mklabel msdos"
. " mkpart primary linux-swap 1M 1024M"
. " mkpart primary 1024M -1s",
"udevadm settle",
"mkswap /dev/vda1 -L swap",
@ -425,11 +425,11 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary 1M 2048M", # PV1
"parted --script /dev/vda -- set 1 lvm on",
"parted --script /dev/vda -- mkpart primary 2048M -1s", # PV2
"parted --script /dev/vda -- set 2 lvm on",
"parted --script /dev/vda -- mklabel msdos"
. " mkpart primary 1M 2048M" # PV1
. " set 1 lvm on"
. " mkpart primary 2048M -1s" # PV2
. " set 2 lvm on",
"udevadm settle",
"pvcreate /dev/vda1 /dev/vda2",
"vgcreate MyVolGroup /dev/vda1 /dev/vda2",
@ -447,10 +447,10 @@ in {
luksroot = makeInstallerTest "luksroot"
{ createPartitions = ''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary ext2 1M 50MB", # /boot
"parted --script /dev/vda -- mkpart primary linux-swap 50M 1024M",
"parted --script /dev/vda -- mkpart primary 1024M -1s", # LUKS
"parted --script /dev/vda -- mklabel msdos"
. " mkpart primary ext2 1M 50MB" # /boot
. " mkpart primary linux-swap 50M 1024M"
. " mkpart primary 1024M -1s", # LUKS
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
@ -481,11 +481,11 @@ in {
filesystemEncryptedWithKeyfile = makeInstallerTest "filesystemEncryptedWithKeyfile"
{ createPartitions = ''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary ext2 1M 50MB", # /boot
"parted --script /dev/vda -- mkpart primary linux-swap 50M 1024M",
"parted --script /dev/vda -- mkpart primary 1024M 1280M", # LUKS with keyfile
"parted --script /dev/vda -- mkpart primary 1280M -1s",
"parted --script /dev/vda -- mklabel msdos"
. " mkpart primary ext2 1M 50MB" # /boot
. " mkpart primary linux-swap 50M 1024M"
. " mkpart primary 1024M 1280M" # LUKS with keyfile
. " mkpart primary 1280M -1s",
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
@ -555,9 +555,9 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted --script /dev/sda mklabel msdos",
"parted --script /dev/sda -- mkpart primary linux-swap 1M 1024M",
"parted --script /dev/sda -- mkpart primary ext2 1024M -1s",
"parted --script /dev/sda -- mklabel msdos"
. " mkpart primary linux-swap 1M 1024M"
. " mkpart primary ext2 1024M -1s",
"udevadm settle",
"mkswap /dev/sda1 -L swap",
"swapon -L swap",