enable testing of openvz guests
This patch adds several options to allow using OpenVZ virt layer.
- modifies stack.sh and stackrc to recognize a new VIRT_TYPE option
- set IMAGE_URLS to an openvz image, if VIRT_TYPE == openvz
It also makes a few changes to some tests so that some implicit
defaults (such as the guest user account) can be overridden.
Change-Id: I0dde2dffbf3848fac1dd27eb37af84c0ac73d9aa
diff --git a/stack.sh b/stack.sh
index 3827d77..6b01bad 100755
--- a/stack.sh
+++ b/stack.sh
@@ -276,12 +276,6 @@
VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
INSTANCE_NAME_PREFIX=${INSTANCE_NAME_PREFIX:-instance-}
-# Nova hypervisor configuration. We default to libvirt with **kvm** but will
-# drop back to **qemu** if we are unable to load the kvm module. ``stack.sh`` can
-# also install an **LXC** based system.
-VIRT_DRIVER=${VIRT_DRIVER:-libvirt}
-LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
-
# Nova supports pluggable schedulers. ``FilterScheduler`` should work in most
# cases.
SCHEDULER=${SCHEDULER:-nova.scheduler.filter_scheduler.FilterScheduler}
@@ -1957,6 +1951,13 @@
# Need to avoid crash due to new firewall support
XEN_FIREWALL_DRIVER=${XEN_FIREWALL_DRIVER:-"nova.virt.firewall.IptablesFirewallDriver"}
add_nova_opt "firewall_driver=$XEN_FIREWALL_DRIVER"
+elif [ "$VIRT_DRIVER" = 'openvz' ]; then
+ # TODO(deva): OpenVZ driver does not yet work if compute_driver is set here.
+ # Replace connection_type when this is fixed.
+ # add_nova_opt "compute_driver=openvz.connection.OpenVzConnection"
+ add_nova_opt "connection_type=openvz"
+ LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
+ add_nova_opt "firewall_driver=$LIBVIRT_FIREWALL_DRIVER"
else
add_nova_opt "compute_driver=libvirt.LibvirtDriver"
LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
@@ -2212,6 +2213,14 @@
wget -c $image_url -O $FILES/$IMAGE_FNAME
fi
+ # OpenVZ-format images are provided as .tar.gz, but not decompressed prior to loading
+ if [[ "$image_url" =~ 'openvz' ]]; then
+ IMAGE="$FILES/${IMAGE_FNAME}"
+ IMAGE_NAME="${IMAGE_FNAME%.tar.gz}"
+ glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --public --container-format ami --disk-format ami < "$IMAGE"
+ continue
+ fi
+
KERNEL=""
RAMDISK=""
DISK_FORMAT=""