'Backup volume metadata.
NOTE(dosaboy): the metadata we are backing up is obtained from a
versioned api so we should not alter it in any way here.
We must also be sure that the service that will perform
the restore is compatible with version used.'

def _backup_metadata(self, backup):

    json_meta = self.get_metadata(backup.volume_id)
    if (not json_meta):
        LOG.debug('No    metadata    to    backup    for    volume    %s.', backup.volume_id)
        return
    LOG.debug('Backing    up    metadata    for    volume    %s.', backup.volume_id)
    try:
        with rbd_driver.RADOSClient(self, backup.container) as client:
            vol_meta_backup = VolumeMetadataBackup(client, backup.id)
            vol_meta_backup.set(json_meta)
    except exception.VolumeMetadataBackupExists as e:
        msg = (_('Failed    to    backup    volume    metadata    -    %s') % e)
        raise exception.BackupOperationError(msg)
