Whamcloud - gitweb
LU-7134 utils: Ensure hostid set for ZFS during mkfs
[fs/lustre-release.git] / lustre / tests / test-framework.sh
index b323882..5bde188 100755 (executable)
@@ -1190,6 +1190,15 @@ set_default_debug_facet () {
     set_default_debug_nodes $node
 }
 
+set_hostid () {
+    local hostid=${1:-$(hostid)}
+
+    if [ ! -s /etc/hostid ]; then
+       printf $(echo -n $hostid |
+           sed 's/\(..\)\(..\)\(..\)\(..\)/\\x\4\\x\3\\x\2\\x\1/') >/etc/hostid
+    fi
+}
+
 # Facet functions
 mount_facets () {
        local facets=${1:-$(get_facets)}
@@ -3537,6 +3546,9 @@ format_ost() {
 
 formatall() {
        stopall
+       # Set hostid for ZFS/SPL zpool import protection
+       do_rpc_nodes "$(comma_list $(remote_nodes_list))" set_hostid
+
        # We need ldiskfs here, may as well load them all
        load_modules
        [ "$CLIENTONLY" ] && return