ZTS: Fix mmp_hostid test

Correctly use the `mntpnt_fs` variable, and include additional
logic to ensure the /etc/hostid is correct set up and cleaned up.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Igor Kozhukhov <igor@dilos.org>
Closes #9349
This commit is contained in:
Igor K 2019-10-08 23:40:17 +03:00 committed by Tony Hutter
parent 8139355dce
commit 8af362c3e9

View File

@ -43,6 +43,9 @@ function cleanup
log_must rm $MMP_DIR/file.{0,1,2,3,4,5} log_must rm $MMP_DIR/file.{0,1,2,3,4,5}
log_must rmdir $MMP_DIR log_must rmdir $MMP_DIR
log_must mmp_clear_hostid log_must mmp_clear_hostid
if [[ -L $HOSTID_FILE ]]; then
rm -f $HOSTID_FILE
fi
} }
log_assert "Verify hostid file can reside on a ZFS dataset" log_assert "Verify hostid file can reside on a ZFS dataset"
@ -64,10 +67,11 @@ log_must mv $HOSTID_FILE $mntpnt_etc/hostid
# 3. Create a file so the pool will have some contents # 3. Create a file so the pool will have some contents
log_must zfs create $MMP_POOL/fs log_must zfs create $MMP_POOL/fs
mntpnt_fs=$(get_prop mountpoint $MMP_POOL/fs) mntpnt_fs=$(get_prop mountpoint $MMP_POOL/fs)
log_must mkfile 1M $fs_mntpnt/file log_must mkfile 1M $mntpnt_fs/file
# 4. Verify multihost cannot be enabled until the /etc/hostid is linked # 4. Verify multihost cannot be enabled until the /etc/hostid is linked
log_mustnot zpool set multihost=on $MMP_POOL log_mustnot zpool set multihost=on $MMP_POOL
log_mustnot ls -l $HOSTID_FILE
log_must ln -s $mntpnt_etc/hostid $HOSTID_FILE log_must ln -s $mntpnt_etc/hostid $HOSTID_FILE
log_must zpool set multihost=on $MMP_POOL log_must zpool set multihost=on $MMP_POOL