def save_flavor_info(metadata, instance_type, prefix=''):
 for key in system_metadata_flavor_props.keys():
  to_key = ('%sinstance_type_%s' % (prefix, key))
  metadata[to_key] = instance_type[key]
 extra_specs = instance_type.get('extra_specs', {})
 for extra_prefix in system_metadata_flavor_extra_props:
  for key in extra_specs:
   if key.startswith(extra_prefix):
    to_key = ('%sinstance_type_extra_%s' % (prefix, key))
    metadata[to_key] = extra_specs[key]
 return metadata

def save_flavor_info ( metadata , instance_type , prefix = '' ) : for key in system_metadata_flavor_props . keys ( ) : to_key = ( '%sinstance_type_%s' % ( prefix , key ) ) metadata [ to_key ] = instance_type [ key ] extra_specs = instance_type . get ( 'extra_specs' , { } ) for extra_prefix in system_metadata_flavor_extra_props : for key in extra_specs : if key . startswith ( extra_prefix ) : to_key = ( '%sinstance_type_extra_%s' % ( prefix , key ) ) metadata [ to_key ] = extra_specs [ key ] return metadata
save properties from instance_type into instances system_metadata .