diff options
author | Olaf Faaland <[email protected]> | 2017-07-18 18:11:08 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-07-25 13:22:03 -0400 |
commit | b9373170e3e346733f5666dd80727cb6e05cd5d3 (patch) | |
tree | 943c2d6f5a409170e7e7cd8b5c129d0b9dcab04f /cmd/zpool | |
parent | ffb195c256f8a74a87c3834258ec90c513d66adb (diff) |
Add zgenhostid utility script
Turning the multihost property on requires that a hostid be set to allow
ZFS to determine when a foreign system is attemping to import a pool.
The error message instructing the user to set a hostid refers to
genhostid(1).
Genhostid(1) is not available on SUSE Linux. This commit adds a script
modeled after genhostid(1) for those users.
Zgenhostid checks for an /etc/hostid file; if it does not exist, it
creates one and stores a value. If the user has provided a hostid as an
argument, that value is used. Otherwise, a random hostid is generated
and stored.
This differs from the CENTOS 6/7 versions of genhostid, which overwrite
the /etc/hostid file even though their manpages state otherwise.
A man page for zgenhostid is added. The one for genhostid is in (1), but
I put zgenhostid in (8) because I believe it's more appropriate.
The mmp tests are modified to use zgenhostid to set the hostid instead
of using the spl_hostid module parameter. zgenhostid will not replace
an existing /etc/hostid file, so new mmp_clear_hostid calls are
required.
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Andreas Dilger <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Olaf Faaland <[email protected]>
Closes #6358
Closes #6379
Diffstat (limited to 'cmd/zpool')
-rw-r--r-- | cmd/zpool/zpool_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 8d04f7725..f597109d2 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -2177,7 +2177,7 @@ show_import(nvlist_t *config) break; case ZPOOL_STATUS_HOSTID_REQUIRED: (void) printf(gettext(" action: Set a unique system " - "hostid with the genhostid(1) command.\n")); + "hostid with the zgenhostid(8) command.\n")); break; default: (void) printf(gettext(" action: The pool cannot be " @@ -2304,7 +2304,7 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts, (void) fprintf(stderr, gettext("Cannot import '%s': " "pool has the multihost property on and the\n" "system's hostid is not set. Set a unique hostid " - "with the genhostid(1) command.\n"), name); + "with the zgenhostid(8) command.\n"), name); } else { char *hostname = "<unknown>"; uint64_t timestamp = 0; |