KVM test: make stress_boot work properly with TAP networking
Take an additional parameter 'clone_address_index_base' which indicates the
initial value for 'address_index' for the cloned VMs. This value is
incremented after each clone is created. I assume the original VM has a single
NIC; otherwise NICs will end up sharing MAC addresses, which is bad.
Also, make a few small corrections:
- Take the params for the clones from the original VM's params, not from the
test's params, because the test's params contain information about several
VMs, only one of which is the original VM. The original VM's params, on the
other hand, describe just a single VM (which we want to clone).
- Change the way kill_vm.* parameters are sent to the postprocessor.
(The postprocessor doesn't read params from the VM objects but rather from the
test's params dict.)
- Replace 'if get_command_status(...)' with 'if get_command_status(...) != 0'.
- Replace the test command 'ps aux' with 'uname -a'. The silly reason for this
is that DSL-4.2.5 doesn't like 'ps aux'. Since 'uname -a' is just as good
(AFAIK), use it instead.
Signed-off-by: Michael Goldish <mgoldish@redhat.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3537 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py
index e814bee..0f34bb9 100644
--- a/client/tests/kvm/kvm_tests.py
+++ b/client/tests/kvm/kvm_tests.py
@@ -541,8 +541,8 @@
raise error.TestFail("Could not log into first guest")
num = 2
- vms = []
sessions = [session]
+ address_index = int(params.get("clone_address_index_base", 10))
# boot the VMs
while num <= int(params.get("max_vms")):
@@ -550,15 +550,12 @@
vm_name = "vm" + str(num)
# clone vm according to the first one
- vm_params = params.copy()
- vm_params['image_snapshot'] = "yes"
- vm_params['kill_vm'] = "yes"
- vm_params['kill_vm_gracefully'] = "no"
+ vm_params = vm.get_params().copy()
+ vm_params["address_index"] = str(address_index)
curr_vm = vm.clone(vm_name, vm_params)
kvm_utils.env_register_vm(env, vm_name, curr_vm)
params['vms'] += " " + vm_name
- #vms.append(curr_vm)
logging.info("Booting guest #%d" % num)
if not curr_vm.create():
raise error.TestFail("Cannot create VM #%d" % num)
@@ -571,10 +568,11 @@
sessions.append(curr_vm_session)
# check whether all previous ssh sessions are responsive
- for i, vm_session in enumerate(sessions):
- if vm_session.get_command_status(params.get("alive_test_cmd")):
+ for i, se in enumerate(sessions):
+ if se.get_command_status(params.get("alive_test_cmd")) != 0:
raise error.TestFail("Session #%d is not responsive" % i)
num += 1
+ address_index += 1
except (error.TestFail, OSError):
for se in sessions: