'Get metadata config for guest.'

def _get_guest_config_meta(self, instance):

    meta = vconfig.LibvirtConfigGuestMetaNovaInstance()
    meta.package = version.version_string_with_package()
    meta.name = instance.display_name
    meta.creationTime = time.time()
    if (instance.image_ref not in ('', None)):
        meta.roottype = 'image'
        meta.rootid = instance.image_ref
    system_meta = instance.system_metadata
    ometa = vconfig.LibvirtConfigGuestMetaNovaOwner()
    ometa.userid = instance.user_id
    ometa.username = system_meta.get('owner_user_name', 'N/A')
    ometa.projectid = instance.project_id
    ometa.projectname = system_meta.get('owner_project_name', 'N/A')
    meta.owner = ometa
    fmeta = vconfig.LibvirtConfigGuestMetaNovaFlavor()
    flavor = instance.flavor
    fmeta.name = flavor.name
    fmeta.memory = flavor.memory_mb
    fmeta.vcpus = flavor.vcpus
    fmeta.ephemeral = flavor.ephemeral_gb
    fmeta.disk = flavor.root_gb
    fmeta.swap = flavor.swap
    meta.flavor = fmeta
    return meta
