当前位置: 首页>>代码示例>>Python>>正文


Python utils_test.run_virt_sub_test函数代码示例

本文整理汇总了Python中virttest.utils_test.run_virt_sub_test函数的典型用法代码示例。如果您正苦于以下问题:Python run_virt_sub_test函数的具体用法?Python run_virt_sub_test怎么用?Python run_virt_sub_test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了run_virt_sub_test函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run_clock_getres

def run_clock_getres(test, params, env):
    """
    Verify if guests using kvm-clock as the time source have a sane clock
    resolution.

    :param test: kvm test object.
    :param params: Dictionary with test parameters.
    :param env: Dictionary with the test environment.
    """
    source_name = "test_clock_getres/test_clock_getres.c"
    source_name = os.path.join(test.virtdir, "deps", source_name)
    dest_name = "/tmp/test_clock_getres.c"
    bin_name = "/tmp/test_clock_getres"

    if not os.path.isfile(source_name):
        raise error.TestError("Could not find %s" % source_name)

    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    timeout = int(params.get("login_timeout", 360))
    session = vm.wait_for_login(timeout=timeout)

    vm.copy_files_to(source_name, dest_name)
    session.cmd("gcc -lrt -o %s %s" % (bin_name, dest_name))
    session.cmd(bin_name)
    logging.info("PASS: Guest reported appropriate clock resolution")
    sub_test = params.get("sub_test")
    if sub_test:
        error.context("Run sub test '%s' after checking"
                      " clock resolution" % sub_test, logging.info)
        utils_test.run_virt_sub_test(test, params, env, sub_test)
开发者ID:Antique,项目名称:virt-test,代码行数:31,代码来源:clock_getres.py

示例2: run_subtest

 def run_subtest(sub_test):
     """
     Run subtest(e.g. rng_bat,reboot,shutdown) when it's not None
     :param sub_test: subtest name
     """
     error_context.context("Run %s subtest" % sub_test)
     utils_test.run_virt_sub_test(test, params, env, sub_test)
开发者ID:bssrikanth,项目名称:tp-qemu,代码行数:7,代码来源:rng_hotplug.py

示例3: run_migration_multi_host

def run_migration_multi_host(test, params, env):
    """
    KVM multi-host migration test:

    Migration execution progress is described in documentation
    for migrate method in class MultihostMigration.

    @param test: kvm test object.
    @param params: Dictionary with test parameters.
    @param env: Dictionary with the test environment.
    """
    login_timeout = int(params.get("login_timeout", 360))
    sub_test = params.get("sub_test")

    mig_protocol = params.get("mig_protocol", "tcp")
    mig_type = utils_test.MultihostMigration
    if mig_protocol == "fd":
        mig_type = utils_test.MultihostMigrationFd
    if mig_protocol == "exec":
        mig_type = utils_test.MultihostMigrationExec

    vms = params.get("vms").split(" ")
    srchost = params["hosts"][0]
    dsthost = params["hosts"][1]
    is_src = params["hostid"] == srchost

    mig = mig_type(test, params, env, False)
    mig.migrate_wait([vms[0]], srchost, dsthost)

    if not is_src:  #is destination
        if sub_test:
            error.context("Run sub test '%s' after checking"
                          " clock resolution" % sub_test, logging.info)
            utils_test.run_virt_sub_test(test, params, env, sub_test)
开发者ID:FengYang,项目名称:virt-test,代码行数:34,代码来源:migration_multi_host.py

示例4: run_subtest

    def run_subtest(sub_type):
        """
        Run sub test. e.g. reboot / system_reset...

        :params: sub_type: Sub test.
        """
        utils_test.run_virt_sub_test(test, params, env, sub_type)
开发者ID:PyLearner,项目名称:tp-qemu,代码行数:7,代码来源:driver_in_use.py

示例5: run_video

 def run_video():
     """
     Run video in background
     """
     while True:
         utils_test.run_virt_sub_test(test, params, env,
                                      params.get("video_test"))
开发者ID:EIChaoYang,项目名称:tp-qemu,代码行数:7,代码来源:balloon_stress.py

示例6: run_balloon_sub_test

    def run_balloon_sub_test(self, test, params, env, test_tag):
        """
        Run subtest after ballooned memory. Set up the related parameters
        according to the subtest.

        :param test: QEMU test object
        :type test: object
        :param params: Dictionary with the test parameters
        :type param: dict
        :param env: Dictionary with test environment.
        :type env: dict
        :return: if qemu-kvm process quit after test. There are three status
                 for this variable. -1 means the process will not quit. 0
                 means the process will quit but already restart in sub test.
                 1 means the process quit after sub test.
        :rtype: int
        """
        utils_test.run_virt_sub_test(test, params, env,
                                     sub_type=test_tag)
        qemu_quit_after_test = -1
        if "shutdown" in test_tag:
            logging.info("Guest shutdown normally after balloon")
            qemu_quit_after_test = 1
        if params.get("session_need_update", "no") == "yes":
            timeout = int(self.params.get("login_timeout", 360))
            self.session = self.vm.wait_for_login(timeout=timeout)
        if params.get("qemu_quit_after_sub_case", "no") == "yes":
            self.current_mmem = self.ori_mem
            self.current_gmem = self.ori_gmem
            qemu_quit_after_test = 0
        return qemu_quit_after_test
开发者ID:Antique,项目名称:virt-test,代码行数:31,代码来源:balloon_check.py

示例7: run

def run(test, params, env):
    """
    Run Iometer for Windows on a Windows guest:

    1) Boot guest with additional disk
    2) Format the additional disk
    3) Install and register Iometer
    4) Perpare icf to Iometer.exe
    5) Run Iometer.exe with icf
    6) Copy result to host

    :param test: kvm test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment.
    """
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    timeout = int(params.get("login_timeout", 360))
    session = vm.wait_for_login(timeout=timeout)

    # format the target disk
    utils_test.run_virt_sub_test(test, params, env, "format_disk")

    error_context.context("Install Iometer", logging.info)
    cmd_timeout = int(params.get("cmd_timeout", 360))
    ins_cmd = params["install_cmd"]
    vol_utils = utils_misc.get_winutils_vol(session)
    if not vol_utils:
        raise exceptions.TestError("WIN_UTILS CDROM not found")
    ins_cmd = re.sub("WIN_UTILS", vol_utils, ins_cmd)
    session.cmd(cmd=ins_cmd, timeout=cmd_timeout)
    time.sleep(0.5)

    error_context.context("Register Iometer", logging.info)
    reg_cmd = params["register_cmd"]
    reg_cmd = re.sub("WIN_UTILS", vol_utils, reg_cmd)
    session.cmd_output(cmd=reg_cmd, timeout=cmd_timeout)

    error_context.context("Prepare icf for Iometer", logging.info)
    icf_name = params["icf_name"]
    ins_path = params["install_path"]
    res_file = params["result_file"]
    icf_file = os.path.join(data_dir.get_deps_dir(), "iometer", icf_name)
    vm.copy_files_to(icf_file, "%s\\%s" % (ins_path, icf_name))

    # Run Iometer
    error_context.context("Start Iometer", logging.info)
    session.cmd("cd %s" % ins_path)
    logging.info("Change dir to: %s" % ins_path)
    run_cmd = params["run_cmd"]
    run_timeout = int(params.get("run_timeout", 1000))
    logging.info("Set Timeout: %ss" % run_timeout)
    run_cmd = run_cmd % (icf_name, res_file)
    logging.info("Execute Command: %s" % run_cmd)
    s, o = session.cmd_status_output(cmd=run_cmd, timeout=run_timeout)
    error_context.context("Copy result '%s' to host" % res_file, logging.info)
    vm.copy_files_from(res_file, test.resultsdir)

    if s != 0:
        raise exceptions.TestFail("iometer test failed. {}".format(o))
开发者ID:EIChaoYang,项目名称:tp-qemu,代码行数:60,代码来源:iometer_windows.py

示例8: run

def run(test, params, env):
    """
    Test hotplug/unplug of rng device
    1) Boot up w/o rng device
    2) Hotplug one or more rng devices
    3) Run random read test after hotplug
    4) Unplug rng devices
    5) Repeat step 2 ~ step4 (option)


    :param test: QEMU test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment
    """

    login_timeout = int(params.get("login_timeout", 360))
    repeat_times = int(params.get("repeat_times", 1))
    rng_num = int(params.get("rng_num", 1))
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    vm.wait_for_login(timeout=login_timeout)

    for i in xrange(repeat_times):
        dev_list = []
        logging.info("Hotplug/unplug rng devices the %sth times", (i+1))

        for num in xrange(rng_num):
            vm.devices.set_dirty()
            new_dev = qdevices.QDevice("virtio-rng-pci",
                                       {'id': 'virtio-rng-pci-%d' % num})
            dev_list.append(new_dev)
            error_context.context("Hotplug %s" % new_dev, logging.info)
            output = new_dev.hotplug(vm.monitor)
            time.sleep(2)

            error_context.context("Check %sfrom qtree after hotplug" % new_dev,
                                  logging.info)
            qtree_output = new_dev.verify_hotplug(output, vm.monitor)
            if not qtree_output:
                msg = "no % device in qtree after hotplug"
                msg += "the %sth time" % (new_dev, i)
                raise exceptions.TestFail(msg)
            logging.info("virtio-rng-pci-%d is hotpluged successfully" % num)
        sub_test = params.get("sub_test_after_hotplug")
        if sub_test:
            utils_test.run_virt_sub_test(test, params, env, sub_test)

        for dev in dev_list:
            error_context.context("Unplug %s" % dev, logging.info)
            output = dev.unplug(vm.monitor)
            time.sleep(2)

            error_context.context("Check rng device from qtree after unplug",
                                  logging.info)
            qtree_output = dev.verify_unplug(output, vm.monitor)
            if not qtree_output:
                msg = "Still get %s in qtree after unplug %s times" % (dev, i)
                raise exceptions.TestFail(msg)
            logging.info("%s is unpluged successfully" % dev)
开发者ID:PyLearner,项目名称:tp-qemu,代码行数:59,代码来源:rng_hotplug.py

示例9: run_block_stream_with_stress

def run_block_stream_with_stress(test, params, env):
    """
    block_stream_with_stress test:
    1). boot guest
    2). make guest under heavyload status
    3). create live snpshot file and start block stream job
    4). wait for it done correctly

    @param test: Kvm test object
    @param params: Dictionary with the test parameters
    @param env: Dictionary with test environment.
    """
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    timeout = int(params.get("login_timeout", 360))
    session = vm.wait_for_login(timeout=timeout)
    image_filename = storage.get_image_filename(params, data_dir.get_data_dir())
    device_id = vm.get_block({"file": image_filename})
    snapshot_file = os.path.splitext(image_filename)[0] + "-snp"
    sub_test = params.get("pre_test")
    start_cmd = params.get("start_cmd")

    def is_job_done():
        """
        Query block job status to check is job finished
        """
        job = vm.monitor.query_block_job(device_id)
        if job:
            processed = float(job["offset"]) / job["len"] * 100
            logging.debug("%s, rocessed: %.2f" % (job["type"], processed))
            return False
        logging.info("block stream job done")
        return True

    try:
        utils_test.run_virt_sub_test(test, params, env, sub_type=sub_test)
        error.context("Heavy load in guest ...", logging.info)
        if start_cmd.startswith("stress"):
            cpu = int(params.get("smp", 1))
            mem = int(params.get("mem", 1024))
            start_cmd = start_cmd.format(cpu=cpu,
                                         vm=cpu * 2,
                                         mem=(mem - 512) / cpu)
        session.sendline(start_cmd)
        error.context("Creating live snapshot", logging.info)
        if vm.monitor.live_snapshot(device_id, snapshot_file):
            raise error.TestFail("Fail to create live snapshot")
        error.context("Start block device stream job", logging.info)
        if vm.monitor.block_stream(device_id):
            raise error.TestFail("Fail to start block stream job")
        if not utils_misc.wait_for(is_job_done,
                               timeout=int(params.get("job_timeout", 2400)),
                               text="wait job done, it will take long time"):
            raise error.TestFail("Wait job finish timeout")
    finally:
        if session:
            session.close()
        if os.path.isfile(snapshot_file):
            os.remove(snapshot_file)
开发者ID:FengYang,项目名称:virt-test,代码行数:59,代码来源:block_stream_with_stress.py

示例10: run_post_sub_test

 def run_post_sub_test(self):
     # is destination host
     if not self.is_src:
         if self.post_sub_test:
             error.context("Run sub test '%s' after migration on dst"
                           % self.post_sub_test, logging.info)
             utils_test.run_virt_sub_test(test, params, env,
                                          self.post_sub_test)
开发者ID:CongLi,项目名称:tp-qemu,代码行数:8,代码来源:migration_multi_host.py

示例11: run

def run(test, params, env):
    """
    [pci-bridge]Check stress when 31 block devices attached to 1 pci-bridge, this case will:
    1) Attach one pci-bridge to guest.
    2) Create 31 disks to this pci-bridge.
    3) Start the guest.
    4) Check 'info block'.
    5) Read and write data on disks under pci bridge.

    :param test: QEMU test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment.
    """

    error_context.context("Modify params!", logging.info)
    image_parent_bus = params.get("image_parent_bus")
    image_num = int(params.get("image_num", 0))
    if image_num != 0:
        for index in xrange(image_num):
            image = "stg%s" % index
            params["images"] = ' '.join([params["images"], image])
            params["disk_pci_bus_%s" % image] = image_parent_bus
            params["image_name_%s" % image] = "images/%s" % image
            params["image_size_%s" % image] = "100M"
            params["force_create_image_%s" % image] = "yes"
            params["remove_image_%s" % image] = "yes"
            params["blk_extra_params_%s" % image] = "serial=TARGET_DISK%s" % index

    env_process.process_images(env_process.preprocess_image, test, params)
    env_process.preprocess_vm(test, params, env, params["main_vm"])

    error_context.context("Get the main VM!", logging.info)
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()

    login_timeout = int(params.get("login_timeout", 360))
    session = vm.wait_for_login(timeout=login_timeout)

    error_context.context("Check 'info block'!", logging.info)
    monitor_info_block = vm.monitor.info_block(False)
    if image_num + 1 != len(monitor_info_block.keys()):
        raise error.TestFail("Check 'info block' failed!")
    logging.info("Check 'info block' succeed!")

    error_context.context("Read and write data on all disks!", logging.info)
    sub_test_type = params.get("sub_test_type", "dd_test")
    images = params["images"]
    images = images.split()
    images.pop(0)
    for image in images:
        if params.get("dd_if") == "ZERO":
            params["dd_of"] = image
        else:
            params["dd_if"] = image
        utils_test.run_virt_sub_test(test, params, env, sub_test_type)

    logging.info("Read and write data on all disks succeed!")
    session.close()
开发者ID:EIChaoYang,项目名称:tp-qemu,代码行数:58,代码来源:pci_bridge_block_stress.py

示例12: run_migration_multi_host

def run_migration_multi_host(test, params, env):
    """
    KVM multi-host migration test:

    Migration execution progress is described in documentation
    for migrate method in class MultihostMigration.
    steps:
        1) try log to VM if login_before_pre_tests == yes
        2) before migration start pre_sub_test
        3) migration
        4) after migration start post_sub_test

    :param test: kvm test object.
    :param params: Dictionary with test parameters.
    :param env: Dictionary with the test environment.
    """
    login_timeout = int(params.get("login_timeout", 360))
    pre_sub_test = params.get("pre_sub_test")
    post_sub_test = params.get("post_sub_test")
    pre_sub_test_timeout = int(params.get("pre_sub_test_timeout", "240"))
    login_before_pre_tests = params.get("login_before_pre_tests", "no")

    mig_protocol = params.get("mig_protocol", "tcp")
    mig_type = utils_test.qemu.MultihostMigration
    if mig_protocol == "fd":
        mig_type = utils_test.qemu.MultihostMigrationFd
    if mig_protocol == "exec":
        mig_type = utils_test.qemu.MultihostMigrationExec

    vms = params.get("vms").split(" ")
    srchost = params["hosts"][0]
    dsthost = params["hosts"][1]
    is_src = params["hostid"] == srchost

    if is_src:  # is destination
        if pre_sub_test:
            if login_before_pre_tests == "yes":
                vm = env.get_vm(vms[0])
                vm.wait_for_login(timeout=login_timeout)
            error.context("Run sub test '%s' before migration on src"
                          % pre_sub_test, logging.info)
            utils_test.run_virt_sub_test(test, params, env, pre_sub_test)

    if params.get("check_vm_before_migration", "yes") == "no":
        params['check_vm_needs_restart'] = "no"

    mig = mig_type(test, params, env, False)
    mig._hosts_barrier([srchost, dsthost],
                       {'src': srchost, 'dst': dsthost, "vms": vms[0]},
                       "sync", pre_sub_test_timeout)
    mig.migrate_wait([vms[0]], srchost, dsthost)

    if not is_src:  # is destination
        if post_sub_test:
            error.context("Run sub test '%s' after migration on dst"
                          % post_sub_test, logging.info)
            utils_test.run_virt_sub_test(test, params, env, post_sub_test)
开发者ID:Antique,项目名称:virt-test,代码行数:57,代码来源:migration_multi_host.py

示例13: run_subtest

    def run_subtest(sub_type):
        """
        Run sub test which include main test and background test.
        main test: e.g. reboot/shutdown/migration/stop/cont ...
        background test: e.g. rng_bat/balloon_test/netperf ...

        :params: sub_type: Sub test.
        """
        utils_test.run_virt_sub_test(test, params, env, sub_type)
开发者ID:Zhengtong,项目名称:tp-qemu,代码行数:9,代码来源:driver_in_use.py

示例14: run_sub_test

 def run_sub_test(self):
     if self.params.get("sub_type"):
         step = ("Run sub test '%s' %s %s memory device" %
                 (self.params["sub_test"],
                  self.params["stage"],
                  self.params["operation"]))
         step_engine.context(step, logging.info)
         args = (self.test, self.params, self.env, self.params["sub_type"])
         run_virt_sub_test(*args)
开发者ID:MiriamDeng,项目名称:tp-qemu,代码行数:9,代码来源:hotplug_mem.py

示例15: run_sub_test

 def run_sub_test(self):
     """ Run virt sub test before/after hotplug/unplug memory device"""
     if self.params.get("sub_type"):
         step = ("Run sub test '%s' %s %s memory device" %
                 (self.params["sub_test"],
                  self.params["stage"],
                  self.params["operation"]))
         error_context.context(step, logging.info)
         args = (self.test, self.params, self.env, self.params["sub_type"])
         run_virt_sub_test(*args)
开发者ID:yanan-fu,项目名称:tp-qemu,代码行数:10,代码来源:hotplug_mem.py


注:本文中的virttest.utils_test.run_virt_sub_test函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。