@@ -106,7 +106,7 @@ class kvm(test.test):
raise
# Abort on error
logging.info("Aborting job (%s)", e)
- for vm in kvm_utils.env_get_all_vms(env):
+ for vm in env.get_all_vms():
if vm.is_dead():
continue
logging.info("VM '%s' is alive.", vm.name)
@@ -50,13 +50,13 @@ def preprocess_vm(test, params, env, name):
@param name: The name of the VM object.
"""
logging.debug("Preprocessing VM '%s'..." % name)
- vm = kvm_utils.env_get_vm(env, name)
+ vm = env.get_vm(name)
if vm:
logging.debug("VM object found in environment")
else:
logging.debug("VM object does not exist; creating it")
vm = kvm_vm.VM(name, params, test.bindir, env.get("address_cache"))
- kvm_utils.env_register_vm(env, name, vm)
+ env.register_vm(name, vm)
start_vm = False
@@ -122,7 +122,7 @@ def postprocess_vm(test, params, env, name):
@param name: The name of the VM object.
"""
logging.debug("Postprocessing VM '%s'..." % name)
- vm = kvm_utils.env_get_vm(env, name)
+ vm = env.get_vm(name)
if vm:
logging.debug("VM object found in environment")
else:
@@ -338,7 +338,7 @@ def postprocess(test, params, env):
if params.get("kill_unresponsive_vms") == "yes":
logging.debug("'kill_unresponsive_vms' specified; killing all VMs "
"that fail to respond to a remote login request...")
- for vm in kvm_utils.env_get_all_vms(env):
+ for vm in env.get_all_vms():
if vm.is_alive():
session = vm.remote_login()
if session:
@@ -350,7 +350,7 @@ def postprocess(test, params, env):
kvm_subprocess.kill_tail_threads()
# Terminate tcpdump if no VMs are alive
- living_vms = [vm for vm in kvm_utils.env_get_all_vms(env) if vm.is_alive()]
+ living_vms = [vm for vm in env.get_all_vms() if vm.is_alive()]
if not living_vms and "tcpdump" in env:
env["tcpdump"].close()
del env["tcpdump"]
@@ -408,7 +408,7 @@ def _take_screendumps(test, params, env):
cache = {}
while True:
- for vm in kvm_utils.env_get_all_vms(env):
+ for vm in env.get_all_vms():
if not vm.is_alive():
continue
try:
@@ -35,7 +35,7 @@ def get_living_vm(env, vm_name):
@param vm_name: Name of the desired VM object.
@return: A VM object.
"""
- vm = kvm_utils.env_get_vm(env, vm_name)
+ vm = env.get_vm(vm_name)
if not vm:
raise error.TestError("VM '%s' not found in environment" % vm_name)
if not vm.is_alive():
@@ -275,7 +275,7 @@ def migrate(vm, env=None, mig_timeout=3600, mig_protocol="tcp",
# Replace the source VM with the new cloned VM
if (dest_host == 'localhost') and (env is not None):
- kvm_utils.env_register_vm(env, vm.name, dest_vm)
+ env.register_vm(vm.name, dest_vm)
# Return the new cloned VM
if dest_host == 'localhost':
@@ -544,7 +544,7 @@ def run_ksm_overcommit(test, params, env):
# Creating the first guest
kvm_preprocessing.preprocess_vm(test, params, env, vm_name)
- lvms.append(kvm_utils.env_get_vm(env, vm_name))
+ lvms.append(env.get_vm(vm_name))
if not lvms[0]:
raise error.TestError("VM object not found in environment")
if not lvms[0].is_alive():
@@ -575,7 +575,7 @@ def run_ksm_overcommit(test, params, env):
# Last VM is later used to run more allocators simultaneously
lvms.append(lvms[0].clone(vm_name, params))
- kvm_utils.env_register_vm(env, vm_name, lvms[i])
+ env.register_vm(vm_name, lvms[i])
params['vms'] += " " + vm_name
logging.debug("Booting guest %s" % lvms[i].name)
@@ -289,7 +289,7 @@ def run_qemu_img(test, params, env):
# Start a new VM, using backing file as its harddisk
vm_name = params.get('main_vm')
kvm_preprocessing.preprocess_vm(test, params, env, vm_name)
- vm = kvm_utils.env_get_vm(env, vm_name)
+ vm = env.get_vm(vm_name)
vm.create()
timeout = int(params.get("login_timeout", 360))
session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
@@ -317,7 +317,7 @@ def run_qemu_img(test, params, env):
# Here, the commit_testfile should not exist
vm_name = params.get('main_vm')
kvm_preprocessing.preprocess_vm(test, params, env, vm_name)
- vm = kvm_utils.env_get_vm(env, vm_name)
+ vm = env.get_vm(vm_name)
vm.create()
timeout = int(params.get("login_timeout", 360))
session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
@@ -343,7 +343,7 @@ def run_qemu_img(test, params, env):
# Start a new VM, using image_name as its harddisk
vm_name = params.get('main_vm')
kvm_preprocessing.preprocess_vm(test, params, env, vm_name)
- vm = kvm_utils.env_get_vm(env, vm_name)
+ vm = env.get_vm(vm_name)
vm.create()
timeout = int(params.get("login_timeout", 360))
session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
@@ -337,7 +337,7 @@ class StepMaker(stepeditor.StepMakerWindow):
def run_stepmaker(test, params, env):
- vm = kvm_utils.env_get_vm(env, params.get("main_vm"))
+ vm = env.get_vm(params.get("main_vm"))
if not vm:
raise error.TestError("VM object not found in environment")
if not vm.is_alive():
@@ -181,7 +181,7 @@ def barrier_2(vm, words, params, debug_dir, data_scrdump_filename,
def run_steps(test, params, env):
- vm = kvm_utils.env_get_vm(env, params.get("main_vm"))
+ vm = env.get_vm(params.get("main_vm"))
if not vm:
raise error.TestError("VM object not found in environment")
if not vm.is_alive():
@@ -36,7 +36,7 @@ def run_stress_boot(tests, params, env):
vm_name = "vm" + str(num)
vm_params = vm.get_params().copy()
curr_vm = vm.clone(vm_name, vm_params)
- kvm_utils.env_register_vm(env, vm_name, curr_vm)
+ env.register_vm(vm_name, curr_vm)
logging.info("Booting guest #%d" % num)
kvm_preprocessing.preprocess_vm(tests, vm_params, env, vm_name)
params['vms'] += " " + vm_name
@@ -88,7 +88,7 @@ def run_unittest(test, params, env):
try:
vm_name = params.get('main_vm')
kvm_preprocessing.preprocess_vm(test, params, env, vm_name)
- vm = kvm_utils.env_get_vm(env, vm_name)
+ vm = env.get_vm(vm_name)
vm.create()
vm.monitor.cmd("cont")
logging.info("Waiting for unittest %s to complete, timeout %s, "
@@ -583,7 +583,7 @@ def run_virtio_console(test, params, env):
kvm_preprocessing.preprocess_vm(test, params, env,
params.get("main_vm"))
- vm = kvm_utils.env_get_vm(env, params.get("main_vm"))
+ vm = env.get_vm(params.get("main_vm"))
session = kvm_test_utils.wait_for_login(vm, 0,
float(params.get("boot_timeout", 240)),