diff options
author | Guoqing Jiang <gqjiang@suse.com> | 2015-06-10 07:42:06 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-06-17 01:06:30 +0200 |
commit | 7716570e6d906e7326f83d466f6ba73009649d03 (patch) | |
tree | 7107f4dec7c84e6a7f49c64e679ea0dd885a310b /mdadm.c | |
parent | Add nodes option while creating md (diff) | |
download | mdadm-7716570e6d906e7326f83d466f6ba73009649d03.tar.xz mdadm-7716570e6d906e7326f83d466f6ba73009649d03.zip |
Set home-cluster while creating an array
The home-cluster is stored in the bitmap super block of the
array. The device can be assembled on a cluster with the
cluster name same as the one recorded in the bitmap.
If home-cluster is not specified, this is auto-detected using
dlopen corosync cmap library.
neilb: allow code to compile when corosync-devel is not installed.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r-- | mdadm.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -596,6 +596,13 @@ int main(int argc, char *argv[]) exit(2); } continue; + case O(CREATE, ClusterName): + c.homecluster = optarg; + if (strlen(c.homecluster) > 64) { + pr_err("Cluster name too big.\n"); + exit(ERANGE); + } + continue; case O(CREATE,'x'): /* number of spare (eXtra) disks */ if (s.sparedisks) { pr_err("spare-devices set twice: %d and %s\n", @@ -1276,6 +1283,16 @@ int main(int argc, char *argv[]) c.require_homehost = 0; } + if (c.homecluster == NULL && (c.nodes > 0)) { + c.homecluster = conf_get_homecluster(); + if (c.homecluster == NULL) + rv = get_cluster_name(&c.homecluster); + if (rv != 0) { + pr_err("The md can't get cluster name\n"); + exit(1); + } + } + if (c.backup_file && data_offset != INVALID_SECTORS) { pr_err("--backup-file and --data-offset are incompatible\n"); exit(2); |