]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/tools/rbd/action/Resize.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / tools / rbd / action / Resize.cc
index 60c16429b79e33924c774eb9fea700a346c560d7..79fbbd127d7a2243a51117762b0b6ea42b806654 100644 (file)
@@ -34,6 +34,7 @@ void get_arguments(po::options_description *positional,
   options->add_options()
     ("allow-shrink", po::bool_switch(), "permit shrinking");
   at::add_no_progress_option(options);
+  at::add_encryption_options(options);
 }
 
 int execute(const po::variables_map &vm,
@@ -57,6 +58,12 @@ int execute(const po::variables_map &vm,
     return r;
   }
 
+  utils::EncryptionOptions encryption_options;
+  r = utils::get_encryption_options(vm, &encryption_options);
+  if (r < 0) {
+    return r;
+  }
+
   librados::Rados rados;
   librados::IoCtx io_ctx;
   librbd::Image image;
@@ -66,6 +73,16 @@ int execute(const po::variables_map &vm,
     return r;
   }
 
+  if (!encryption_options.specs.empty()) {
+    r = image.encryption_load2(encryption_options.specs.data(),
+                               encryption_options.specs.size());
+    if (r < 0) {
+      std::cerr << "rbd: encryption load failed: " << cpp_strerror(r)
+                << std::endl;
+      return r;
+    }
+  }
+
   librbd::image_info_t info;
   r = image.stat(info, sizeof(info));
   if (r < 0) {