• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python virsh.start函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: vm_recover_check

    def vm_recover_check(guest_name, option):
        """
        Check if the vm can be recovered correctly.

        :param guest_name : Checked vm's name.
        :param option : managedsave command option.
        """
        # This time vm not be shut down
        if vm.is_alive():
            raise error.TestFail("Guest should be inactive")
        virsh.start(guest_name)
        # This time vm should be in the list
        if vm.is_dead():
            raise error.TestFail("Guest should be active")
        if option:
            if option.count("running"):
                if vm.is_dead() or vm.is_paused():
                    raise error.TestFail("Guest state should be"
                                         " running after started"
                                         " because of '--running' option")
            elif option.count("paused"):
                if not vm.is_paused():
                    raise error.TestFail("Guest state should be"
                                         " paused after started"
                                         " because of '--paused' option")
        else:
            if params.get("paused_after_start_vm") == "yes":
                if not vm.is_paused():
                    raise error.TestFail("Guest state should be"
                                         " paused after started"
                                         " because of initia guest state")
开发者ID:Acidburn0zzz,项目名称:tp-libvirt,代码行数:31,代码来源:virsh_managedsave.py


示例2: vm_recover_check

    def vm_recover_check(guest_name, option, libvirtd, check_shutdown=False):
        """
        Check if the vm can be recovered correctly.

        :param guest_name : Checked vm's name.
        :param option : managedsave command option.
        """
        # This time vm not be shut down
        if vm.is_alive():
            raise error.TestFail("Guest should be inactive")
        # Check vm managed save state.
        ret = virsh.dom_list("--managed-save --inactive")
        vm_state1 = re.findall(r".*%s.*" % guest_name,
                               ret.stdout.strip())[0].split()[2]
        ret = virsh.dom_list("--managed-save --all")
        vm_state2 = re.findall(r".*%s.*" % guest_name,
                               ret.stdout.strip())[0].split()[2]
        if vm_state1 != "saved" or vm_state2 != "saved":
            raise error.TestFail("Guest state should be saved")

        virsh.start(guest_name)
        # This time vm should be in the list
        if vm.is_dead():
            raise error.TestFail("Guest should be active")
        # Restart libvirtd and check vm status again.
        libvirtd.restart()
        if vm.is_dead():
            raise error.TestFail("Guest should be active after"
                                 " restarting libvirtd")
        # Check managed save file:
        if os.path.exists(managed_save_file):
            raise error.TestFail("Managed save image exist "
                                 "after starting the domain")
        if option:
            if option.count("running"):
                if vm.is_dead() or vm.is_paused():
                    raise error.TestFail("Guest state should be"
                                         " running after started"
                                         " because of '--running' option")
            elif option.count("paused"):
                if not vm.is_paused():
                    raise error.TestFail("Guest state should be"
                                         " paused after started"
                                         " because of '--paused' option")
        else:
            if params.get("paused_after_start_vm") == "yes":
                if not vm.is_paused():
                    raise error.TestFail("Guest state should be"
                                         " paused after started"
                                         " because of initia guest state")
        if check_shutdown:
            # Resume the domain.
            if vm.is_paused():
                vm.resume()
            vm.wait_for_login()
            # Shutdown and start the domain, it should be in runing state and can be login.
            vm.shutdown()
            vm.wait_for_shutdown()
            vm.start()
            vm.wait_for_login()
开发者ID:PandaWei,项目名称:tp-libvirt,代码行数:60,代码来源:virsh_managedsave.py


示例3: check_result

 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if skip_check:
         logging.info('Skip checking vm after conversion')
     elif not status_error:
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 test.fail('Import VM failed')
         if output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception, e:
                 test.fail('Start vm failed: %s' % str(e))
         # Check guest following the checkpoint document after convertion
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         if params.get('skip_vm_check') != 'yes':
             if checkpoint != 'win2008r2_ostk':
                 ret = vmchecker.run()
                 if len(ret) == 0:
                     logging.info("All common checkpoints passed")
             if checkpoint == 'win2008r2_ostk':
                 check_BSOD()
             # Merge 2 error lists
             error_list.extend(vmchecker.errors)
开发者ID:lento-sun,项目名称:tp-libvirt,代码行数:30,代码来源:convert_from_file.py


示例4: check_numatune_xml

def check_numatune_xml(params):
    """
    Compare mode and nodeset value with guest XML configuration
    :params: the parameter dictionary
    """
    # vm_name = params.get("vms")
    vm_name = params.get("main_vm")
    mode = params.get("numa_mode", "")
    nodeset = params.get("numa_nodeset", "")
    options = params.get("options", "")
    # --config option will act after vm shutdown.
    if options == "config":
        virsh.shutdown(vm_name)
    # The verification of the numa params should
    # be done when vm is running.
    if not virsh.is_alive(vm_name):
        virsh.start(vm_name)

    try:
        numa_params = libvirt_xml.VMXML.get_numa_memory_params(vm_name)
    # VM XML omit numa entry when the placement is auto and mode is strict
    # So we need to set numa_params manually when exception happens.
    except LibvirtXMLAccessorError:
        numa_params = {"placement": "auto", "mode": "strict"}

    if not numa_params:
        logging.error("Could not get numa parameters for %s", vm_name)
        return False

    mode_from_xml = numa_params["mode"]
    # if the placement is auto, there is no nodeset in numa param.
    try:
        nodeset_from_xml = numa_params["nodeset"]
    except KeyError:
        nodeset_from_xml = ""

    if mode and mode != mode_from_xml:
        logging.error("To expect %s: %s", mode, mode_from_xml)
        return False

    # The actual nodeset value is different with guest XML configuration,
    # so need to compare them via a middle result, for example, if you
    # set nodeset is '0,1,2' then it will be a list '0-2' in guest XML
    nodeset = cpus_parser(nodeset)
    nodeset_from_xml = cpus_parser(nodeset_from_xml)

    if nodeset and nodeset != nodeset_from_xml:
        logging.error("To expect %s: %s", nodeset, nodeset_from_xml)
        return False

    return True
开发者ID:uni-peter-zheng,项目名称:tp-libvirt,代码行数:51,代码来源:virsh_numatune.py


示例5: attach_interface

    def attach_interface():
        """
            Attach interface:

            1.Attach interface from xml;
            2.Check the vf driver after attach interface;
            3.Check the live xml after attach interface;
        """
        if managed == "no":
            result = virsh.nodedev_detach(nodedev_pci_addr)
            utils_test.libvirt.check_exit_status(result, expect_error=False)
        logging.debug("attach interface xml:\n %s", new_iface)
        result = virsh.attach_device(vm_name, file_opt=new_iface.xml, flagstr=option, debug=True)
        utils_test.libvirt.check_exit_status(result, expect_error=False)
        if option == "--config":
            result = virsh.start(vm_name)
            utils_test.libvirt.check_exit_status(result, expect_error=False)
        # For option == "--persistent", after VM destroyed and then start, the device should still be there.
        if option == "--persistent":
            virsh.destroy(vm_name)
            result = virsh.start(vm_name, debug=True)
            utils_test.libvirt.check_exit_status(result, expect_error=False)
        live_xml = vm_xml.VMXML.new_from_dumpxml(vm_name)
        logging.debug(live_xml)
        get_ip_by_mac(mac_addr, timeout=60)
        device = live_xml.devices
        if vf_type == "vf" or vf_type == "vf_pool":
            for interface in device.by_device_tag("interface"):
                if interface.type_name == "hostdev":
                    if interface.driver.driver_attr['name'] != 'vfio':
                        test.fail("The driver of the hostdev interface is not vfio\n")
                    break
            vf_addr_attrs = interface.hostdev_address.attrs
            pci_addr = addr_to_pci(vf_addr_attrs)
            nic_driver = os.readlink(os.path.join(pci_device_dir, vf_addr, "driver")).split('/')[-1]
            if nic_driver != "vfio-pci":
                test.fail("The driver of the hostdev interface is not vfio\n")
        elif vf_type == "macvtap" or vf_type == "macvtap_network":
            for interface in device.by_device_tag("interface"):
                if interface.type_name == "direct":
                    if vf_type == "macvtap":
                        if interface.source["dev"] == new_iface.source["dev"]:
                            match = "yes"
                            vf_name = interface.source["dev"]
                    elif interface.source['dev'] in vf_name_list:
                        match = "yes"
                        vf_name = interface.source["dev"]
                if match != "yes":
                    test.fail("The dev name or mode of macvtap interface is wrong after attach\n")
        return interface
开发者ID:balamuruhans,项目名称:tp-libvirt,代码行数:50,代码来源:sriov.py


示例6: vm_msave_remove_check

 def vm_msave_remove_check(vm_name):
     """
     Check managed save remove command.
     """
     if not os.path.exists(managed_save_file):
         raise error.TestFail("Can't find managed save image")
     virsh.managedsave_remove(vm_name)
     if os.path.exists(managed_save_file):
         raise error.TestFail("Managed save image still exists")
     virsh.start(vm_name)
     # The domain state should be running
     if vm.state() != "running":
         raise error.TestFail("Guest state should be"
                              " running after started")
开发者ID:CongLi,项目名称:tp-libvirt,代码行数:14,代码来源:virsh_managedsave.py


示例7: check_multi_guests

    def check_multi_guests(guests, start_delay, libvirt_guests):
        """
        Check start_delay option for multiple guests.
        """
        # Destroy vm first
        if vm.is_alive():
            vm.destroy(gracefully=False)
        # Clone given number of guests
        timeout = params.get("clone_timeout", 360)
        for i in range(int(guests)):
            dst_vm = "%s_%s" % (vm_name, i)
            utils_libguestfs.virt_clone_cmd(vm_name, dst_vm,
                                            True, timeout=timeout)
            virsh.start(dst_vm, debug=True)

        # Wait 10 seconds for vm to start
        time.sleep(10)
        is_systemd = process.run("cat /proc/1/comm", shell=True).stdout.count("systemd")
        if is_systemd:
            libvirt_guests.restart()
            pattern = r'(.+ \d\d:\d\d:\d\d).+: Resuming guest.+done'
        else:
            ret = process.run("service libvirt-guests restart | \
                              awk '{ print strftime(\"%b %y %H:%M:%S\"), \
                              $0; fflush(); }'", shell=True)
            pattern = r'(.+ \d\d:\d\d:\d\d)+ Resuming guest.+done'

        # libvirt-guests status command read messages from systemd
        # journal, in cases of messages are not ready in time,
        # add a time wait here.
        def wait_func():
            return libvirt_guests.raw_status().stdout.count("Resuming guest")

        utils_misc.wait_for(wait_func, 5)
        if is_systemd:
            ret = libvirt_guests.raw_status()
        logging.info("status output: %s", ret.stdout)
        resume_time = re.findall(pattern, ret.stdout, re.M)
        if not resume_time:
            test.fail("Can't see messages of resuming guest")

        # Convert time string to int
        resume_seconds = [time.mktime(time.strptime(
            tm, "%b %y %H:%M:%S")) for tm in resume_time]
        logging.info("Resume time in seconds: %s", resume_seconds)
        # Check if start_delay take effect
        for i in range(len(resume_seconds)-1):
            if resume_seconds[i+1] - resume_seconds[i] < int(start_delay):
                test.fail("Checking start_delay failed")
开发者ID:lento-sun,项目名称:tp-libvirt,代码行数:49,代码来源:virsh_managedsave.py


示例8: restore

    def restore(self, name):
        dom = name
        name = dom['name']
        doms = self.current_state
        if name in doms:
            self.remove(doms[name])

        domfile = tempfile.NamedTemporaryFile(delete=False)
        fname = domfile.name
        domfile.writelines(dom['inactive xml'])
        domfile.close()

        try:
            if dom['persistent'] == 'yes':
                res = virsh.define(fname)
                if res.exit_status:
                    raise Exception(str(res))
                if dom['state'] != 'shut off':
                    res = virsh.start(name)
                    if res.exit_status:
                        raise Exception(str(res))
            else:
                res = virsh.create(fname)
                if res.exit_status:
                    raise Exception(str(res))
        finally:
            os.remove(fname)

        if dom['autostart'] == 'enable':
            res = virsh.autostart(name, '')
            if res.exit_status:
                raise Exception(str(res))
开发者ID:cheneydc,项目名称:virt-test-ci,代码行数:32,代码来源:ci.py


示例9: vm_managedsave_loop

 def vm_managedsave_loop(vm_name, loop_range, libvirtd):
     """
     Run a loop of managedsave command and check its result.
     """
     if vm.is_dead():
         virsh.start(vm_name)
     for i in range(int(loop_range)):
         logging.debug("Test loop: %s" % i)
         virsh.managedsave(vm_name)
         virsh.start(vm_name)
     # Check libvirtd status.
     if not libvirtd.is_running():
         raise error.TestFail("libvirtd is stopped after cmd")
     # Check vm status.
     if vm.state() != "running":
         raise error.TestFail("Guest isn't in running state")
开发者ID:CongLi,项目名称:tp-libvirt,代码行数:16,代码来源:virsh_managedsave.py


示例10: edit_iface

    def edit_iface(vm_name):
        """
        Modify vm's interface information by virsh edit command.
        """
        iface_type = params.get("iface_type")
        iface_model = params.get("iface_model")
        edit_error = "yes" == params.get("edit_error", "no")
        if iface_type:
            edit_cmd = (r":%s /<interface type=.*>/<interface type='{0}'>/"
                        "".format(iface_type))
            status = libvirt.exec_virsh_edit(vm_name, [edit_cmd])
        elif iface_model:
            edit_cmd = (r":/<interface/,/<\/interface>/s/<model type=.*\/>/"
                        "<model type='%s'\/>/" % iface_model)
            status = libvirt.exec_virsh_edit(vm_name, [edit_cmd])

        if not status and not edit_error:
            logging.error("Expect success, but failure")
            return False
        if edit_error and status:
            logging.error("Expect error, but success")
            return False

        # Destroy domain and start it to check if vm can be started
        start_error = "yes" == params.get("start_error", "no")
        vm.destroy()
        ret = virsh.start(vm_name, ignore_status=True)
        if start_error and not ret.exit_status:
            logging.error("Vm started unexpectedly")
            return False
        if not start_error and ret.exit_status:
            logging.error("Vm failed to start")
            return False
        return True
开发者ID:bssrikanth,项目名称:tp-libvirt,代码行数:34,代码来源:virsh_edit.py


示例11: state_test

def state_test():
    states = [ServiceState(), FileState(), DirState(), DomainState(),
              NetworkState(), PoolState(), SecretState(), MountState()]
    for state in states:
        state.backup()
    utils.run('echo hello > /etc/exports')
    virsh.start('virt-tests-vm1')
    virsh.net_autostart('default', '--disable')
    virsh.pool_destroy('mount')
    utils.run('rm /var/lib/virt_test/images/hello')
    utils.run('mkdir /var/lib/virt_test/images/hi')
    utils_libvirtd.Libvirtd().stop()
    utils_selinux.set_status('permissive')
    for state in states:
        lines = state.check(recover=True)
        for line in lines:
            print line
开发者ID:cheneydc,项目名称:virt-test-ci,代码行数:17,代码来源:ci.py


示例12: make_unclean_fs

 def make_unclean_fs():
     """
     Use force off to make unclean file system of win8
     """
     if virsh.start(vm_name, ignore_status=True).exit_status:
         raise exceptions.TestError('Start vm failed')
     time.sleep(10)
     virsh.destroy(vm_name, debug=True)
开发者ID:waynesun09,项目名称:tp-libvirt,代码行数:8,代码来源:specific_kvm.py


示例13: vm_recover_check

    def vm_recover_check(guest_name):
        """
        Check if the vm can be recovered correctly.

        @param: guest_name : Checked vm's name.
        """
        ret = virsh.dom_list()
        #This time vm should not be in the list
        if re.search(guest_name, ret.stdout):
            raise error.TestFail("virsh list output invalid")
        virsh.start(guest_name)
        if params.get("paused_after_start_vm") == "yes":
            virsh.resume(guest_name)
        #This time vm should be in the list
        ret = virsh.dom_list()
        if  not re.search(guest_name, ret.stdout):
            raise error.TestFail("virsh list output invalid")
开发者ID:bonzini,项目名称:virt-test,代码行数:17,代码来源:virsh_managedsave.py


示例14: check_multi_guests

    def check_multi_guests(guests, start_delay, libvirt_guests):
        """
        Check start_delay option for multiple guests.
        """
        # Destroy vm first
        if vm.is_alive():
            vm.destroy(gracefully=False)
        # Clone given number of guests
        timeout = params.get("clone_timeout", 360)
        for i in range(int(guests)):
            dst_vm = "%s_%s" % (vm_name, i)
            utils_libguestfs.virt_clone_cmd(vm_name, dst_vm,
                                            True, timeout=timeout)
            virsh.start(dst_vm)

        # Wait 10 seconds for vm to start
        time.sleep(10)
        libvirt_guests.restart()

        # libvirt-guests status command read messages from systemd
        # journal, in cases of messages are not ready in time,
        # add a time wait here.

        def wait_func():
            return not utils.run("service libvirt-guests status"
                                 " | grep 'Resuming guest'",
                                 ignore_status=True).exit_status

        utils_misc.wait_for(wait_func, 5)
        ret = utils.run("service libvirt-guests status",
                        ignore_status=True)
        logging.info("status output: %s", ret.stdout)
        pattern = r'(.+ \d\d:\d\d:\d\d).+: Resuming guest.+done'
        resume_time = re.findall(pattern, ret.stdout, re.M)
        if not resume_time:
            raise error.TestFail("Can't see messages of resuming guest")

        # Convert time string to int
        resume_seconds = [time.mktime(time.strptime(
            tm, "%b %y %H:%M:%S")) for tm in resume_time]
        logging.info("Resume time in seconds: %s", resume_seconds)
        # Check if start_delay take effect
        for i in range(len(resume_seconds)-1):
            if resume_seconds[i+1] - resume_seconds[i] < int(start_delay):
                raise error.TestFail("Checking start_delay failed")
开发者ID:Chenditang,项目名称:tp-libvirt,代码行数:45,代码来源:virsh_managedsave.py


示例15: check_result

 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if checkpoint == 'empty_cdrom':
         if status_error:
             log_fail('Virsh dumpxml failed for empty cdrom image')
     elif not status_error:
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 test.fail('Import VM failed')
         elif output_mode == 'libvirt':
             virsh.start(vm_name, debug=True)
         # Check guest following the checkpoint document after convertion
         logging.info('Checking common checkpoints for v2v')
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         if checkpoint not in ['GPO_AV', 'ovmf']:
             ret = vmchecker.run()
             if len(ret) == 0:
                 logging.info("All common checkpoints passed")
         # Check specific checkpoints
         if checkpoint == 'cdrom':
             virsh_session = utils_sasl.VirshSessionSASL(params)
             virsh_session_id = virsh_session.get_id()
             check_device_exist('cdrom', virsh_session_id)
         if checkpoint.startswith('vmtools'):
             check_vmtools(vmchecker.checker, checkpoint)
         if checkpoint == 'modprobe':
             check_modprobe(vmchecker.checker)
         if checkpoint == 'device_map':
             check_device_map(vmchecker.checker)
         if checkpoint == 'resume_swap':
             check_resume_swap(vmchecker.checker)
         # Merge 2 error lists
         error_list.extend(vmchecker.errors)
     log_check = utils_v2v.check_log(params, output)
     if log_check:
         log_fail(log_check)
     if len(error_list):
         test.fail('%d checkpoints failed: %s' %
                   (len(error_list), error_list))
开发者ID:nasastry,项目名称:tp-libvirt,代码行数:45,代码来源:function_test_esx.py


示例16: check_numatune_xml

def check_numatune_xml(params):
    """
    Compare mode and nodeset value with guest XML configuration
    @params: the parameter dictionary
    """
    vm_name = params.get("vms")
    mode = params.get("numa_mode", "")
    nodeset = params.get("numa_nodeset", "")
    options = params.get("options", "")
    #--config option will act after vm shutdown.
    if options == "config":
        virsh.shutdown(vm_name)
    #The verification of the numa params should
    #be done when vm is running.
    if not virsh.is_alive(vm_name):
        virsh.start(vm_name)

    numa_params = libvirt_xml.VMXML.get_numa_params(vm_name)
    if not numa_params:
        logging.error("Could not get numa parameters for %s", vm_name)
        return False

    mode_from_xml = numa_params['mode']
    #if the placement is auto, there is no nodeset in numa param.
    try:
        nodeset_from_xml = numa_params['nodeset']
    except KeyError():
        nodeset_from_xml = ""

    if mode and mode != mode_from_xml:
        logging.error("To expect %s: %s", mode, mode_from_xml)
        return False

    # The actual nodeset value is different with guest XML configuration,
    # so need to compare them via a middle result, for example, if you
    # set nodeset is '0,1,2' then it will be a list '0-2' in guest XML
    nodeset = nodeset_parser(nodeset)
    nodeset_from_xml = nodeset_parser(nodeset_from_xml)

    if nodeset and nodeset != nodeset_from_xml:
        logging.error("To expect %s: %s", nodeset, nodeset_from_xml)
        return False

    return True
开发者ID:FengYang,项目名称:virt-test,代码行数:44,代码来源:virsh_numatune.py


示例17: check_result

 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if not status_error and checkpoint != 'vdsm':
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 test.fail('Import VM failed')
         elif output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception, e:
                 test.fail('Start vm failed: %s', str(e))
         # Check guest following the checkpoint document after convertion
         logging.info('Checking common checkpoints for v2v')
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         ret = vmchecker.run()
         if len(ret) == 0:
             logging.info("All common checkpoints passed")
         # Check specific checkpoints
         if checkpoint == 'rhev_file':
             check_rhev_file_exist(vmchecker.checker)
         if checkpoint == 'console_xvc0':
             check_grub_file(vmchecker.checker, 'console_xvc0')
         if checkpoint in ('vnc_autoport', 'vnc_encrypt'):
             vmchecker.check_graphics(params[checkpoint])
         if checkpoint == 'sdl':
             if output_mode == 'libvirt':
                 vmchecker.check_graphics({'type': 'vnc'})
             elif output_mode == 'rhev':
                 vmchecker.check_graphics({'type': 'spice'})
         if checkpoint == 'pv_with_regular_kernel':
             check_kernel(vmchecker.checker)
         if checkpoint in ['sound', 'pcspk']:
             check_sound_card(vmchecker.checker, checkpoint)
         if checkpoint == 'rhsrvany_md5':
             check_rhsrvany_md5(vmchecker.checker)
         if checkpoint == 'multidisk':
             check_disk(vmchecker.checker, params['disk_count'])
开发者ID:lento-sun,项目名称:tp-libvirt,代码行数:43,代码来源:function_test_xen.py


示例18: start_and_check

 def start_and_check():
     """
     Predict the error message when starting and try to start the guest.
     """
     fail_patts = []
     if model == 'pci-bridge' and (index is None or int(index) == 0):
         fail_patts.append(r"PCI bridge index should be > 0")
     res = virsh.start(vm_name)
     libvirt.check_result(res, expected_fails=fail_patts)
     return not res.exit_status
开发者ID:Chenditang,项目名称:tp-libvirt,代码行数:10,代码来源:controller_functional.py


示例19: check_result

 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     utlv.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if status_error:
         if checkpoint in ['running', 'paused']:
             check_v2v_log(output, 'not_shutdown')
         else:
             check_v2v_log(output, checkpoint)
     else:
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 raise exceptions.TestFail('Import VM failed')
         if output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception, e:
                 raise exceptions.TestFail('Start vm failed: %s' % str(e))
         # Check guest following the checkpoint document after convertion
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         ret = vmchecker.run()
         if ret == 0:
             logging.info("All checkpoints passed")
         else:
             raise exceptions.TestFail("%s checkpoints failed" % ret)
         if checkpoint in ['multi_kernel', 'debug_kernel']:
             default_kernel = params.get('defaultkernel')
             check_boot_kernel(default_kernel, debug_kernel)
             if checkpoint == 'multi_kernel':
                 check_vmlinuz_initramfs(output)
         elif checkpoint == 'floppy':
             check_floppy_exist()
         elif checkpoint == 'multi_disks':
             check_disks()
         elif checkpoint == 'multi_netcards':
             check_multi_netcards(params['mac_address'],
                                  vmchecker.virsh_session_id)
         check_v2v_log(output, checkpoint)
开发者ID:waynesun09,项目名称:tp-libvirt,代码行数:42,代码来源:specific_kvm.py


示例20: _start_and_check

    def _start_and_check():
        """
        Predict the error message when starting and try to start the guest.
        """
        fail_patts = []

        if channel_type == 'unix' and source_path and source_mode != 'bind':
            fail_patts.append(r"No such file or directory")

        res = virsh.start(vm_name)
        libvirt.check_result(res, expected_fails=fail_patts)
        return not res.exit_status
开发者ID:bssrikanth,项目名称:tp-libvirt,代码行数:12,代码来源:channel_functional.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python virsh.undefine函数代码示例发布时间:2022-05-26
下一篇:
Python virsh.snapshot_list函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap