]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
testing: Add delay after qemu-nbd -c testing-trixie
authorTobias Brunner <tobias@strongswan.org>
Mon, 18 Aug 2025 16:05:01 +0000 (18:05 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 18 Aug 2025 16:05:01 +0000 (18:05 +0200)
Seems that there is a delay before the disk can be used when using newer
QEMU versions (e.g. on Debian trixie). We get errors like these:

  sfdisk: cannot open /dev/nbd0: Inappropriate ioctl for device

or

  mount: /srv/strongswan-testing/build/loop: special device /dev/nbd0p1 does not exist.

A sleep before the next command seems to help.

Also see [1].

[1] https://gitlab.com/qemu-project/qemu/-/issues/1413

testing/scripts/build-baseimage
testing/scripts/build-certs
testing/scripts/build-guestimages
testing/scripts/build-strongswan
testing/scripts/chroot

index 37dfef2d43bb3d1615245ffee3e6b37139dd9956..8221fb86aa7a7e08fa9c5783ebe62309f0e3b337 100755 (executable)
@@ -78,6 +78,9 @@ log_action "Connecting image to NBD device $NBDEV"
 execute "qemu-nbd -c $NBDEV $BASEIMG"
 do_on_exit qemu-nbd -d $NBDEV
 
+# wait for disk to become ready with newer QEMU versions
+sleep 1
+
 log_action "Partitioning disk"
 sfdisk /dev/nbd0 >>$LOGFILE 2>&1 << EOF
 ;
index a8648033ce03d45ac5c331043a16f9cb26458af1..04f4fc703a8ec632ce96f0b373476e5f088cb73f 100755 (executable)
@@ -22,6 +22,8 @@ mkdir -p $IMGDIR
 log_action "Connecting root image to NBD device $NBDEV"
 execute "qemu-nbd -c $NBDEV $ROOTIMG"
 do_on_exit qemu-nbd -d $NBDEV
+# wait for disk to become ready with newer QEMU versions
+sleep 1
 blockdev --rereadpt $NBDEV
 
 log_action "Mounting $NBDPARTITION to $LOOPDIR"
index ce6a0aee178b5d2558d6b386bd7f317c071a2ed3..c4d87c18748f9e18fe02dd8fe7bb247e246a497c 100755 (executable)
@@ -44,6 +44,8 @@ do
        log_action "Creating guest image for $host"
        execute "qemu-img create -b $ROOTIMG -f $IMGEXT -F $IMGEXT $IMGDIR/$host.$IMGEXT" 0
        execute "qemu-nbd -c $NBDEV $IMGDIR/$host.$IMGEXT" 0
+       # wait for disk to become ready with newer QEMU versions
+       sleep 1
        blockdev --rereadpt $NBDEV
        execute "mount $NBDPARTITION $LOOPDIR" 0
        execute "mount -t proc none $LOOPDIR/proc" 0
index 23cb2a0280fc66712b5cca238f2bf7f848b24064..8e6126ad30cfe0179055909b4e5c1e06244dda3b 100755 (executable)
@@ -115,6 +115,8 @@ case "$GUEST" in
 esac
 
 do_on_exit qemu-nbd -d $NBDEV
+# wait for disk to become ready with newer QEMU versions
+sleep 1
 blockdev --rereadpt $NBDEV
 
 log_action "Mounting $NBDPARTITION to $LOOPDIR"
index b686abd972bb7d272335a1a40af722f4a3bec3f9..c9a9dec7c89ca28c7bd20b57584224b5f9ceac61 100755 (executable)
@@ -42,6 +42,8 @@ root)
 esac
 
 do_on_exit qemu-nbd -d $NBDEV
+# wait for disk to become ready with newer QEMU versions
+sleep 1
 blockdev --rereadpt $NBDEV
 
 log_action "Mounting $NBDPARTITION to $LOOPDIR"