]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/librbd/api/Snapshot.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / librbd / api / Snapshot.cc
index da6c7196bc83aba938fb085e85fb6caf548ba8f6..88f22694cf28d4e85c6beeb14e2e894fef8ea479 100644 (file)
 #include "librbd/Operations.h"
 #include "librbd/Utils.h"
 #include "librbd/api/Image.h"
-#include <boost/variant.hpp>
 #include "include/Context.h"
 #include "common/Cond.h"
 
+#include <boost/variant.hpp>
+
 #define dout_subsys ceph_subsys_rbd
 #undef dout_prefix
 #define dout_prefix *_dout << "librbd::api::Snapshot: " << __func__ << ": "
@@ -309,6 +310,23 @@ int Snapshot<I>::exists(I *ictx, const cls::rbd::SnapshotNamespace& snap_namespa
   return 0;
 }
 
+template <typename I>
+int Snapshot<I>::create(I *ictx, const char *snap_name, uint32_t flags,
+                        ProgressContext& pctx) {
+  ldout(ictx->cct, 20) << "snap_create " << ictx << " " << snap_name
+                       << " flags: " << flags << dendl;
+
+  uint64_t internal_flags = 0;
+  int r = util::snap_create_flags_api_to_internal(ictx->cct, flags,
+                                                  &internal_flags);
+  if (r < 0) {
+    return r;
+  }
+
+  return ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
+                                       snap_name, internal_flags, pctx);
+}
+
 template <typename I>
 int Snapshot<I>::remove(I *ictx, const char *snap_name, uint32_t flags,
                         ProgressContext& pctx) {