pygrub fix + cirros tests + lopartsetup fix
Subsystems (2)
cover pygrub fix + cirros tests + lopartsetup fix
First patch moves python2.7/site-packages/* to python2.7/dist-packages/ at debian package build, this fixes pygrub imports.
Cirros tests are also introduced by this series of patches. Changes since the previous patchsets:
- Downloaded cirros components are kept in a separate folder
- Each test sets up its own images, keeping the downloaded
parts intact
- qemu-img and pvgrub detection moved to common-functions
There is one patch which fixes lopartsetup with fdisk from newer util-linux
Géza Gémes (11):
Fix installation of python libs
Introduce cirros tests
Introduce cirros-separate-kernel-pv test
Introduce cirros-pygrub-pv test
Introduce cirros-pvgrub2-pv test
Introduce cirros-qemu-hvm test
Introduce cirros-minios-stubdom-hvm test
Introduce cirros-qemu-pvhvm test
Introduce cirros-minios-stubdom-pvhvm test
Fix lopartsetup for util-linux >= 2.27.1
Enable cirros tests in the default config
defconfig | 2 +- lib/common-functions.sh | 23 +++++++ lib/common-tests.sh | 126 +++++++++++++++++++++++++++++++++++++ scripts/lopartsetup | 18 +++++- scripts/mkdeb | 3 + tests-configs/config-cirros_x86_32 | 13 ++++ tests-configs/config-cirros_x86_64 | 13 ++++ tests/cirros-minios-stubdom-hvm | 26 ++++++++ tests/cirros-minios-stubdom-pvhvm | 27 ++++++++ tests/cirros-pvgrub2-pv | 24 +++++++ tests/cirros-pygrub-pv | 24 +++++++ tests/cirros-qemu-hvm | 25 ++++++++ tests/cirros-qemu-pvhvm | 26 ++++++++ tests/cirros-separate-kernel-pv | 26 ++++++++ tests/series | 7 +++ 15 files changed, 381 insertions(+), 2 deletions(-) create mode 100644 tests-configs/config-cirros_x86_32 create mode 100644 tests-configs/config-cirros_x86_64 create mode 100644 tests/cirros-minios-stubdom-hvm create mode 100644 tests/cirros-minios-stubdom-pvhvm create mode 100644 tests/cirros-pvgrub2-pv create mode 100644 tests/cirros-pygrub-pv create mode 100644 tests/cirros-qemu-hvm create mode 100644 tests/cirros-qemu-pvhvm create mode 100644 tests/cirros-separate-kernel-pv
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/11 Fix installation of python libs
Change deb package build in order to move the site-packages folder to dist-packages in this way having the libs inluded in the default PYTHONPATH
--- scripts/mkdeb | 3 +++ 1 file changed, 3 insertions(+)
scripts/mkdeb +3 -0
@@ -46,6 +46,9 @@ then rm -rf deb/usr/lib64 fi +# Make sure that python libs will be in the path +mv deb/usr/lib/python2.7/site-packages deb/usr/lib/python2.7/dist-packages + # Fill in the debian boilerplate mkdir -p deb/DEBIAN cat >deb/DEBIAN/control <<EOF
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 3/11 Introduce cirros-separate-kernel-pv test
In reply to Géza GémesThis test is the cirros equivalent of the bussybox-pv test
--- tests/cirros-separate-kernel-pv | 26 ++++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 27 insertions(+) create mode 100644 tests/cirros-separate-kernel-pv
tests/cirros-separate-kernel-pv new file +26 -0
@@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e + +function cirros-separate-kernel-pv-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-separate-kernel-pv-test() { + testdir=`mktemp -d` + set_up_cirros_kernel_initrd $testdir + set_up_cirros_rootfs $testdir + cat >$testdir/cirros-separate-kernel-pv.cfg <<EOF +name = "raisin-test" +memory = 128 +vcpus = 2 +kernel = "$testdir/$CIRROS_KERNEL_FILE" +ramdisk = "$testdir/$CIRROS_INITRD_FILE" +disk = [ '$testdir/$CIRROS_ROOTFS_FILE,raw,xvda,rw' ] +extra = "root=/dev/xvda" +vif = [ 'bridge=xenbr1' ] +EOF + + $SUDO xl create $testdir/cirros-separate-kernel-pv.cfg + check_guest_alive +}
tests/series +1 -0
@@ -1,3 +1,4 @@ busybox-pv busybox-hvm busybox-hvm-migrate +cirros-separate-kernel-pv
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 4/11 Introduce cirros-pygrub-pv test
In reply to Géza GémesThis test verifies booting the cirros image using pygrub
--- tests/cirros-pygrub-pv | 24 ++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 25 insertions(+) create mode 100644 tests/cirros-pygrub-pv
tests/cirros-pygrub-pv new file +24 -0
@@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +function cirros-pygrub-pv-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-pygrub-pv-test() { + testdir=`mktemp -d` + set_up_cirros_disk $testdir + cat >$testdir/cirros-pygrub-pv.cfg <<EOF +name = "raisin-test" +memory = 128 +vcpus = 2 +bootloader = "pygrub" +disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ] +extra = "root=/dev/xvda1" +vif = [ 'bridge=xenbr1' ] +EOF + + $SUDO xl create $testdir/cirros-pygrub-pv.cfg + check_guest_alive +}
tests/series +1 -0
@@ -2,3 +2,4 @@ busybox-pv busybox-hvm busybox-hvm-migrate cirros-separate-kernel-pv +cirros-pygrub-pv
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 5/11 Introduce cirros-pvgrub2-pv test
In reply to Géza GémesThis test verifies booting the cirros image using pvgrub2
--- tests/cirros-pvgrub2-pv | 24 ++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 25 insertions(+) create mode 100644 tests/cirros-pvgrub2-pv
tests/cirros-pvgrub2-pv new file +24 -0
@@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -e + +function cirros-pvgrub2-pv-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-pvgrub2-pv-test() { + testdir=`mktemp -d` + set_up_cirros_disk $testdir grub_install + cat >$testdir/cirros-pvgrub2-pv.cfg <<EOF +name = "raisin-test" +memory = 128 +vcpus = 2 +kernel = "$PVGRUB" +disk = [ '${testdir}/${CIRROS_DISK_FILE},raw,xvda,rw' ] +extra = "$CIRROS_GRUB_CFG" +vif = [ 'bridge=xenbr1' ] +EOF + + $SUDO xl create $testdir/cirros-pvgrub2-pv.cfg + check_guest_alive +}
tests/series +1 -0
@@ -3,3 +3,4 @@ busybox-hvm busybox-hvm-migrate cirros-separate-kernel-pv cirros-pygrub-pv +cirros-pvgrub2-pv
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 6/11 Introduce cirros-qemu-hvm test
In reply to Géza GémesThis test is the cirros equivalent of the bussybox-hvm test
--- tests/cirros-qemu-hvm | 25 +++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 26 insertions(+) create mode 100644 tests/cirros-qemu-hvm
tests/cirros-qemu-hvm new file +25 -0
@@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -e + +function cirros-qemu-hvm-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-qemu-hvm-test() { + testdir=`mktemp -d` + set_up_cirros_disk $testdir + cat >$testdir/cirros-qemu-hvm.cfg <<EOF +name = "raisin-test" +builder = "hvm" +memory = 128 +vcpus = 2 +disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ] +vif = [ 'bridge=xenbr1' ] +serial="pty" +boot="c" +EOF + + $SUDO xl create $testdir/cirros-qemu-hvm.cfg + check_guest_alive +}
tests/series +1 -0
@@ -4,3 +4,4 @@ busybox-hvm-migrate cirros-separate-kernel-pv cirros-pygrub-pv cirros-pvgrub2-pv +cirros-qemu-hvm
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/11 Introduce cirros tests
In reply to Géza GémesAdd support for using cirros images in raisin tests
--- lib/common-functions.sh | 23 +++++++ lib/common-tests.sh | 126 +++++++++++++++++++++++++++++++++++++ tests-configs/config-cirros_x86_32 | 13 ++++ tests-configs/config-cirros_x86_64 | 13 ++++ 4 files changed, 175 insertions(+) create mode 100644 tests-configs/config-cirros_x86_32 create mode 100644 tests-configs/config-cirros_x86_64
lib/common-functions.sh +23 -0
@@ -439,3 +439,26 @@ function uninstall_package() { error_echo "Don't know how to uninstall packages on $DISTRO" fi } + +function get-qemu-img() { + set +e + QEMU_IMG=`which qemu-img` + set -e + if [[ -z "$QEMU_IMG" ]] + then + QEMU_IMG="/usr/lib/xen/bin/qemu-img" + fi + export QEMU_IMG +} + +function get-pvgrub() { + ARCH=$1 + set +e + PVGRUB=`which grub-${ARCH}-xen` + set -e + if [[ -z "$PVGRUB" ]] + then + PVGRUB="/usr/lib/xen/boot/grub-${ARCH}-xen" + fi + export PVGRUB +}
lib/common-tests.sh +126 -0
129 lines not on this page · raw message
tests-configs/config-cirros_x86_32 new file +13 -0
@@ -0,0 +1,13 @@ +CIRROS_ARCH=i386 +CIRROS_BASE_URL="https://download.cirros-cloud.net/" +CIRROS_VERSION="0.3.5" +CIRROS_DOWNLOADS=$BASEDIR/downloads +CIRROS_KERNEL_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-kernel +CIRROS_INITRD_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initramfs +CIRROS_ROOTFS_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img +CIRROS_DISK_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img +CIRROS_KERNEL_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_KERNEL_FILE} +CIRROS_INITRD_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_INITRD_FILE} +CIRROS_ROOTFS_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_ROOTFS_FILE}.gz +CIRROS_DISK_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_DISK_FILE} +CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
tests-configs/config-cirros_x86_64 new file +13 -0
@@ -0,0 +1,13 @@ +CIRROS_ARCH=x86_64 +CIRROS_BASE_URL="https://download.cirros-cloud.net/" +CIRROS_VERSION="0.3.5" +CIRROS_DOWNLOADS=$BASEDIR/downloads +CIRROS_KERNEL_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-kernel +CIRROS_INITRD_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initramfs +CIRROS_ROOTFS_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img +CIRROS_DISK_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img +CIRROS_KERNEL_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_KERNEL_FILE} +CIRROS_INITRD_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_INITRD_FILE} +CIRROS_ROOTFS_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_ROOTFS_FILE}.gz +CIRROS_DISK_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_DISK_FILE} +CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 7/11 Introduce cirros-minios-stubdom-hvm test
In reply to Géza GémesThis test verifies a cirros based hvm domain using a minios based stubdom as its device model
--- tests/cirros-minios-stubdom-hvm | 26 ++++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 27 insertions(+) create mode 100644 tests/cirros-minios-stubdom-hvm
tests/cirros-minios-stubdom-hvm new file +26 -0
@@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e + +function cirros-minios-stubdom-hvm-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-minios-stubdom-hvm-test() { + testdir=`mktemp -d` + set_up_cirros_disk $testdir + cat >$testdir/cirros-minios-stubdom-hvm.cfg <<EOF +name = "raisin-test" +builder = "hvm" +device_model_stubdomain_override = 1 +memory = 128 +vcpus = 2 +disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ] +vif = [ 'bridge=xenbr1' ] +serial="pty" +boot="c" +EOF + + $SUDO xl create $testdir/cirros-minios-stubdom-hvm.cfg + check_guest_alive +}
tests/series +1 -0
@@ -5,3 +5,4 @@ cirros-separate-kernel-pv cirros-pygrub-pv cirros-pvgrub2-pv cirros-qemu-hvm +cirros-minios-stubdom-hvm
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 8/11 Introduce cirros-qemu-pvhvm test
In reply to Géza GémesThis test is similar to cirros-qemu-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers
--- tests/cirros-qemu-pvhvm | 26 ++++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 27 insertions(+) create mode 100644 tests/cirros-qemu-pvhvm
tests/cirros-qemu-pvhvm new file +26 -0
@@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e + +function cirros-qemu-pvhvm-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-qemu-pvhvm-test() { + testdir=`mktemp -d` + set_up_cirros_disk $testdir + cat >$testdir/cirros-qemu-pvhvm.cfg <<EOF +name = "raisin-test" +builder = "hvm" +xen_platform_pci = 1 +memory = 128 +vcpus = 2 +disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ] +vif = [ 'bridge=xenbr1' ] +serial="pty" +boot="c" +EOF + + $SUDO xl create $testdir/cirros-qemu-pvhvm.cfg + check_guest_alive +}
tests/series +1 -0
@@ -6,3 +6,4 @@ cirros-pygrub-pv cirros-pvgrub2-pv cirros-qemu-hvm cirros-minios-stubdom-hvm +cirros-qemu-pvhvm
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 9/11 Introduce cirros-minios-stubdom-pvhvm test
In reply to Géza GémesThis test is similar to cirros-minios-stubdom-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers
--- tests/cirros-minios-stubdom-pvhvm | 27 +++++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 28 insertions(+) create mode 100644 tests/cirros-minios-stubdom-pvhvm
tests/cirros-minios-stubdom-pvhvm new file +27 -0
@@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e + +function cirros-minios-stubdom-pvhvm-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-minios-stubdom-pvhvm-test() { + testdir=`mktemp -d` + set_up_cirros_disk $testdir + cat >$testdir/cirros-minios-stubdom-pvhvm.cfg <<EOF +name = "raisin-test" +builder = "hvm" +device_model_stubdomain_override = 1 +xen_platform_pci = 1 +memory = 128 +vcpus = 2 +disk = [ '$testdir/$CIRROS_DISK_FILE,raw,xvda,rw' ] +vif = [ 'bridge=xenbr1' ] +serial="pty" +boot="c" +EOF + + $SUDO xl create $testdir/cirros-minios-stubdom-pvhvm.cfg + check_guest_alive +}
tests/series +1 -0
@@ -7,3 +7,4 @@ cirros-pvgrub2-pv cirros-qemu-hvm cirros-minios-stubdom-hvm cirros-qemu-pvhvm +cirros-minios-stubdom-pvhvm
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 11/11 Enable cirros tests in the default config
In reply to Géza GémesThe existing cirros tests are enabled, with the following exceptions:
cirros-minios-stubdom-hvm and cirros-minios-stubdom-pvhvm are skipped as raisin does not install the stubdom
--- defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
defconfig +1 -1
@@ -31,4 +31,4 @@ GIT_TRANSPORT="git" # Tests ## All tests: busybox-pv busybox-hvm ## ENABLED_TESTS is the list of test run by raise test -ENABLED_TESTS="busybox-pv busybox-hvm" +ENABLED_TESTS="busybox-pv busybox-hvm cirros-separate-kernel-pv cirros-pygrub-pv cirros-pvgrub2-pv cirros-qemu-hvm cirros-qemu-pvhvm"
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 10/11 Fix lopartsetup for util-linux >= 2.27.1
In reply to Géza Gémesfdisk from util-linux >= 2.27.1 returns units in a slightly different structure than earlier versions
--- scripts/lopartsetup | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
scripts/lopartsetup +17 -1
@@ -53,7 +53,23 @@ then exit 1 fi -unit="`fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | cut -d " " -f 9`" +unitstring="" +column=0 +if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | wc -l` -eq 1 ] +then + unitstring="^Units = " + column=9 +else if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units:" | wc -l` -eq 1 ] +then + unitstring="^Units:" + column=8 +else + exit 1 +fi +fi + +unit="`fdisk -lu $filename 2>/dev/null | grep -e "$unitstring" | cut -d " " -f $column`" + index=0 for i in "`fdisk -lu $filename 2>/dev/null | grep -e "^$filename"`" do
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 02/11] Introduce cirros tests
In reply to Géza GémesQuoted 3 lines · Géza Gémes
Add support for using cirros images in raisin tests
Signed-off-by Géza Gémes <[email protected]>
Thank you! Much, much better, almost ready :)
I have only a couple of suggestions and questions left, see below.
Quoted 16 lines
lib/common-functions.sh | 23 +++++++ lib/common-tests.sh | 126 +++++++++++++++++++++++++++++++++++++ tests-configs/config-cirros_x86_32 | 13 ++++ tests-configs/config-cirros_x86_64 | 13 ++++ 4 files changed, 175 insertions(+) create mode 100644 tests-configs/config-cirros_x86_32 create mode 100644 tests-configs/config-cirros_x86_64lib/common-functions.sh +0
-0@@ -439,3 +439,26 @@ function uninstall_package() { error_echo "Don't know how to uninstall packages on $DISTRO" fi }
lib/common-functions.sh function uninstall_package() { · line 451
Quoted 10 lines
lib/common-functions.sh +10
-0+ +function get-qemu-img() { + set +e + QEMU_IMG=`which qemu-img` + set -e + if [[ -z "$QEMU_IMG" ]] + then + QEMU_IMG="/usr/lib/xen/bin/qemu-img" + fi + export QEMU_IMG
we probably want to test that $QEMU_IMG exists (test -f), and print an error if it doesn't
lib/common-functions.sh function uninstall_package() { · line 463
Quoted 12 lines
lib/common-functions.sh +12
-0+} + +function get-pvgrub() { + ARCH=$1 + set +e + PVGRUB=`which grub-${ARCH}-xen` + set -e + if [[ -z "$PVGRUB" ]] + then + PVGRUB="/usr/lib/xen/boot/grub-${ARCH}-xen" + fi + export PVGRUB
Same here.
Also, I don't see who is calling get-qemu-img and get-pvgrub in this patch series.
Quoted 16 lines
lib/common-functions.sh +1
-0+}lib/common-tests.sh +7
-0@@ -178,3 +178,129 @@ function get_host_initrd() { exit 1 fi } + +function cirros_network_init() { + rootdir=$1 + ifile=`mktemp` + # Create static network config + cat >$ifile <<EOF +auto lo
lib/common-tests.sh function get_host_initrd() { · line 197
Quoted 10 lines
lib/common-tests.sh +10
-0+iface lo inet loopback + +auto eth0 +iface eth0 inet static + address 169.254.0.2 + network 169.254.0.0 + broadcast 169.254.0.255 + netmask 255.255.255.0 +EOF + $SUDO mv $ifile $rootdir/etc/network/interfaces
This is OK. However, we need to to "mv -f" otherwise it might ask for confirmation before overwriting.
Quoted 26 lines
lib/common-tests.sh +26
-0+ # Disable cloud-init + $SUDO rm -f ${rootdir}/etc/rc3.d/S*cirros*ds* + $SUDO rm -f ${rootdir}/etc/rc3.d/S*-cirros-userdata +} + +function get_cirros_kernel() { + bootdir=$1 + basename `find $bootdir -name vmlinuz* 2>/dev/null | head -1` +} + +function get_cirros_initrd() { + bootdir=$1 + basename `find $bootdir -name initrd* 2>/dev/null | head -1` +} + +function cirros_grub_cfg() { + rootdir=$1 + grubroot="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 1`)" + grubcfg="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 2`" + grubdir=`dirname $grubcfg` + bootdir=`dirname $grubdir` + tmpgrubcfg=`mktemp` + cat > $tmpgrubcfg <<EOF +root="$grubroot" +insmod xzio +insmod gzio
lib/common-tests.sh function get_host_initrd() { · line 233
Quoted 10 lines
lib/common-tests.sh +10
-0+insmod btrfs +insmod ext2 +set timeout=1 +set default=0 +menuentry Cirros { + linux `echo $bootdir`/`get_cirros_kernel ${rootdir}/${bootdir}` root=/dev/xvda1 ro + initrd `echo $bootdir`/`get_cirros_initrd ${rootdir}/${bootdir}` +} +EOF + $SUDO mv $tmpgrubcfg ${rootdir}/${grubcfg}
mv -f
lib/common-tests.sh function get_host_initrd() { · line 243
Quoted 10 lines
lib/common-tests.sh +10
-0+} + +function download_cirros_components() { + verbose_echo "Downloading cirros components" + . tests-configs/config-cirros_$RAISIN_ARCH + mkdir -p $CIRROS_DOWNLOADS + wget -q -c $CIRROS_KERNEL_URL -P $CIRROS_DOWNLOADS + wget -q -c $CIRROS_INITRD_URL -P $CIRROS_DOWNLOADS + wget -q -c $CIRROS_ROOTFS_URL -P $CIRROS_DOWNLOADS + wget -q -c $CIRROS_DISK_URL -P $CIRROS_DOWNLOADS
If the downloads are already there, does wget do the right thing? I guess it does. Otherwise, do we need to test -f each of the files?
lib/common-tests.sh function get_host_initrd() { · line 249
Quoted 6 lines
lib/common-tests.sh +6
-0+} + +function set_up_cirros_kernel_initrd() { + local testdir=$1 + mkdir -p $testdir + download_cirros_components
I would probably move the download_cirros_components call to the test scripts, for example cirros-separate-kernel-pv-test.
lib/common-tests.sh function get_host_initrd() { · line 261
Quoted 12 lines
lib/common-tests.sh +12
-0+ verbose_echo "Setting up kernel and initrd for cirros test" + cp $CIRROS_DOWNLOADS/$CIRROS_KERNEL_FILE $testdir + cp $CIRROS_DOWNLOADS/$CIRROS_INITRD_FILE $testdir +} + +function set_up_cirros_rootfs() { + local testdir=$1 + mkdir -p $testdir + download_cirros_components + verbose_echo "Setting up rootfs for cirros test" + cp $CIRROS_DOWNLOADS/$CIRROS_ROOTFS_FILE.gz $testdir + gunzip $testdir/$CIRROS_ROOTFS_FILE.gz
I would leave the unzipped file under $CIRROS_DOWNLOADS, so that we don't have to unzip the same rootfs file twice.
I would also test for the existance of the unzipped file here and skip the whole setup if it is already present. So the first time, we unzip and setup the network interfaces file; the second time we just test that the unzipped file exists and return. Would that work?
Quoted 9 lines
lib/common-tests.sh +9
-0+ local cirros_rootfs_loop=`create_loop $testdir/$CIRROS_ROOTFS_FILE` + local cirros_rootfs_mntpt=`mktemp -d` + $SUDO mount $cirros_rootfs_loop $cirros_rootfs_mntpt + cirros_network_init $cirros_rootfs_mntpt + $SUDO umount $cirros_rootfs_mntpt + $SUDO rmdir $cirros_rootfs_mntpt + $SUDO losetup -d $cirros_rootfs_loop +} +
lib/common-tests.sh function get_host_initrd() { · line 280
Quoted 10 lines
lib/common-tests.sh +10
-0+function set_up_cirros_disk() { + local testdir=$1 + mkdir -p $testdir + local grub_install=False + if [[ $# -gt 1 ]] + then + grub_install=$2 + else + unset grub_install + fi
Is this test actually needed? It doesn't look like anything is calling set_up_cirros_disk with more than one argument.
lib/common-tests.sh function get_host_initrd() { · line 283
Quoted 3 lines
lib/common-tests.sh +3
-0+ download_cirros_components + verbose_echo "Setting up disk for cirros test" + $QEMU_IMG convert -f qcow2 -O raw $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir/$CIRROS_DISK_FILE
Similarly to the rootfs, I would output the conversion to $CIRROS_DOWNLOADS to avoid doing it twice. The second time the function gets called, I would just test for the existance of the raw file and return. (It is probably best to rename the raw file to something like $CIRROS_DISK_FILE.raw). In addition, if possible, I would also do the following setup only the first time around. Does it make sense?
lib/common-tests.sh function get_host_initrd() { · line 294
Quoted 11 lines
lib/common-tests.sh +11
-0+ local cirros_disk_loop=`$SUDO $BASEDIR/scripts/lopartsetup $testdir/$CIRROS_DISK_FILE | head -1 | cut -d ":" -f 1` + local cirros_disk_mntpt=`mktemp -d` + $SUDO mount $cirros_disk_loop $cirros_disk_mntpt + cirros_network_init $cirros_disk_mntpt + if [[ -n $grub_install ]] + then + cirros_grub_cfg $cirros_disk_mntpt + fi + $SUDO umount $cirros_disk_mntpt + $SUDO rmdir $cirros_disk_mntpt + $SUDO losetup -d $cirros_disk_loop
This is just for you information. If you remove the loop device, it means that you'll end up using the QEMU userspace disk backend. Otherwise if you keep the loop device around and use it for the backend, you end up using the in-kernel disk backend, which is typically faster. In other words, the following:
disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ]
ends up using the QEMU disk backend, while the following:
disk = [ '$cirros_disk_loop,raw,hda,rw' ]
ends up using the kernel disk backend.
Either choice is fine for the tests, I just wanted to make sure you knew :)
lib/common-tests.sh function get_host_initrd() { · line 299
Quoted 5 lines
lib/common-tests.sh +5
-0+} + +function tear_down_cirros_test() { + testdir=$1 + if [[ `$SUDO xl vm-list | grep -e "raisin-test" | wc -l` -gt 0 ]]
Why "grep -e"? I think grep is sufficient.
Quoted 16 lines
lib/common-tests.sh +7
-0+ then + $SUDO xl destroy "raisin-test" + fi + verbose_echo "$PREPEND deleting environment of cirros test" + $SUDO rm -rf $testdir +} +tests-configs/config-cirros_x86_32 new file +3
-0@@ -0,0 +1,13 @@ +CIRROS_ARCH=i386 +CIRROS_BASE_URL="https://download.cirros-cloud.net/" +CIRROS_VERSION="0.3.5"
tests-configs/config-cirros_x86_32 line 13
Quoted 10 lines
tests-configs/config-cirros_x86_32 new file +10
-0+CIRROS_DOWNLOADS=$BASEDIR/downloads +CIRROS_KERNEL_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-kernel +CIRROS_INITRD_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initramfs +CIRROS_ROOTFS_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img +CIRROS_DISK_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img +CIRROS_KERNEL_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_KERNEL_FILE} +CIRROS_INITRD_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_INITRD_FILE} +CIRROS_ROOTFS_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_ROOTFS_FILE}.gz +CIRROS_DISK_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_DISK_FILE} +CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
No need for {} around variables. For example, this should work:
CIRROS_DISK_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-disk.img
But other than that, the two config files look fine.
Quoted 9 lines
tests-configs/config-cirros_x86_64 new file +3
-0@@ -0,0 +1,13 @@ +CIRROS_ARCH=x86_64 +CIRROS_BASE_URL="https://download.cirros-cloud.net/" +CIRROS_VERSION="0.3.5"
tests-configs/config-cirros_x86_64 line 13
Quoted 10 lines
tests-configs/config-cirros_x86_64 new file +10
-0+CIRROS_DOWNLOADS=$BASEDIR/downloads +CIRROS_KERNEL_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-kernel +CIRROS_INITRD_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initramfs +CIRROS_ROOTFS_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img +CIRROS_DISK_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img +CIRROS_KERNEL_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_KERNEL_FILE} +CIRROS_INITRD_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_INITRD_FILE} +CIRROS_ROOTFS_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_ROOTFS_FILE}.gz +CIRROS_DISK_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_DISK_FILE} +CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 11/11] Enable cirros tests in the default config
In reply to Géza GémesQuoted 6 lines · Géza Gémes
The existing cirros tests are enabled, with the following exceptions:
cirros-minios-stubdom-hvm and cirros-minios-stubdom-pvhvm are skipped as raisin does not install the stubdomSigned-off-by Géza Gémes <[email protected]>
You can keep my Reviewed-by tag from before. Usually once the maintainer replies with his Reviewed-by, the next time the submitter sends the patch series he adds the Reviewed-by right below the Signed-off-by, unless he makes significant changes to the patch.
Basically, all patches need a Reviewed-by from one of the maintainers. Once all patches have it, they get committed.
Quoted 16 lines
defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)defconfig +1
-1@@ -31,4 +31,4 @@ GIT_TRANSPORT="git" # Tests ## All tests: busybox-pv busybox-hvm ## ENABLED_TESTS is the list of test run by raise test -ENABLED_TESTS="busybox-pv busybox-hvm" +ENABLED_TESTS="busybox-pv busybox-hvm cirros-separate-kernel-pv cirros-pygrub-pv cirros-pvgrub2-pv cirros-qemu-hvm cirros-qemu-pvhvm"Signature · 1 line
2.7.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 01/11] Fix installation of python libs
In reply to Géza GémesQuoted 14 lines · Géza Gémes
Change deb package build in order to move the site-packages folder to dist-packages in this way having the libs inluded in the default PYTHONPATH
Signed-off-by Géza Gémes <[email protected]>--- scripts/mkdeb | 3 +++ 1 file changed, 3 insertions(+)scripts/mkdeb +0
-0
scripts/mkdeb then · line 50
Quoted 5 lines
scripts/mkdeb +2
-0@@ -46,6 +46,9 @@ then rm -rf deb/usr/lib64 fi +# Make sure that python libs will be in the path +mv deb/usr/lib/python2.7/site-packages deb/usr/lib/python2.7/dist-packages
I think we need to do the following, just in case dist-packages is already present (we don't want to end up with deb/usr/lib/python2.7/dist-packages/site-packages):
mkdir -p deb/usr/lib/python2.7/dist-packages
mv deb/usr/lib/python2.7/site-packages/* deb/usr/lib/python2.7/dist-packages
Quoted 6 lines
scripts/mkdeb +0
-0# Fill in the debian boilerplate mkdir -p deb/DEBIAN cat >deb/DEBIAN/control <<EOFSignature · 1 line
2.7.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 03/11] Introduce cirros-separate-kernel-pv test
In reply to Géza GémesQuoted 1 line · Géza Gémes
This test is the cirros equivalent of the bussybox-pv test
^ busybox-pv
Quoted 13 lines
Signed-off-by Géza Gémes <[email protected]>--- tests/cirros-separate-kernel-pv | 26 ++++++++++++++++++++++++++ tests/series | 1 + 2 files changed, 27 insertions(+) create mode 100644 tests/cirros-separate-kernel-pvtests/cirros-separate-kernel-pv new file +0
-0
tests/cirros-separate-kernel-pv line 10
Quoted 10 lines
tests/cirros-separate-kernel-pv new file +10
-0@@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -e + +function cirros-separate-kernel-pv-cleanup() { + tear_down_cirros_test $testdir +} + +function cirros-separate-kernel-pv-test() { + testdir=`mktemp -d`
I would move the call to download_cirros_components here. The test looks fine though.
Quoted 29 lines
tests/cirros-separate-kernel-pv new file +17
-0+ set_up_cirros_kernel_initrd $testdir + set_up_cirros_rootfs $testdir + cat >$testdir/cirros-separate-kernel-pv.cfg <<EOF +name = "raisin-test" +memory = 128 +vcpus = 2 +kernel = "$testdir/$CIRROS_KERNEL_FILE" +ramdisk = "$testdir/$CIRROS_INITRD_FILE" +disk = [ '$testdir/$CIRROS_ROOTFS_FILE,raw,xvda,rw' ] +extra = "root=/dev/xvda" +vif = [ 'bridge=xenbr1' ] +EOF + + + $SUDO xl create $testdir/cirros-separate-kernel-pv.cfg + check_guest_alive +}tests/series +1
-0@@ -1,3 +1,4 @@ busybox-pv busybox-hvm busybox-hvm-migrate +cirros-separate-kernel-pvSignature · 1 line
2.7.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 10/11] Fix lopartsetup for util-linux >= 2.27.1
In reply to Géza GémesQuoted 21 lines · Géza Gémes
fdisk from util-linux >= 2.27.1 returns units in a slightly different structure than earlier versions
Signed-off-by Géza Gémes <[email protected]>--- scripts/lopartsetup | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)scripts/lopartsetup +4
-1@@ -53,7 +53,23 @@ then exit 1 fi -unit="`fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | cut -d " " -f 9`" +unitstring="" +column=0 +if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | wc -l` -eq 1 ] +then
scripts/lopartsetup then · line 69
Quoted 10 lines
scripts/lopartsetup +10
-0+ unitstring="^Units = " + column=9 +else if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units:" | wc -l` -eq 1 ] +then + unitstring="^Units:" + column=8 +else + exit 1 +fi +fi
two fi?
Aside from that, the patch looks good, so I fixed it myself and committed it.
Quoted 8 lines
scripts/lopartsetup +2
-0+unit="`fdisk -lu $filename 2>/dev/null | grep -e "$unitstring" | cut -d " " -f $column`" + index=0 for i in "`fdisk -lu $filename 2>/dev/null | grep -e "^$filename"`" doSignature · 1 line
2.7.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 10/11] Fix lopartsetup for util-linux >= 2.27.1
Hi Stefano,
Unfortunately, the patch has an other typo too. Please see below:
Quoted 17 lines · Géza Gémes
Quoted 16 lines
fdisk from util-linux >= 2.27.1 returns units in a slightly different structure than earlier versions
Signed-off-by Géza Gémes <[email protected]>--- scripts/lopartsetup | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)scripts/lopartsetup +0
-0@@ -53,7 +53,23 @@ then exit 1 fi
Quoted 8 lines
scripts/lopartsetup then · line 62
Quoted 8 lines
scripts/lopartsetup +7
-1-unit="`fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | cut -d " " -f 9`" +unitstring="" +column=0 +if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units = " | wc -l` -eq 1 ] +then + unitstring="^Units = " + column=9 +else if [ `fdisk -lu $filename 2>/dev/null | grep -e "^Units:" | wc -l` -eq 1 ]
this should have been elif [ fdisk -lu $filename 2>/dev/null | grep -e "^Units:" | wc -l -eq 1 ]
Quoted 13 lines
scripts/lopartsetup then · line 69
Quoted 7 lines
scripts/lopartsetup +7
-0+then + unitstring="^Units:" + column=8 +else + exit 1 +fi +fitwo fi?
Aside from that, the patch looks good, so I fixed it myself and committed it.
Quoted 7 lines
Quoted 7 lines
scripts/lopartsetup +2
-0+unit="`fdisk -lu $filename 2>/dev/null | grep -e "$unitstring" | cut -d " " -f $column`" + index=0 for i in "`fdisk -lu $filename 2>/dev/null | grep -e "^$filename"`" doSignature · 1 line
2.7.4
I'll send a patch fixing this in a couple of seconds.
Cheers,
Geza
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 02/11] Introduce cirros tests
In reply to Stefano StabelliniHi Stefano,
A few answers/comments inline:
Quoted 29 lines · Géza Gémes
Quoted 3 lines
Add support for using cirros images in raisin tests
Signed-off-by Géza Gémes<[email protected]>Thank you! Much, much better, almost ready :)
I have only a couple of suggestions and questions left, see below.
Quoted 20 lines
lib/common-functions.sh | 23 +++++++ lib/common-tests.sh | 126 +++++++++++++++++++++++++++++++++++++ tests-configs/config-cirros_x86_32 | 13 ++++ tests-configs/config-cirros_x86_64 | 13 ++++ 4 files changed, 175 insertions(+)create mode 100644 tests-configs/config-cirros_x86_32 create mode 100644 tests-configs/config-cirros_x86_64
lib/common-functions.sh +4
-0@@ -439,3 +439,26 @@ function uninstall_package() { error_echo "Don't know how to uninstall packages on $DISTRO" fi } + +function get-qemu-img() { + set +e + QEMU_IMG=`which qemu-img`
Quoted 8 lines
lib/common-functions.sh function uninstall_package() { · line 451
Quoted 6 lines
lib/common-functions.sh +6
-0+ set -e + if [[ -z "$QEMU_IMG" ]] + then + QEMU_IMG="/usr/lib/xen/bin/qemu-img" + fi + export QEMU_IMGwe probably want to test that $QEMU_IMG exists (test -f), and print an error if it doesn't
For QEMU_IMG I would rather check if it is executable, as that is needed.
Quoted 14 lines
lib/common-functions.sh function uninstall_package() { · line 463
Quoted 12 lines
lib/common-functions.sh +12
-0+} + +function get-pvgrub() { + ARCH=$1 + set +e + PVGRUB=`which grub-${ARCH}-xen` + set -e + if [[ -z "$PVGRUB" ]] + then + PVGRUB="/usr/lib/xen/boot/grub-${ARCH}-xen" + fi + export PVGRUBSame here.
Quoted 3 lines
Also, I don't see who is calling get-qemu-img and get-pvgrub in this patch series.
This is strange. I've called them now explicitly.
Quoted 20 lines
Quoted 20 lines
lib/common-functions.sh +1
-0+}lib/common-tests.sh +11
-0@@ -178,3 +178,129 @@ function get_host_initrd() { exit 1 fi } + +function cirros_network_init() { + rootdir=$1 + ifile=`mktemp` + # Create static network config + cat >$ifile <<EOF +auto lo +iface lo inet loopback + +auto eth0 +iface eth0 inet static
Quoted 9 lines
lib/common-tests.sh function get_host_initrd() { · line 197
Quoted 6 lines
lib/common-tests.sh +6
-0+ address 169.254.0.2 + network 169.254.0.0 + broadcast 169.254.0.255 + netmask 255.255.255.0 +EOF + $SUDO mv $ifile $rootdir/etc/network/interfacesThis is OK. However, we need to to "mv -f" otherwise it might ask for confirmation before overwriting.
Done.
Quoted 29 lines
Quoted 29 lines
lib/common-tests.sh +29
-0+ # Disable cloud-init + $SUDO rm -f ${rootdir}/etc/rc3.d/S*cirros*ds* + $SUDO rm -f ${rootdir}/etc/rc3.d/S*-cirros-userdata +} + +function get_cirros_kernel() { + bootdir=$1 + basename `find $bootdir -name vmlinuz* 2>/dev/null | head -1` +} + +function get_cirros_initrd() { + bootdir=$1 + basename `find $bootdir -name initrd* 2>/dev/null | head -1` +} + +function cirros_grub_cfg() { + rootdir=$1 + grubroot="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 1`)" + grubcfg="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 2`" + grubdir=`dirname $grubcfg` + bootdir=`dirname $grubdir` + tmpgrubcfg=`mktemp` + cat > $tmpgrubcfg <<EOF +root="$grubroot" +insmod xzio +insmod gzio +insmod btrfs +insmod ext2 +set timeout=1
Quoted 8 lines
lib/common-tests.sh function get_host_initrd() { · line 233
Quoted 7 lines
lib/common-tests.sh +7
-0+set default=0 +menuentry Cirros { + linux `echo $bootdir`/`get_cirros_kernel ${rootdir}/${bootdir}` root=/dev/xvda1 ro + initrd `echo $bootdir`/`get_cirros_initrd ${rootdir}/${bootdir}` +} +EOF + $SUDO mv $tmpgrubcfg ${rootdir}/${grubcfg}mv -f
Done.
Quoted 4 lines
Quoted 4 lines
lib/common-tests.sh +4
-0+} + +function download_cirros_components() { + verbose_echo "Downloading cirros components"
Quoted 8 lines
lib/common-tests.sh function get_host_initrd() { · line 243
Quoted 6 lines
lib/common-tests.sh +6
-0+ . tests-configs/config-cirros_$RAISIN_ARCH + mkdir -p $CIRROS_DOWNLOADS + wget -q -c $CIRROS_KERNEL_URL -P $CIRROS_DOWNLOADS + wget -q -c $CIRROS_INITRD_URL -P $CIRROS_DOWNLOADS + wget -q -c $CIRROS_ROOTFS_URL -P $CIRROS_DOWNLOADS + wget -q -c $CIRROS_DISK_URL -P $CIRROS_DOWNLOADSIf the downloads are already there, does wget do the right thing? I guess it does. Otherwise, do we need to test -f each of the files?
wget -c tries to continue the download. If the file is fully downloaded it does nothing. However given your other suggestion to do unzipping right in this function, I'll change that into checking for the existence of the files.
Quoted 8 lines
lib/common-tests.sh function get_host_initrd() { · line 249
Quoted 6 lines
lib/common-tests.sh +6
-0+} + +function set_up_cirros_kernel_initrd() { + local testdir=$1 + mkdir -p $testdir + download_cirros_componentsI would probably move the
download_cirros_componentscall to the test scripts, for example cirros-separate-kernel-pv-test.
Done.
Quoted 15 lines
lib/common-tests.sh function get_host_initrd() { · line 261
Quoted 12 lines
lib/common-tests.sh +12
-0+ verbose_echo "Setting up kernel and initrd for cirros test" + cp $CIRROS_DOWNLOADS/$CIRROS_KERNEL_FILE $testdir + cp $CIRROS_DOWNLOADS/$CIRROS_INITRD_FILE $testdir +} + +function set_up_cirros_rootfs() { + local testdir=$1 + mkdir -p $testdir + download_cirros_components + verbose_echo "Setting up rootfs for cirros test" + cp $CIRROS_DOWNLOADS/$CIRROS_ROOTFS_FILE.gz $testdir + gunzip $testdir/$CIRROS_ROOTFS_FILE.gzI would leave the unzipped file under $CIRROS_DOWNLOADS, so that we don't have to unzip the same rootfs file twice.
Quoted 5 lines
I would also test for the existance of the unzipped file here and skip the whole setup if it is already present. So the first time, we unzip and setup the network interfaces file; the second time we just test that the unzipped file exists and return. Would that work?
Done.
Quoted 13 lines
Quoted 13 lines
lib/common-tests.sh +13
-0+ local cirros_rootfs_loop=`create_loop $testdir/$CIRROS_ROOTFS_FILE` + local cirros_rootfs_mntpt=`mktemp -d` + $SUDO mount $cirros_rootfs_loop $cirros_rootfs_mntpt + cirros_network_init $cirros_rootfs_mntpt + $SUDO umount $cirros_rootfs_mntpt + $SUDO rmdir $cirros_rootfs_mntpt + $SUDO losetup -d $cirros_rootfs_loop +} + +function set_up_cirros_disk() { + local testdir=$1 + mkdir -p $testdir + local grub_install=False
Quoted 8 lines
lib/common-tests.sh function get_host_initrd() { · line 280
Quoted 6 lines
lib/common-tests.sh +6
-0+ if [[ $# -gt 1 ]] + then + grub_install=$2 + else + unset grub_install + fiIs this test actually needed? It doesn't look like anything is calling
set_up_cirros_diskwith more than one argument.
The pvgrub test, which needs a grub2 config file (not included by cirros) calls this with two arguments. However as I restructured the code this function is dropped.
Quoted 9 lines
lib/common-tests.sh function get_host_initrd() { · line 283
Quoted 3 lines
lib/common-tests.sh +3
-0+ download_cirros_components + verbose_echo "Setting up disk for cirros test" + $QEMU_IMG convert -f qcow2 -O raw $CIRROS_DOWNLOADS/$CIRROS_DISK_FILE $testdir/$CIRROS_DISK_FILESimilarly to the rootfs, I would output the conversion to $CIRROS_DOWNLOADS to avoid doing it twice. The second time the function gets called, I would just test for the existance of the raw file and return. (It is probably best to rename the raw file to something like $CIRROS_DISK_FILE.raw). In addition, if possible, I would also do the following setup only the first time around. Does it make sense?
Done
Quoted 17 lines
lib/common-tests.sh function get_host_initrd() { · line 294
Quoted 11 lines
lib/common-tests.sh +11
-0+ local cirros_disk_loop=`$SUDO $BASEDIR/scripts/lopartsetup $testdir/$CIRROS_DISK_FILE | head -1 | cut -d ":" -f 1` + local cirros_disk_mntpt=`mktemp -d` + $SUDO mount $cirros_disk_loop $cirros_disk_mntpt + cirros_network_init $cirros_disk_mntpt + if [[ -n $grub_install ]] + then + cirros_grub_cfg $cirros_disk_mntpt + fi + $SUDO umount $cirros_disk_mntpt + $SUDO rmdir $cirros_disk_mntpt + $SUDO losetup -d $cirros_disk_loopThis is just for you information. If you remove the loop device, it means that you'll end up using the QEMU userspace disk backend. Otherwise if you keep the loop device around and use it for the backend, you end up using the in-kernel disk backend, which is typically faster. In other words, the following:
Quoted 9 lines
disk = [ '$testdir/$CIRROS_DISK_FILE,raw,hda,rw' ]ends up using the QEMU disk backend, while the following:
disk = [ '$cirros_disk_loop,raw,hda,rw' ]ends up using the kernel disk backend.
Either choice is fine for the tests, I just wanted to make sure you knew :)
Thanks for the info. I didn't know. However for simplicity I'll keep the image files.
Quoted 7 lines
lib/common-tests.sh function get_host_initrd() { · line 299
Quoted 5 lines
lib/common-tests.sh +5
-0+} + +function tear_down_cirros_test() { + testdir=$1 + if [[ `$SUDO xl vm-list | grep -e "raisin-test" | wc -l` -gt 0 ]]Why "grep -e"? I think grep is sufficient.
Done
Quoted 28 lines
Quoted 16 lines
lib/common-tests.sh +7
-0+ then + $SUDO xl destroy "raisin-test" + fi + verbose_echo "$PREPEND deleting environment of cirros test" + $SUDO rm -rf $testdir +} +tests-configs/config-cirros_x86_32 new file +3
-0@@ -0,0 +1,13 @@ +CIRROS_ARCH=i386 +CIRROS_BASE_URL="https://download.cirros-cloud.net/" +CIRROS_VERSION="0.3.5"tests-configs/config-cirros_x86_32 line 13
Quoted 10 lines
tests-configs/config-cirros_x86_32 new file +10
-0+CIRROS_DOWNLOADS=$BASEDIR/downloads +CIRROS_KERNEL_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-kernel +CIRROS_INITRD_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initramfs +CIRROS_ROOTFS_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img +CIRROS_DISK_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img +CIRROS_KERNEL_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_KERNEL_FILE} +CIRROS_INITRD_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_INITRD_FILE} +CIRROS_ROOTFS_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_ROOTFS_FILE}.gz +CIRROS_DISK_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_DISK_FILE} +CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"No need for {} around variables. For example, this should work:
Quoted 3 lines
CIRROS_DISK_FILE=cirros-$CIRROS_VERSION-$CIRROS_ARCH-disk.img
But other than that, the two config files look fine.
Done
Quoted 12 lines
Quoted 12 lines
tests-configs/config-cirros_x86_64 new file +5
-0@@ -0,0 +1,13 @@ +CIRROS_ARCH=x86_64 +CIRROS_BASE_URL="https://download.cirros-cloud.net/" +CIRROS_VERSION="0.3.5" +CIRROS_DOWNLOADS=$BASEDIR/downloads +CIRROS_KERNEL_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-kernel
Quoted 8 lines
tests-configs/config-cirros_x86_64 line 13
Quoted 8 lines
tests-configs/config-cirros_x86_64 new file +8
-0+CIRROS_INITRD_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-initramfs +CIRROS_ROOTFS_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-rootfs.img +CIRROS_DISK_FILE=cirros-${CIRROS_VERSION}-${CIRROS_ARCH}-disk.img +CIRROS_KERNEL_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_KERNEL_FILE} +CIRROS_INITRD_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_INITRD_FILE} +CIRROS_ROOTFS_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_ROOTFS_FILE}.gz +CIRROS_DISK_URL=${CIRROS_BASE_URL}/${CIRROS_VERSION}/${CIRROS_DISK_FILE} +CIRROS_GRUB_CFG="(xen/xvda,msdos1)/boot/grub/grub.cfg"
Cheers,
Geza
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel