def spawn(self, context, instance, image_meta, injected_files, admin_password, network_info=None, block_device_info=None):
    disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type, instance, block_device_info, image_meta)
    self._create_image(context, instance, disk_info['mapping'], network_info=network_info, block_device_info=block_device_info, files=injected_files, admin_pass=admin_password)
    xml = self._get_guest_xml(context, instance, network_info, disk_info, image_meta, block_device_info=block_device_info, write_to_disk=True)
    self._create_domain_and_network(context, xml, instance, network_info, block_device_info)
    LOG.debug('Instance is running', instance=instance)

    def _wait_for_boot():
        'Called at an interval until the VM is running.'
        state = self.get_info(instance)['state']
        if (state == power_state.RUNNING):
            LOG.info(_LI('Instance spawned successfully.'), instance=instance)
            raise loopingcall.LoopingCallDone()
    timer = loopingcall.FixedIntervalLoopingCall(_wait_for_boot)
    timer.start(interval=0.5).wait()
def spawn(self, context, instance, image_meta, injected_files, admin_password, network_info=None, block_device_info=None):
    disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type, instance, block_device_info, image_meta)
    self._create_image(context, instance, disk_info['mapping'], network_info=network_info, block_device_info=block_device_info, files=injected_files, admin_pass=admin_password)
    xml = self._get_guest_xml(context, instance, network_info, disk_info, image_meta, block_device_info=block_device_info, write_to_disk=True)
    self._create_domain_and_network(context, xml, instance, network_info, block_device_info)
    LOG.debug('Instance is running', instance=instance)

    def _wait_for_boot():
        'Called at an interval until the VM is running.'
        state = self.get_info(instance)['state']
        if (state == power_state.RUNNING):
            LOG.info(_LI('Instance spawned successfully.'), instance=instance)
            raise loopingcall.LoopingCallDone()
    timer = loopingcall.FixedIntervalLoopingCall(_wait_for_boot)
    timer.start(interval=0.5).wait()