xref: /freebsd/tools/regression/zfs/zpool/offline/mirror.t (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
11ba4a712SPawel Jakub Dawidek#!/bin/sh
21ba4a712SPawel Jakub Dawidek
31ba4a712SPawel Jakub Dawidekdir=`dirname $0`
41ba4a712SPawel Jakub Dawidek. ${dir}/../../misc.sh
51ba4a712SPawel Jakub Dawidek
61ba4a712SPawel Jakub Dawidekecho "1..47"
71ba4a712SPawel Jakub Dawidek
81ba4a712SPawel Jakub Dawidekdisks_create 6
91ba4a712SPawel Jakub Dawideknames_create 1
101ba4a712SPawel Jakub Dawidek
111ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
121ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk0}
131ba4a712SPawel Jakub Dawidekexp=`(
141ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
151ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
161ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
171ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
181ba4a712SPawel Jakub Dawidek  echo "        degraded state."
191ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
201ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
211ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
221ba4a712SPawel Jakub Dawidek  echo "config:"
231ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
241ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
251ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
261ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  OFFLINE      0     0     0"
271ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  ONLINE       0     0     0"
281ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
291ba4a712SPawel Jakub Dawidek)`
301ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
311ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
321ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
331ba4a712SPawel Jakub Dawidek
341ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1}
351ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk1}
361ba4a712SPawel Jakub Dawidekexp=`(
371ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
381ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
391ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
401ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
411ba4a712SPawel Jakub Dawidek  echo "        degraded state."
421ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
431ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
441ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
451ba4a712SPawel Jakub Dawidek  echo "config:"
461ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
471ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
481ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
491ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  ONLINE       0     0     0"
501ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
511ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
521ba4a712SPawel Jakub Dawidek)`
531ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
541ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
551ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
561ba4a712SPawel Jakub Dawidek
571ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1}
581ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk0}
591ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} offline ${name0} ${disk1}
601ba4a712SPawel Jakub Dawidekexp=`(
611ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
621ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
631ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
641ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
651ba4a712SPawel Jakub Dawidek  echo "        degraded state."
661ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
671ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
681ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
691ba4a712SPawel Jakub Dawidek  echo "config:"
701ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
711ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
721ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
731ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  OFFLINE      0     0     0"
741ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  ONLINE       0     0     0"
751ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
761ba4a712SPawel Jakub Dawidek)`
771ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
781ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
791ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
801ba4a712SPawel Jakub Dawidek
811ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
821ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk0}
831ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk3}
841ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} offline ${name0} ${disk1}
851ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} offline ${name0} ${disk2}
861ba4a712SPawel Jakub Dawidekexp=`(
871ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
881ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
891ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
901ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
911ba4a712SPawel Jakub Dawidek  echo "        degraded state."
921ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
931ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
941ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
951ba4a712SPawel Jakub Dawidek  echo "config:"
961ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
971ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
981ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
991ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  OFFLINE      0     0     0"
1001ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  ONLINE       0     0     0"
1011ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
1021ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
1031ba4a712SPawel Jakub Dawidek  echo "	    ${disk3}  OFFLINE      0     0     0"
1041ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1051ba4a712SPawel Jakub Dawidek)`
1061ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1071ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
1081ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
1091ba4a712SPawel Jakub Dawidek
1101ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
1111ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
1121ba4a712SPawel Jakub Dawidekexp=`(
1131ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
1141ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
1151ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
1161ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
1171ba4a712SPawel Jakub Dawidek  echo "        degraded state."
1181ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
1191ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
1201ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
1211ba4a712SPawel Jakub Dawidek  echo "config:"
1221ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
1231ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
1241ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
1251ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  ONLINE       0     0     0"
1261ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
1271ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
1281ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  OFFLINE      0     0     0"
1291ba4a712SPawel Jakub Dawidek  echo "	    ${disk3}  ONLINE       0     0     0"
1301ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1311ba4a712SPawel Jakub Dawidek)`
1321ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1331ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
1341ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
1351ba4a712SPawel Jakub Dawidek
1361ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2}
1371ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk0}
1381ba4a712SPawel Jakub Dawidekadd_msg="# TODO Sun CR 6328632, Lustre bug 16878"
1391ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk1}
1401ba4a712SPawel Jakub Dawidekexp=`(
1411ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
1421ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
1431ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
1441ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
1451ba4a712SPawel Jakub Dawidek  echo "        degraded state."
1461ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
1471ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
1481ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
1491ba4a712SPawel Jakub Dawidek  echo "config:"
1501ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
1511ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
1521ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
1531ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  OFFLINE      0     0     0"
1541ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
1551ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
1561ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1571ba4a712SPawel Jakub Dawidek)`
1581ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1591ba4a712SPawel Jakub Dawidekadd_msg=""
1601ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
1611ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
1621ba4a712SPawel Jakub Dawidek
1631ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2} mirror ${disk3} ${disk4} ${disk5}
1641ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk0}
1651ba4a712SPawel Jakub Dawidekadd_msg="# TODO Sun CR 6328632, Lustre bug 16878"
1661ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk1}
1671ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk3} ${disk5}
1681ba4a712SPawel Jakub Dawidekexp=`(
1691ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
1701ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
1711ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
1721ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
1731ba4a712SPawel Jakub Dawidek  echo "        degraded state."
1741ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
1751ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
1761ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
1771ba4a712SPawel Jakub Dawidek  echo "config:"
1781ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
1791ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
1801ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
1811ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  OFFLINE      0     0     0"
1821ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
1831ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
1841ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
1851ba4a712SPawel Jakub Dawidek  echo "	    ${disk3}  OFFLINE      0     0     0"
1861ba4a712SPawel Jakub Dawidek  echo "	    ${disk4}  ONLINE       0     0     0"
1871ba4a712SPawel Jakub Dawidek  echo "	    ${disk5}  OFFLINE      0     0     0"
1881ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1891ba4a712SPawel Jakub Dawidek)`
1901ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1911ba4a712SPawel Jakub Dawidekadd_msg=""
1921ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
1931ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
1941ba4a712SPawel Jakub Dawidek
1951ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
1961ba4a712SPawel Jakub Dawidekadd_msg="# TODO Sun CR 6328632, Lustre bug 16878"
1971ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk2} ${disk3} ${disk4}
1981ba4a712SPawel Jakub Dawidekexp=`(
1991ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
2001ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
2011ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
2021ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
2031ba4a712SPawel Jakub Dawidek  echo "        degraded state."
2041ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
2051ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
2061ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
2071ba4a712SPawel Jakub Dawidek  echo "config:"
2081ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
2091ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
2101ba4a712SPawel Jakub Dawidek  echo "	  mirror      DEGRADED     0     0     0"
2111ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  OFFLINE      0     0     0"
2121ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  ONLINE       0     0     0"
2131ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  OFFLINE      0     0     0"
2141ba4a712SPawel Jakub Dawidek  echo "	    ${disk3}  OFFLINE      0     0     0"
2151ba4a712SPawel Jakub Dawidek  echo "	    ${disk4}  OFFLINE      0     0     0"
2161ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
2171ba4a712SPawel Jakub Dawidek)`
2181ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
2191ba4a712SPawel Jakub Dawidekadd_msg=""
2201ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
2211ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
2221ba4a712SPawel Jakub Dawidek
2231ba4a712SPawel Jakub Dawidekdisks_destroy
224