Fix DHCP test scenario

It appears that test nodes, once are explicitly powered off,
depending on libvirt, may completely vanish. As we only test
at the end of the process if we've observed additional DHCP
leases, we should move to only defining the VMs such that they
are powered on when the sequence is ready, not in advance of
the test sequence.

Moving to defining instead of creating does improve the overall
efficency of the sequence as no processes are spawning suddenly
using CPU and RAM during the start of the test. This also allows
us to remove and correct ansible virt module invocations.

The ansible virt module is an extra module, not a core module,
at least on Ubuntu Trusty, cannot have it's requirements installed
via pip.

Change-Id: I8948ba5a941384fdcacebcdfe9b6fd4fe8384cb1
Depends-On: I01885c397ed1e020aae306db1656678b26306532
This commit is contained in:
Julia Kreger 2016-08-09 16:41:10 -04:00
parent dc732e68f3
commit e3f8f86b08
2 changed files with 4 additions and 11 deletions

View File

@ -197,7 +197,9 @@ function create_node {
"
echo ${vm_xml} > /tmp/vm.xml
virsh create /tmp/vm.xml 2>&1 >/dev/null
# NOTE(TheJulia): the create command powers on a VM that has been defined,
# where as define creates the VM, but does not change the power state.
virsh define /tmp/vm.xml 2>&1 >/dev/null
if [ $? != 0 ]
then
echo "failed to create VM $NAME" >&2

View File

@ -16,13 +16,6 @@
# in the interest of keeping the active memory footprint small,
# should stop all of the VMs in advance, so we can proceed with
# install and initial deploy.
- name: Attempt to stop all test VMs
virt:
name: "testvm{{ item }}"
command: "stop"
state: shutdown
with_sequence: start=1 end={{ test_vm_num_nodes | default('5') }}
ignore_errors: yes
- name: Remove pre-existing leases file
file: path=/var/lib/misc/dnsmasq.leases state=absent
- hosts: localhost
@ -129,9 +122,7 @@
# validate that the dhcp config is working as expected and not
# serving these requests.
- name: Power on remaining test VMs
virt:
name: "testvm{{ item }}"
command: "start"
command: virsh start testvm{{item}}
with_sequence: start=4 end={{ test_vm_num_nodes | default('5') }}
ignore_errors: yes
when: inventory_dhcp | bool == true