| OLD | NEW |
| 1 import logging | 1 import logging |
| 2 from autotest_lib.client.common_lib import error | 2 from autotest_lib.client.common_lib import error |
| 3 import kvm_preprocessing | 3 from autotest_lib.client.virt import virt_env_process |
| 4 | 4 |
| 5 | 5 |
| 6 @error.context_aware | 6 @error.context_aware |
| 7 def run_stress_boot(test, params, env): | 7 def run_stress_boot(test, params, env): |
| 8 """ | 8 """ |
| 9 Boots VMs until one of them becomes unresponsive, and records the maximum | 9 Boots VMs until one of them becomes unresponsive, and records the maximum |
| 10 number of VMs successfully started: | 10 number of VMs successfully started: |
| 11 1) boot the first vm | 11 1) boot the first vm |
| 12 2) boot the second vm cloned from the first vm, check whether it boots up | 12 2) boot the second vm cloned from the first vm, check whether it boots up |
| 13 and all booted vms respond to shell commands | 13 and all booted vms respond to shell commands |
| (...skipping 14 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 # Boot the VMs | 29 # Boot the VMs |
| 30 try: | 30 try: |
| 31 while num <= int(params.get("max_vms")): | 31 while num <= int(params.get("max_vms")): |
| 32 # Clone vm according to the first one | 32 # Clone vm according to the first one |
| 33 error.base_context("booting guest #%d" % num, logging.info) | 33 error.base_context("booting guest #%d" % num, logging.info) |
| 34 vm_name = "vm%d" % num | 34 vm_name = "vm%d" % num |
| 35 vm_params = vm.params.copy() | 35 vm_params = vm.params.copy() |
| 36 curr_vm = vm.clone(vm_name, vm_params) | 36 curr_vm = vm.clone(vm_name, vm_params) |
| 37 env.register_vm(vm_name, curr_vm) | 37 env.register_vm(vm_name, curr_vm) |
| 38 kvm_preprocessing.preprocess_vm(test, vm_params, env, vm_name) | 38 virt_env_process.preprocess_vm(test, vm_params, env, vm_name) |
| 39 params["vms"] += " " + vm_name | 39 params["vms"] += " " + vm_name |
| 40 | 40 |
| 41 sessions.append(curr_vm.wait_for_login(timeout=login_timeout)) | 41 sessions.append(curr_vm.wait_for_login(timeout=login_timeout)) |
| 42 logging.info("Guest #%d booted up successfully", num) | 42 logging.info("Guest #%d booted up successfully", num) |
| 43 | 43 |
| 44 # Check whether all previous shell sessions are responsive | 44 # Check whether all previous shell sessions are responsive |
| 45 for i, se in enumerate(sessions): | 45 for i, se in enumerate(sessions): |
| 46 error.context("checking responsiveness of guest #%d" % (i + 1), | 46 error.context("checking responsiveness of guest #%d" % (i + 1), |
| 47 logging.debug) | 47 logging.debug) |
| 48 se.cmd(params.get("alive_test_cmd")) | 48 se.cmd(params.get("alive_test_cmd")) |
| 49 num += 1 | 49 num += 1 |
| 50 finally: | 50 finally: |
| 51 for se in sessions: | 51 for se in sessions: |
| 52 se.close() | 52 se.close() |
| 53 logging.info("Total number booted: %d" % (num -1)) | 53 logging.info("Total number booted: %d" % (num -1)) |
| OLD | NEW |