예제 #1
0
    control_str = control_base % sub_test_params
    try:
        fd = open(test_control_path, "w")
        fd.write(control_str)
        fd.close()
        _tmp_file_list.append(os.path.abspath(test_control_path))
    except IOError, e:
        _clean_up_tmp_files(_tmp_file_list)
        raise error.TestError("Fail to Generate control file,"
                              " error message:\n '%s'" % e)

    params["test_control_file_install"] = test_control_file

    error.context("Launch kernel installation test in guest")
    virt_test_utils.run_virt_sub_test(test, params, env, sub_type="autotest",
                                      tag="install")

    if params.get("need_reboot", "yes") == "yes":
        error.context("Reboot guest after kernel is installed")
        session.close()
        try:
            vm.reboot()
        except Exception:
            _clean_up_tmp_files(_tmp_file_list)
            raise error.TestFail("Could not login guest after install kernel")

    # Run Subtest in guest with new kernel
    if params.has_key("sub_test"):
        error.context("Run sub test in guest with new kernel")
        sub_test = params.get("sub_test")
        tag = params.get("sub_test_tag", "run")
예제 #2
0
    offset = vm_assigned_mem - guest_memory

    # Reduce memory to random size between Free memory
    # to max memory size
    s, o = session.cmd_status_output("cat /proc/meminfo")
    if s != 0:
        raise error.TestError("Can not get guest memory information")

    vm_mem_free = int(re.findall("MemFree:\s+(\d+).*", o)[0]) / 1024

    new_mem = int(random.uniform(vm_assigned_mem - vm_mem_free, vm_assigned_mem))
    fail += balloon_memory(new_mem, offset)
    # Run option test after evict memory
    if params.has_key("sub_balloon_test_evict"):
        balloon_test = params["sub_balloon_test_evict"]
        virt_test_utils.run_virt_sub_test(test, params, env, sub_type=balloon_test)
        if balloon_test == "shutdown":
            logging.info("Guest shutdown normally after balloon")
            return
    # Reset memory value to original memory assigned on qemu. This will ensure
    # we won't trigger guest OOM killer while running multiple iterations
    fail += balloon_memory(vm_assigned_mem, offset)

    # Run sub test after enlarge memory
    if params.has_key("sub_balloon_test_enlarge"):
        balloon_test = params["sub_balloon_test_enlarge"]
        virt_test_utils.run_virt_sub_test(test, params, env, sub_type=balloon_test)
        if balloon_test == "shutdown":
            logging.info("Guest shutdown normally after balloon")
            return
예제 #3
0
    # Reduce memory to random size between Free memory
    # to max memory size
    s, o = session.cmd_status_output("cat /proc/meminfo")
    if s != 0:
        raise error.TestError("Can not get guest memory information")

    vm_mem_free = int(re.findall('MemFree:\s+(\d+).*', o)[0]) / 1024

    new_mem = int(
        random.uniform(vm_assigned_mem - vm_mem_free, vm_assigned_mem))
    fail += balloon_memory(new_mem, offset)
    # Run option test after evict memory
    if params.has_key('sub_balloon_test_evict'):
        balloon_test = params['sub_balloon_test_evict']
        virt_test_utils.run_virt_sub_test(test,
                                          params,
                                          env,
                                          sub_type=balloon_test)
        if balloon_test == "shutdown":
            logging.info("Guest shutdown normally after balloon")
            return
    # Reset memory value to original memory assigned on qemu. This will ensure
    # we won't trigger guest OOM killer while running multiple iterations
    fail += balloon_memory(vm_assigned_mem, offset)

    # Run sub test after enlarge memory
    if params.has_key('sub_balloon_test_enlarge'):
        balloon_test = params['sub_balloon_test_enlarge']
        virt_test_utils.run_virt_sub_test(test,
                                          params,
                                          env,
                                          sub_type=balloon_test)