resize the journal or need to otherwise destroy it: this guarantees
you won't lose data.
+.. option:: --get-cluster-fsid
+
+ Print the cluster fsid (uuid) and exit.
+
+.. option:: --get-osd-fsid
+
+ Print the OSD's fsid and exit. The OSD's uuid is generated at
+ --mkfs time and is thus unique to a particular instantiation of
+ this OSD.
+
+.. option:: --get-journal-fsid
+
+ Print the journal's uuid. The journal fsid is set to match the OSD
+ fsid at --mkfs time.
+
.. option:: -c ceph.conf, --conf=ceph.conf
Use *ceph.conf* configuration file instead of the default
bool mkkey = false;
bool flushjournal = false;
bool convertfilestore = false;
+ bool get_journal_fsid = false;
bool get_osd_fsid = false;
bool get_cluster_fsid = false;
std::string dump_pg_log;
get_cluster_fsid = true;
} else if (ceph_argparse_flag(args, i, "--get-osd-fsid", (char*)NULL)) {
get_osd_fsid = true;
+ } else if (ceph_argparse_flag(args, i, "--get-journal-fsid", (char*)NULL)) {
+ get_journal_fsid = true;
} else {
++i;
}
cout << osd_fsid << std::endl;
exit(0);
}
+ if (get_journal_fsid) {
+ uuid_d fsid;
+ int r = OSD::peek_journal_fsid(g_conf->osd_journal, fsid);
+ if (r == 0)
+ cout << fsid << std::endl;
+ exit(r);
+ }
pick_addresses(g_ceph_context);
return ret;
}
+int FileJournal::peek_fsid(uuid_d& fsid)
+{
+ int r = _open(false, false);
+ if (r < 0)
+ return r;
+ r = read_header();
+ if (r < 0)
+ return r;
+ fsid = header.fsid;
+ return 0;
+}
+
int FileJournal::open(uint64_t fs_op_seq)
{
dout(2) << "open " << fn << " fsid " << fsid << " fs_op_seq " << fs_op_seq << dendl;
/*
* journal header
*/
-#if 0
- struct old_header_t {
- __u32 version;
- __u32 flags;
- uint64_t fsid;
- __u32 block_size;
- __u32 alignment;
- int64_t max_size; // max size of journal ring buffer
- int64_t start; // offset of first entry
-
- old_header_t() : version(1), flags(0), fsid(0), block_size(0), alignment(0), max_size(0), start(0) {}
-
- void clear() {
- start = block_size;
- }
- } __attribute__((__packed__, aligned(4)));
-#endif
-
struct header_t {
uint64_t flags;
uuid_d fsid;
::decode(v, bl);
if (v < 2) { // normally 0, but concievably 1
// decode old header_t struct (pre v0.40).
- bl.advance(4); // skip flags (was unused by old code)
+ bl.advance(4); // skip __u32 flags (it was unused by any old code)
flags = 0;
uint64_t tfsid;
::decode(tfsid, bl);
int create();
int open(uint64_t fs_op_seq);
void close();
+ int peek_fsid(uuid_d& fsid);
void flush();
#include "common/ceph_argparse.h"
#include "os/FileStore.h"
+#include "os/FileJournal.h"
#include "ReplicatedPG.h"
return 0;
}
+int OSD::peek_journal_fsid(string path, uuid_d& fsid)
+{
+ FileJournal j(fsid, 0, 0, path.c_str());
+ return j.peek_fsid(fsid);
+}
+
+
#undef dout_prefix
#define dout_prefix _prefix(_dout, whoami, osdmap)
public:
static int peek_meta(const std::string &dev, string& magic,
uuid_d& cluster_fsid, uuid_d& osd_fsid, int& whoami);
+ static int peek_journal_fsid(std::string jpath, uuid_d& fsid);
// startup/shutdown