rbd snap create testimg2@snap2
rbd deep copy testimg2 testimg3
rbd info testimg3 | grep 'size 256MiB'
+ rbd info testimg3 | grep 'parent: rbd/testimg1@snap1'
rbd snap ls testimg3 | grep -v 'SNAPID' | wc -l | grep 1
rbd snap ls testimg3 | grep '.*snap2.*'
rbd info testimg2 | grep 'features:.*deep-flatten' || rbd snap rm testimg2@snap2
rbd flatten testimg2
rbd flatten testimg3
rbd snap unprotect testimg1@snap1
+ rbd snap purge testimg2
+ rbd snap purge testimg3
+ rbd rm testimg2
+ rbd rm testimg3
+
+ rbd snap protect testimg1@snap1
+ rbd clone testimg1@snap1 testimg2
+ rbd snap create testimg2@snap2
+ rbd deep copy --flatten testimg2 testimg3
+ rbd info testimg3 | grep 'size 256MiB'
+ rbd info testimg3 | grep -v 'parent:'
+ rbd snap ls testimg3 | grep -v 'SNAPID' | wc -l | grep 1
+ rbd snap ls testimg3 | grep '.*snap2.*'
+ rbd info testimg2 | grep 'features:.*deep-flatten' || rbd snap rm testimg2@snap2
+ rbd flatten testimg2
+ rbd snap unprotect testimg1@snap1
remove_images
}
[--stripe-count <stripe-count>] [--data-pool <data-pool>]
[--journal-splay-width <journal-splay-width>]
[--journal-object-size <journal-object-size>]
- [--journal-pool <journal-pool>] [--no-progress]
+ [--journal-pool <journal-pool>] [--flatten]
+ [--no-progress]
<source-image-or-snap-spec> <dest-image-spec>
Deep copy src image to dest.
--journal-splay-width arg number of active journal objects
--journal-object-size arg size of journal objects
--journal-pool arg pool for journal objects
+ --flatten fill clone with parent data (make it independent)
--no-progress disable progress output
Image Features:
("export-format", po::value<ExportFormat>(), "format of image file");
}
+void add_flatten_option(boost::program_options::options_description *opt) {
+ opt->add_options()
+ (IMAGE_FLATTEN.c_str(), po::bool_switch(),
+ "fill clone with parent data (make it independent)");
+}
+
std::string get_short_features_help(bool append_suffix) {
std::ostringstream oss;
bool first_feature = true;
static const std::string IMAGE_DATA_POOL("data-pool");
static const std::string IMAGE_SPARSE_SIZE("sparse-size");
static const std::string IMAGE_THICK_PROVISION("thick-provision");
+static const std::string IMAGE_FLATTEN("flatten");
static const std::string JOURNAL_OBJECT_SIZE("journal-object-size");
static const std::string JOURNAL_SPLAY_WIDTH("journal-splay-width");
void add_no_error_option(boost::program_options::options_description *opt);
+void add_flatten_option(boost::program_options::options_description *opt);
+
std::string get_short_features_help(bool append_suffix);
std::string get_long_features_help();
return r;
}
+ r = get_flatten_option(vm, opts);
+ if (r < 0) {
+ return r;
+ }
+
return 0;
}
return 0;
}
+int get_flatten_option(const boost::program_options::variables_map &vm,
+ librbd::ImageOptions *opts) {
+ if (vm.count(at::IMAGE_FLATTEN) && vm[at::IMAGE_FLATTEN].as<bool>()) {
+ uint64_t flatten = 1;
+ opts->set(RBD_IMAGE_OPTION_FLATTEN, flatten);
+ }
+ return 0;
+}
+
int get_image_size(const boost::program_options::variables_map &vm,
uint64_t *size) {
if (vm.count(at::IMAGE_SIZE) == 0) {
int get_journal_options(const boost::program_options::variables_map &vm,
librbd::ImageOptions *opts);
+int get_flatten_option(const boost::program_options::variables_map &vm,
+ librbd::ImageOptions *opts);
+
int get_image_size(const boost::program_options::variables_map &vm,
uint64_t *size);
at::ARGUMENT_MODIFIER_SOURCE);
at::add_image_spec_options(positional, options, at::ARGUMENT_MODIFIER_DEST);
at::add_create_image_options(options, false);
+ at::add_flatten_option(options);
at::add_no_progress_option(options);
}