def _instance_to_allocations_dict(instance):
 is_bfv = compute_utils.is_volume_backed_instance(instance._context, instance)
 disk = (((0 if is_bfv else instance.flavor.root_gb) + instance.flavor.swap) + instance.flavor.ephemeral_gb)
 alloc_dict = {MEMORY_MB: instance.flavor.memory_mb, VCPU: instance.flavor.vcpus, DISK_GB: disk}
 return {key: val for (key, val) in alloc_dict.items() if val}

def _instance_to_allocations_dict ( instance ) : is_bfv = compute_utils . is_volume_backed_instance ( instance . _context , instance ) disk = ( ( ( 0 if is_bfv else instance . flavor . root_gb ) + instance . flavor . swap ) + instance . flavor . ephemeral_gb ) alloc_dict = { MEMORY_MB : instance . flavor . memory_mb , VCPU : instance . flavor . vcpus , DISK_GB : disk } return { key : val for ( key , val ) in alloc_dict . items ( ) if val }
given an objects .