本文整理匯總了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))