def _get_backup_metadata(backup, operation):
 try:
  svc_dict = json.loads(backup.service_metadata)
  backup_path = svc_dict.get('backup_path')
  backup_mode = svc_dict.get('backup_mode')
 except TypeError:
  vol_prefix = CONF.backup_tsm_volume_prefix
  backup_id = backup['id']
  backup_path = utils.make_dev_path(('%s-%s' % (vol_prefix, backup_id)))
  backup_mode = 'image'
 if (backup_mode not in VALID_BACKUP_MODES):
  volume_id = backup['volume_id']
  backup_id = backup['id']
  err = (_('%(op)s: backup %(bck_id)s, volume %(vol_id)s failed. Backup object has unexpected mode. Image or file backups supported, actual mode is %(vol_mode)s.') % {'op': operation, 'bck_id': backup_id, 'vol_id': volume_id, 'vol_mode': backup_mode})
  LOG.error(err)
  raise exception.InvalidBackup(reason=err)
 return (backup_path, backup_mode)

def _get_backup_metadata ( backup , operation ) : try : svc_dict = json . loads ( backup . service_metadata ) backup_path = svc_dict . get ( 'backup_path' ) backup_mode = svc_dict . get ( 'backup_mode' ) except TypeError : vol_prefix = CONF . backup_tsm_volume_prefix backup_id = backup [ 'id' ] backup_path = utils . make_dev_path ( ( '%s-%s' % ( vol_prefix , backup_id ) ) ) backup_mode = 'image' if ( backup_mode not in VALID_BACKUP_MODES ) : volume_id = backup [ 'volume_id' ] backup_id = backup [ 'id' ] err = ( _ ( '%(op)s: backup %(bck_id)s, volume %(vol_id)s failed. Backup object has unexpected mode. Image or file backups supported, actual mode is %(vol_mode)s.' ) % { 'op' : operation , 'bck_id' : backup_id , 'vol_id' : volume_id , 'vol_mode' : backup_mode } ) LOG . error ( err ) raise exception . InvalidBackup ( reason = err ) return ( backup_path , backup_mode )
return metadata persisted with backup object .