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


Python Remote.wait方法代码示例

本文整理汇总了Python中execo.action.Remote.wait方法的典型用法代码示例。如果您正苦于以下问题:Python Remote.wait方法的具体用法?Python Remote.wait怎么用?Python Remote.wait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在execo.action.Remote的用法示例。


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

示例1: vm5k_deployment

# 需要导入模块: from execo.action import Remote [as 别名]
# 或者: from execo.action.Remote import wait [as 别名]

#.........这里部分代码省略.........
    def configure_service_node(self):
        """Setup automatically a DNS server to access virtual machines by id
        and also install a DHCP server if kavlan is used"""
        if self.kavlan:
            service = 'DNS/DHCP'
            dhcp = True
        else:
            service = 'DNS'
            dhcp = False

        service_node = get_fastest_host(self.hosts)
        logger.info('Setting up %s on %s', style.emph(service),
                    style.host(service_node.split('.')[0]))
        clients = list(self.hosts)
        clients.remove(service_node)

        dnsmasq_server(service_node, clients, self.vms, dhcp)

    def configure_libvirt(self, bridge='br0', libvirt_conf=None):
        """Enable a bridge if needed on the remote hosts, configure libvirt
        with a bridged network for the virtual machines, and restart service.
        """
        print 'Start configuring libvirt'
        self._enable_bridge()
        self._libvirt_check_service()
        self._libvirt_uniquify()
        self._libvirt_bridged_network(bridge)
        logger.info('Restarting %s', style.emph('libvirt'))
        self.fact.get_remote('service libvirtd restart', self.hosts).run()

    def deploy_vms(self, clean_disks=False, disk_location='one',
                   apt_cacher=False):
        """Destroy the existing VMS, create the virtual disks, install the vms
        start them and wait until they have rebooted"""
        logger.info('Destroying existing virtual machines')
        destroy_vms(self.hosts, undefine=True)
        if clean_disks:
            self._remove_existing_disks()
        logger.info('Creating the virtual disks ')
        self._create_backing_file()
        if disk_location == 'one':
            logger.info('Create disk on each nodes')
            create_disks(self.vms).run()
        elif disk_location == 'all':
            logger.info('Create all disks on all nodes')
            create_disks_all_hosts(self.vms, self.hosts).run()
        logger.info('Installing the virtual machines')
        install_vms(self.vms).run()
        logger.info('Starting the virtual machines')
        self.boot_time = Timer()
        start_vms(self.vms).run()
        logger.info('Waiting for VM to boot ...')
        wait_vms_have_started(self.vms, self.hosts[0])
        activate_vms(self.vms)
        self._update_vms_xml()
        if apt_cacher:
            configure_apt_proxy(self.vms)

    def get_state(self, name=None, output=True, mode='compact', plot=False):
        """ """
        if not name:
            name = 'vm5k_' + strftime('%Y%m%d_%H%M%S', localtime())
        if output:
            output = self.outdir + '/' + name + '.xml'
            f = open(output, 'w')
            f.write(prettify(self.state))
开发者ID:badock,项目名称:vm5k,代码行数:70,代码来源:deployment.py


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