Skip to content

Commit

Permalink
Merge pull request #14934 from dillaman/wip-19833-kraken
Browse files Browse the repository at this point in the history
kraken: cls_rbd: default initialize snapshot namespace for legacy clients

Reviewed-by: Mykola Golub <mgolub@mirantis.com>
  • Loading branch information
smithfarm committed Jul 5, 2017
2 parents 2b73b57 + d51b755 commit e705528
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/cls/rbd/cls_rbd.cc
Expand Up @@ -1525,6 +1525,12 @@ int snapshot_add(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
return -EINVAL;
}

if (boost::get<cls::rbd::UnknownSnapshotNamespace>(
&snap_meta.snapshot_namespace.snapshot_namespace) != nullptr) {
CLS_ERR("Unknown snapshot namespace provided");
return -EINVAL;
}

CLS_LOG(20, "snapshot_add name=%s id=%llu", snap_meta.name.c_str(),
(unsigned long long)snap_meta.id.val);

Expand Down
5 changes: 2 additions & 3 deletions src/cls/rbd/cls_rbd.h
Expand Up @@ -65,7 +65,8 @@ struct cls_rbd_snap {
uint8_t protection_status;
cls_rbd_parent parent;
uint64_t flags;
cls::rbd::SnapshotNamespaceOnDisk snapshot_namespace;
cls::rbd::SnapshotNamespaceOnDisk snapshot_namespace = {
cls::rbd::UserSnapshotNamespace{}};

/// true if we have a parent
bool has_parent() const {
Expand Down Expand Up @@ -105,8 +106,6 @@ struct cls_rbd_snap {
}
if (struct_v >= 5) {
::decode(snapshot_namespace, p);
} else {
snapshot_namespace = cls::rbd::SnapshotNamespaceOnDisk(cls::rbd::UserSnapshotNamespace());
}
DECODE_FINISH(p);
}
Expand Down

0 comments on commit e705528

Please sign in to comment.