def _get_guest_xml(self, context, instance, network_info, disk_info, image_meta=None, rescue=None, block_device_info=None, write_to_disk=False):
    if (image_meta is None):
        image_ref = instance['image_ref']
        image_meta = compute_utils.get_image_metadata(context, self._image_api, image_ref, instance)
    network_info_str = str(network_info)
    msg = ('Start _get_guest_xml network_info=%(network_info)s disk_info=%(disk_info)s image_meta=%(image_meta)s rescue=%(rescue)s block_device_info=%(block_device_info)s' % {'network_info': network_info_str, 'disk_info': disk_info, 'image_meta': image_meta, 'rescue': rescue, 'block_device_info': block_device_info})
    LOG.debug(logging.mask_password(msg), instance=instance)
    conf = self._get_guest_config(instance, network_info, image_meta, disk_info, rescue, block_device_info, context)
    xml = conf.to_xml()
    if write_to_disk:
        instance_dir = libvirt_utils.get_instance_path(instance)
        xml_path = os.path.join(instance_dir, 'libvirt.xml')
        libvirt_utils.write_to_file(xml_path, xml)
    LOG.debug('End _get_guest_xml xml=%(xml)s', {'xml': xml}, instance=instance)
    return xml
def _get_guest_xml(self, context, instance, network_info, disk_info, image_meta=None, rescue=None, block_device_info=None, write_to_disk=False):
    if (image_meta is None):
        image_ref = instance['image_ref']
        image_meta = compute_utils.get_image_metadata(context, self._image_api, image_ref, instance)
    network_info_str = str(network_info)
    msg = ('Start _get_guest_xml network_info=%(network_info)s disk_info=%(disk_info)s image_meta=%(image_meta)s rescue=%(rescue)s block_device_info=%(block_device_info)s' % {'network_info': network_info_str, 'disk_info': disk_info, 'image_meta': image_meta, 'rescue': rescue, 'block_device_info': block_device_info})
    LOG.debug(logging.mask_password(msg), instance=instance)
    conf = self._get_guest_config(instance, network_info, image_meta, disk_info, rescue, block_device_info, context)
    xml = conf.to_xml()
    if write_to_disk:
        instance_dir = libvirt_utils.get_instance_path(instance)
        xml_path = os.path.join(instance_dir, 'libvirt.xml')
        libvirt_utils.write_to_file(xml_path, xml)
    LOG.debug('End _get_guest_xml xml=%(xml)s', {'xml': xml}, instance=instance)
    return xml