@require_context
@require_volume_exists
def volume_glance_metadata_copy_from_volume_to_volume(context, src_volume_id, volume_id):
 session = get_session()
 with session.begin():
  metadata = _volume_glance_metadata_get(context, src_volume_id, session=session)
  for meta in metadata:
   vol_glance_metadata = models.VolumeGlanceMetadata()
   vol_glance_metadata.volume_id = volume_id
   vol_glance_metadata.key = meta['key']
   vol_glance_metadata.value = meta['value']
   vol_glance_metadata.save(session=session)

@ require_context @ require_volume_exists def volume_glance_metadata_copy_from_volume_to_volume ( context , src_volume_id , volume_id ) : session = get_session ( ) with session . begin ( ) : metadata = _volume_glance_metadata_get ( context , src_volume_id , session = session ) for meta in metadata : vol_glance_metadata = models . VolumeGlanceMetadata ( ) vol_glance_metadata . volume_id = volume_id vol_glance_metadata . key = meta [ 'key' ] vol_glance_metadata . value = meta [ 'value' ] vol_glance_metadata . save ( session = session )
update the glance metadata for a volume .