]> git.proxmox.com Git - mirror_zfs.git/commit
Add zgenhostid utility script
authorOlaf Faaland <faaland1@llnl.gov>
Wed, 19 Jul 2017 01:11:08 +0000 (18:11 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 25 Jul 2017 17:22:03 +0000 (13:22 -0400)
commitb9373170e3e346733f5666dd80727cb6e05cd5d3
tree943c2d6f5a409170e7e7cd8b5c129d0b9dcab04f
parentffb195c256f8a74a87c3834258ec90c513d66adb
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 <dinatale2@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #6358
Closes #6379
14 files changed:
cmd/Makefile.am
cmd/zgenhostid/Makefile.am [new file with mode: 0644]
cmd/zgenhostid/zgenhostid [new file with mode: 0755]
cmd/zpool/zpool_main.c
configure.ac
lib/libzfs/libzfs_pool.c
man/man8/Makefile.am
man/man8/zgenhostid.8 [new file with mode: 0644]
man/man8/zpool.8
tests/zfs-tests/include/commands.cfg
tests/zfs-tests/tests/functional/mmp/mmp.kshlib
tests/zfs-tests/tests/functional/mmp/mmp_active_import.ksh
tests/zfs-tests/tests/functional/mmp/mmp_exported_import.ksh
tests/zfs-tests/tests/functional/mmp/mmp_inactive_import.ksh