Skip to contentSkip to conversation

Introduce usage of cirros images

PATCH New Géza Gémes 1 participant 11 messages Mar 18, 2017 Library code

lore
Share & tools
lore
#0 lore raw

cover Introduce usage of cirros images

Two tests: cirros-separate-kernel-pv and cirros-qemu-hvm are replicating the functionality of bussybox-pv and bussybox-hvm respectivelly. The other tests are testing pv, hvm and pvhvm vms with pygrub, pvgrub and stubdom configs.

Géza Gémes (10):
Fix lopartsetup parsing of fdisk output
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
Enable cirros tests in the default config

 configs/config-cirros             |  44 ++++++++++++++++
 defconfig                         |   4 +-
 lib/common-tests.sh               | 102 ++++++++++++++++++++++++++++++++++++++
 scripts/lopartsetup               |   6 ++-
 tests/cirros-minios-stubdom-hvm   |  29 +++++++++++
 tests/cirros-minios-stubdom-pvhvm |  30 +++++++++++
 tests/cirros-pvgrub2-pv           |  27 ++++++++++
 tests/cirros-pygrub-pv            |  27 ++++++++++
 tests/cirros-qemu-hvm             |  28 +++++++++++
 tests/cirros-qemu-pvhvm           |  29 +++++++++++
 tests/cirros-separate-kernel-pv   |  28 +++++++++++
 tests/series                      |   7 +++
 12 files changed, 359 insertions(+), 2 deletions(-)
 create mode 100644 configs/config-cirros
 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
#1 lore raw

PATCH 1/10 Fix lopartsetup parsing of fdisk output

Change lopartsetup in order to handle partitions, which have the boot flag enabled.

---
 scripts/lopartsetup | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/lopartsetup +5 -1
index bf33a28..04ce3cc 100755
@@ -58,7 +58,11 @@ index=0
 for i in "`fdisk -lu $filename 2>/dev/null | grep -e "^$filename"`"
 do
     index=$((index+1))
-    offset=`echo $i | tr -s " " | cut -d " " -f 2`
+    offset=`echo "$i" | tr -s " " | cut -d " " -f 2`
+    if [[ "$offset" == "*" ]]
+    then
+        offset=`echo "$i" | tr -s " " | cut -d " " -f 3`
+    fi
     offset=$((unit*offset))
 
     _create_loop_device "$filename" "$index" "$offset"
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

PATCH 2/10 Introduce cirros tests

In reply to Géza Gémes

Add support for using cirros images in raisin tests

---
 configs/config-cirros |  44 ++++++++++++++++++++++
 defconfig             |   2 +
 lib/common-tests.sh   | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 148 insertions(+)
 create mode 100644 configs/config-cirros
configs/config-cirros new file +44 -0
new file mode 100644
index 0000000..fa2823e
@@ -0,0 +1,44 @@
+CIRROS_BASE_URL="https://download.cirros-cloud.net/"
+CIRROS_VERSION="0.3.5"
+
+source `pwd`/lib/common-functions.sh
+get_arch
+case $RAISIN_ARCH in
+    x86_64)
+        CIRROS_ARCH=x86_64
+        ;;
+    x86_32)
+        CIRROS_ARCH=i386
+        ;;
+    *)
+        echo $PREPEND cirros tests only valid on x86, 32 or 64 bit
+        exit 1
+esac
+
+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"
+
+set +e
+QEMU_IMG=`which qemu-img`
+set -e
+if [[ -z "$QEMU_IMG" ]]
+then
+    QEMU_IMG="/usr/lib/xen/bin/qemu-img"
+fi
+
+set +e
+PVGRUB=`which grub-${CIRROS_ARCH}-xen`
+set -e
+if [[ -z "$PVGRUB" ]]
+then
+    PVGRUB="/usr/lib/xen/boot/grub-${CIRROS_ARCH}-xen"
+fi
+
defconfig +2 -0
index f8ef398..111554e 100644
@@ -32,3 +32,5 @@ GIT_TRANSPORT="git"
 ## All tests: busybox-pv busybox-hvm
 ## ENABLED_TESTS is the list of test run by raise test
 ENABLED_TESTS="busybox-pv busybox-hvm"
+
+. configs/config-cirros
lib/common-tests.sh +102 -0

105 lines not on this page · raw message

Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw

PATCH 3/10 Introduce cirros-separate-kernel-pv test

In reply to Géza Gémes

This test is the cirros equivalent of the bussybox-pv test

---
 tests/cirros-separate-kernel-pv | 28 ++++++++++++++++++++++++++++
 tests/series                    |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 tests/cirros-separate-kernel-pv
tests/cirros-separate-kernel-pv new file +28 -0
new file mode 100644
index 0000000..bbbcf7d
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-separate-kernel-pv-cleanup() {
+    tear_down_cirros_tests $tmpdir
+}
+
+function cirros-separate-kernel-pv-test() {
+    if [[ ! -d $tmpdir ]]
+    then
+        set_up_cirros_tests
+    fi
+    cd $tmpdir
+    cat >cirros-separate-kernel-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+kernel = "${tmpdir}/${CIRROS_KERNEL_FILE}"
+ramdisk = "${tmpdir}/${CIRROS_INITRD_FILE}"
+disk = [ '${tmpdir}/${CIRROS_ROOTFS_FILE},raw,xvda,rw' ]
+extra = "root=/dev/xvda"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create cirros-separate-kernel-pv.cfg
+    check_guest_alive
+}
tests/series +1 -0
index a2f4b34..38ee35a 100644
@@ -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
#4 lore raw

PATCH 4/10 Introduce cirros-pygrub-pv test

In reply to Géza Gémes

This test verifies booting the cirros image using pygrub

---
 tests/cirros-pygrub-pv | 27 +++++++++++++++++++++++++++
 tests/series           |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/cirros-pygrub-pv
tests/cirros-pygrub-pv new file +27 -0
new file mode 100644
index 0000000..4c15551
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-pygrub-pv-cleanup() {
+    tear_down_cirros_tests $tmpdir
+}
+
+function cirros-pygrub-pv-test() {
+    if [[ ! -d $tmpdir ]]
+    then
+        set_up_cirros_tests
+    fi
+    cd $tmpdir
+    cat >cirros-pygrub-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+bootloader = "pygrub"
+disk = [ '${tmpdir}/${CIRROS_DISK_FILE},raw,xvda,rw' ]
+extra = "root=/dev/xvda1"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create cirros-pygrub-pv.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 38ee35a..372fafb 100644
@@ -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
#5 lore raw

PATCH 5/10 Introduce cirros-pvgrub2-pv test

In reply to Géza Gémes

This test verifies booting the cirros image using pvgrub2

---
 tests/cirros-pvgrub2-pv | 27 +++++++++++++++++++++++++++
 tests/series            |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 tests/cirros-pvgrub2-pv
tests/cirros-pvgrub2-pv new file +27 -0
new file mode 100644
index 0000000..5c746fe
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-pvgrub2-pv-cleanup() {
+    tear_down_cirros_tests $tmpdir
+}
+
+function cirros-pvgrub2-pv-test() {
+    if [[ ! -d $tmpdir ]]
+    then
+        set_up_cirros_tests
+    fi
+    cd $tmpdir
+    cat >cirros-pvgrub2-pv.cfg <<EOF
+name = "raisin-test"
+memory = 128
+vcpus = 2
+kernel = "$PVGRUB"
+disk = [ '${tmpdir}/${CIRROS_DISK_FILE},raw,xvda,rw' ]
+extra = "$CIRROS_GRUB_CFG"
+vif = [ 'bridge=xenbr1' ]
+EOF
+
+    $SUDO xl create cirros-pvgrub2-pv.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 372fafb..1fec245 100644
@@ -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
#6 lore raw

PATCH 6/10 Introduce cirros-qemu-hvm test

In reply to Géza Gémes

This test is the cirros equivalent of the bussybox-hvm test

---
 tests/cirros-qemu-hvm | 28 ++++++++++++++++++++++++++++
 tests/series          |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 tests/cirros-qemu-hvm
tests/cirros-qemu-hvm new file +28 -0
new file mode 100644
index 0000000..963d380
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-qemu-hvm-cleanup() {
+    tear_down_cirros_tests $tmpdir
+}
+
+function cirros-qemu-hvm-test() {
+    if [[ ! -d $tmpdir ]]
+    then
+        set_up_cirros_tests
+    fi
+    cd $tmpdir
+    cat >cirros-qemu-hvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+memory = 128
+vcpus = 2
+disk = [ '${tmpdir}/${CIRROS_DISK_FILE},raw,hda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create cirros-qemu-hvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 1fec245..49a9257 100644
@@ -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
#7 lore raw

PATCH 7/10 Introduce cirros-minios-stubdom-hvm test

In reply to Géza Gémes

This test verifies a cirros based hvm domain using a minios based stubdom as its device model

---
 tests/cirros-minios-stubdom-hvm | 29 +++++++++++++++++++++++++++++
 tests/series                    |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 tests/cirros-minios-stubdom-hvm
tests/cirros-minios-stubdom-hvm new file +29 -0
new file mode 100644
index 0000000..86ced49
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-minios-stubdom-hvm-cleanup() {
+    tear_down_cirros_tests $tmpdir
+}
+
+function cirros-minios-stubdom-hvm-test() {
+    if [[ ! -d $tmpdir ]]
+    then
+        set_up_cirros_tests
+    fi
+    cd $tmpdir
+    cat >cirros-minios-stubdom-hvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+device_model_stubdomain_override = 1
+memory = 128
+vcpus = 2
+disk = [ '${tmpdir}/${CIRROS_DISK_FILE},raw,hda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create cirros-minios-stubdom-hvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 49a9257..7b1ad8e 100644
@@ -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
#8 lore raw

PATCH 8/10 Introduce cirros-qemu-pvhvm test

In reply to Géza Gémes

This test is similar to cirros-qemu-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers

---
 tests/cirros-qemu-pvhvm | 29 +++++++++++++++++++++++++++++
 tests/series            |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 tests/cirros-qemu-pvhvm
tests/cirros-qemu-pvhvm new file +29 -0
new file mode 100644
index 0000000..28c4f9d
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-qemu-pvhvm-cleanup() {
+    tear_down_cirros_tests $tmpdir
+}
+
+function cirros-qemu-pvhvm-test() {
+    if [[ ! -d $tmpdir ]]
+    then
+        set_up_cirros_tests
+    fi
+    cd $tmpdir
+    cat >cirros-qemu-pvhvm.cfg <<EOF
+name = "raisin-test"
+builder = "hvm"
+xen_platform_pci = 1
+memory = 128
+vcpus = 2
+disk = [ '${tmpdir}/${CIRROS_DISK_FILE},raw,xvda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create cirros-qemu-pvhvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 7b1ad8e..51dbe17 100644
@@ -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
#9 lore raw

PATCH 9/10 Introduce cirros-minios-stubdom-pvhvm test

In reply to Géza Gémes

This test is similar to cirros-minios-stubdom-hvm test, differing by explicitly exposing the xen netfront and blockfront drivers

---
 tests/cirros-minios-stubdom-pvhvm | 30 ++++++++++++++++++++++++++++++
 tests/series                      |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 tests/cirros-minios-stubdom-pvhvm
tests/cirros-minios-stubdom-pvhvm new file +30 -0
new file mode 100644
index 0000000..73b6834
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+set -e
+
+function cirros-minios-stubdom-pvhvm-cleanup() {
+    tear_down_cirros_tests $tmpdir
+}
+
+function cirros-minios-stubdom-pvhvm-test() {
+    if [[ ! -d $tmpdir ]]
+    then
+        set_up_cirros_tests
+    fi
+    cd $tmpdir
+    cat >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 = [ '${tmpdir}/${CIRROS_DISK_FILE},raw,xvda,rw' ]
+vif = [ 'bridge=xenbr1' ]
+serial="pty"
+boot="c"
+EOF
+
+    $SUDO xl create cirros-minios-stubdom-pvhvm.cfg
+    check_guest_alive
+}
tests/series +1 -0
index 51dbe17..ffa8e69 100644
@@ -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
#10 lore raw

PATCH 10/10 Enable cirros tests in the default config

In reply to Géza Gémes

The existing cirros tests are enabled, with the following exceptions:

cirros-pygrub-pv skipped as raisin installed pygrub has missing imports

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
index 111554e..8f6122b 100644
@@ -31,6 +31,6 @@ 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-pvgrub2-pv cirros-qemu-hvm cirros-qemu-pvhvm"
 
 . configs/config-cirros
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel