return 0;
}
-int do_import(ObjectStore *store, OSDSuperblock& sb)
+int do_import(ObjectStore *store, OSDSuperblock& sb, bool force)
{
bufferlist ebl;
pg_info_t info;
cerr << "OSD requires sharding to be enabled" << std::endl;
cerr << std::endl;
cerr << "If you wish to import, first do 'ceph-objectstore-tool...--op set-allow-sharded-objects'" << std::endl;
+ return 1;
}
- return 11; // Assume no +EAGAIN gets to end of main() until we clean up error code handling
+ // Let them import if they specify the --force option
+ if (!force)
+ return 11; // Assume no +EAGAIN gets to end of main() until we clean up error code handling
}
// Don't import if pool no longer exists
spg_t pgid;
ghobject_t ghobj;
bool human_readable;
+ bool force;
Formatter *formatter;
po::options_description desc("Allowed options");
("format", po::value<string>(&format)->default_value("json-pretty"),
"Output format which may be json, json-pretty, xml, xml-pretty")
("debug", "Enable diagnostic output to stderr")
+ ("force", "Ignore some types of errors and proceed with operation - USE WITH CAUTION: CORRUPTION POSSIBLE NOW OR IN THE FUTURE")
("skip-journal-replay", "Disable journal replay")
("skip-mount-omap", "Disable mounting of omap")
;
debug = true;
}
+ if (!vm.count("force")) {
+ force = false;
+ } else {
+ force = true;
+ }
+
vector<const char *> ceph_options;
env_to_vec(ceph_options);
ceph_options.reserve(ceph_options.size() + ceph_option_strings.size());
if (op == "import") {
try {
- ret = do_import(fs, superblock);
+ ret = do_import(fs, superblock, force);
}
catch (const buffer::error &e) {
cerr << "do_import threw exception error " << e.what() << std::endl;