'Restore volume metadata to a volume.
The json container should contain a version that is supported here.'

def put(self, volume_id, json_metadata):

    meta_container = jsonutils.loads(json_metadata)
    version = meta_container['version']
    if (version == 1):
        factory = self._v1_restore_factory()
    elif (version == 2):
        factory = self._v2_restore_factory()
    else:
        msg = (_('Unsupported    backup    metadata    version    (%s)') % version)
        raise exception.BackupMetadataUnsupportedVersion(msg)
    for type in factory:
        func = factory[type][0]
        fields = factory[type][1]
        if (type in meta_container):
            func(meta_container[type], volume_id, fields)
        else:
            LOG.debug("No    metadata    of    type    '%s'    to    restore", type)
