'Restore values to VolumeGlanceMetadata object for provided fields.
First delete any existing metadata then save new values.'

def _restore_vol_glance_meta(self, metadata, volume_id, fields):

    LOG.debug('Restoring    volume    glance    metadata')
    metadata = self._filter(metadata, fields)
    self.db.volume_glance_metadata_delete_by_volume(self.context, volume_id)
    for (key, value) in metadata.items():
        self.db.volume_glance_metadata_create(self.context, volume_id, key, value)
    self.db.volume_update(self.context, volume_id, {'bootable': True})
