Introduce support for kvm acceleration

This change introduces kvm acceleration support. The default settings
still use qemu as the domain type and kvm needs to be explicitly set
in order to enable it.

Change-Id: I59af1b7a844b927cac45722f7ea7ea4abeef7c8f
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
This commit is contained in:
Fatih Degirmenci 2016-08-15 14:05:59 +02:00
parent c6fc3b01c2
commit 6fa28b1fb7
6 changed files with 23 additions and 2 deletions

View File

@ -24,6 +24,10 @@ test_vm_memory_size: Tunable setting to allow a user to define a specific
between test runs, you may need to undefine the test
virtual machine(s) that were previously created.
test_vm_domain_type: Tunable setting to allow a user to chosee the domain
type of the created VMs. The default is "qemu" and can
be set to kvm to enable kvm acceleration.
test_vm_num_nodes: Tunable setting to allow a user to define the number of
test VMs that will be created. They will all be created
with same settings.

View File

@ -3,3 +3,4 @@
baremetal_csv_file: "/tmp/baremetal.csv"
test_vm_memory_size: "3072"
test_vm_num_nodes: "1"
test_vm_domain_type: "qemu"

View File

@ -17,6 +17,9 @@
# # Create 3 nodes with base name of 'junk'
# sudo NODEBASE=junk NODECOUNT=3 create_nodes.sh
#
# # Create 2 nodes that use KVM acceleration
# sudo VM_DOMAIN_TYPE=kvm NODECOUNT=2 create_nodes.sh
#
# THANKS
# Thanks to the author(s) of the ironic-supporting code within devstack,
# from which all of this is derived.
@ -34,6 +37,7 @@ LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
export VIRSH_DEFAULT_CONNECT_URI="$LIBVIRT_CONNECT_URI"
# VM specs
VM_DOMAIN_TYPE=${VM_DOMAIN_TYPE:-qemu}
VM_EMULATOR=${VM_EMULATOR:-/usr/bin/qemu-system-x86_64}
VM_CPU=${VM_CPU:-1}
VM_RAM=${VM_RAM:-3072}
@ -67,6 +71,7 @@ VM_LOGDIR=/var/log/libvirt/baremetal_logs
# $6: Network bridge for the VMs
# $7: Path to VM emulator
# $8: Logging directory for the VMs
# $9: Domain type of the VM
#############################################################################
function create_node {
NAME=$1
@ -85,6 +90,7 @@ function create_node {
BRIDGE=$6
EMULATOR=$7
LOGDIR=$8
DOMAIN_TYPE=$9
LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"e1000"}
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
@ -135,7 +141,7 @@ function create_node {
chattr +C "$volume_path" || true
fi
vm_xml="
<domain type='qemu'>
<domain type='${DOMAIN_TYPE}'>
<name>${NAME}</name>
<memory unit='KiB'>${MEM}</memory>
<vcpu>${CPU}</vcpu>
@ -238,7 +244,7 @@ fi
for (( i=1; i<=${NODECOUNT}; i++ ))
do
name=${NODEBASE}${i}
mac=$(create_node $name $VM_CPU $VM_RAM $VM_DISK amd64 $VM_NET_BRIDGE $VM_EMULATOR $VM_LOGDIR)
mac=$(create_node $name $VM_CPU $VM_RAM $VM_DISK amd64 $VM_NET_BRIDGE $VM_EMULATOR $VM_LOGDIR $VM_DOMAIN_TYPE)
printf "$mac,root,undefined,192.168.122.1,$VM_CPU,$VM_RAM,$VM_DISK,flavor,type,a8cb6624-0d9f-c882-affc-046ebb96ec0${i},$name,192.168.122.$((i+1))\n" >>$TEMPFILE
done

View File

@ -56,6 +56,7 @@
environment:
NODEOUTPUT: "{{baremetal_csv_file}}"
VM_RAM: "{{ test_vm_memory_size }}"
VM_DOMAIN_TYPE: "{{ test_vm_domain_type }}"
NODECOUNT: "{{ test_vm_num_nodes }}"
register: task_create_vm_nodes
ignore_errors: yes

View File

@ -0,0 +1,7 @@
---
features:
- Add support for kvm acceleration for the VMs created
by bifrost-create-vm-nodes. The default domain type
for the created VMs is qemu which uses tcg acceleration.
In order to use kvm acceleration, users need to set
VM_DOMAIN_TYPE to kvm.

View File

@ -23,6 +23,7 @@ BUILD_IMAGE="false"
# use cirros.
VM_MEMORY_SIZE="3072"
VM_DOMAIN_TYPE=qemu
TEST_VM_NUM_NODES=1
USE_CIRROS=true
TESTING_USER=cirros
@ -106,6 +107,7 @@ ${ANSIBLE} -vvvv \
test-bifrost-create-vm.yaml \
-e test_vm_num_nodes=${TEST_VM_NUM_NODES} \
-e test_vm_memory_size=${VM_MEMORY_SIZE} \
-e test_vm_domain_type=${VM_DOMAIN_TYPE} \
-e enable_venv=${ENABLE_VENV}
if [ ${USE_DHCP} = "true" ]; then