'Get config data for parameters.
:param rescue: optional dictionary that should contain the key
\'ramdisk_id\' if a ramdisk is needed for the rescue image and
\'kernel_id\' if a kernel is needed for the rescue image.'

def _get_guest_config(self, instance, network_info, image_meta, disk_info, rescue=None, block_device_info=None, context=None):

    flavor = instance.flavor
    inst_path = libvirt_utils.get_instance_path(instance)
    disk_mapping = disk_info['mapping']
    virt_type = CONF.libvirt.virt_type
    guest = vconfig.LibvirtConfigGuest()
    guest.virt_type = virt_type
    guest.name = instance.name
    guest.uuid = instance.uuid
    guest.memory = (flavor.memory_mb * units.Ki)
    guest.vcpus = flavor.vcpus
    allowed_cpus = hardware.get_vcpu_pin_set()
    guest_numa_config = self._get_guest_numa_config(instance.numa_topology, flavor, allowed_cpus, image_meta)
    guest.cpuset = guest_numa_config.cpuset
    guest.cputune = guest_numa_config.cputune
    guest.numatune = guest_numa_config.numatune
    guest.membacking = self._get_guest_memory_backing_config(instance.numa_topology, guest_numa_config.numatune, flavor)
    guest.metadata.append(self._get_guest_config_meta(instance))
    guest.idmaps = self._get_guest_idmaps()
    for event in self._supported_perf_events:
        guest.add_perf_event(event)
    self._update_guest_cputune(guest, flavor, virt_type)
    guest.cpu = self._get_guest_cpu_config(flavor, image_meta, guest_numa_config.numaconfig, instance.numa_topology)
    instance.vcpu_model = self._cpu_config_to_vcpu_model(guest.cpu, instance.vcpu_model)
    if ('root' in disk_mapping):
        root_device_name = block_device.prepend_dev(disk_mapping['root']['dev'])
    else:
        root_device_name = None
    if root_device_name:
        instance.root_device_name = root_device_name
    guest.os_type = (fields.VMMode.get_from_instance(instance) or self._get_guest_os_type(virt_type))
    caps = self._host.get_capabilities()
    self._configure_guest_by_virt_type(guest, virt_type, caps, instance, image_meta, flavor, root_device_name)
    if (virt_type not in ('lxc', 'uml')):
        self._conf_non_lxc_uml(virt_type, guest, root_device_name, rescue, instance, inst_path, image_meta, disk_info)
    self._set_features(guest, instance.os_type, caps, virt_type, image_meta)
    self._set_clock(guest, instance.os_type, image_meta, virt_type)
    storage_configs = self._get_guest_storage_config(instance, image_meta, disk_info, rescue, block_device_info, flavor, guest.os_type)
    for config in storage_configs:
        guest.add_device(config)
    for vif in network_info:
        config = self.vif_driver.get_config(instance, vif, image_meta, flavor, virt_type, self._host)
        guest.add_device(config)
    self._create_consoles(virt_type, guest, instance, flavor, image_meta)
    pointer = self._get_guest_pointer_model(guest.os_type, image_meta)
    if pointer:
        guest.add_device(pointer)
    self._guest_add_spice_channel(guest)
    if self._guest_add_video_device(guest):
        self._add_video_driver(guest, image_meta, flavor)
    if (virt_type in ('qemu', 'kvm')):
        self._set_qemu_guest_agent(guest, flavor, instance, image_meta)
    self._guest_add_pci_devices(guest, instance)
    self._guest_add_watchdog_action(guest, flavor, image_meta)
    self._guest_add_memory_balloon(guest)
    return guest
