summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-05-01 16:15:45 -0700
committerSage Weil <sage@newdream.net>2012-05-01 16:15:45 -0700
commit8ec39205b31b09e2ffc01427aee249830ef1f99e (patch)
tree98840277e0d9f181dc8d015bce3be49ac34b5d3f
parent779914ba5c4c306a3359a8b0fcf8959a00de9fa2 (diff)
downloadceph-8ec39205b31b09e2ffc01427aee249830ef1f99e.tar.gz
filestore: allow fsid to be fed in for mkfs
Mkfs currently always generates a new uuid. Allow the caller to feed one in. Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--src/os/FileStore.cc5
-rw-r--r--src/os/FileStore.h3
-rw-r--r--src/os/ObjectStore.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc
index d4c4a061db5..3b8171b598c 100644
--- a/src/os/FileStore.cc
+++ b/src/os/FileStore.cc
@@ -984,7 +984,10 @@ int FileStore::mkfs()
}
// fsid
- fsid.generate_random();
+ if (fsid.is_zero())
+ fsid.generate_random();
+ else
+ dout(1) << "mkfs using provided fsid " << fsid << dendl;
char fsid_str[40];
fsid.print(fsid_str);
diff --git a/src/os/FileStore.h b/src/os/FileStore.h
index b7da7d77b59..a2279e96404 100644
--- a/src/os/FileStore.h
+++ b/src/os/FileStore.h
@@ -383,6 +383,9 @@ public:
int dump_journal(ostream& out);
+ void set_fsid(uuid_d u) {
+ fsid = u;
+ }
uuid_d get_fsid() { return fsid; }
int snapshot(const string& name);
diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h
index 55b0dc6618b..56f5401a5af 100644
--- a/src/os/ObjectStore.h
+++ b/src/os/ObjectStore.h
@@ -739,6 +739,7 @@ public:
virtual int snapshot(const string& name) { return -EOPNOTSUPP; }
+ virtual void set_fsid(uuid_d u) = 0;
virtual uuid_d get_fsid() = 0;
};