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..33"
71ba4a712SPawel Jakub Dawidek
81ba4a712SPawel Jakub Dawidekdisks_create 8
91ba4a712SPawel Jakub Dawideknames_create 1
101ba4a712SPawel Jakub Dawidek
111ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2}
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 "	  raidz2      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 "	    ${disk2}  ONLINE       0     0     0"
291ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
301ba4a712SPawel Jakub Dawidek)`
311ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
321ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
331ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
341ba4a712SPawel Jakub Dawidek
351ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
361ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk1}
371ba4a712SPawel Jakub Dawidekexp=`(
381ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
391ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
401ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
411ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
421ba4a712SPawel Jakub Dawidek  echo "        degraded state."
431ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
441ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
451ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
461ba4a712SPawel Jakub Dawidek  echo "config:"
471ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
481ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
491ba4a712SPawel Jakub Dawidek  echo "	  raidz2      DEGRADED     0     0     0"
501ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  ONLINE       0     0     0"
511ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
521ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
531ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
541ba4a712SPawel Jakub Dawidek)`
551ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
561ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
571ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
581ba4a712SPawel Jakub Dawidek
591ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
601ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk2}
611ba4a712SPawel Jakub Dawidekexp=`(
621ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
631ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
641ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
651ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
661ba4a712SPawel Jakub Dawidek  echo "        degraded state."
671ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
681ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
691ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
701ba4a712SPawel Jakub Dawidek  echo "config:"
711ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
721ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
731ba4a712SPawel Jakub Dawidek  echo "	  raidz2      DEGRADED     0     0     0"
741ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  ONLINE       0     0     0"
751ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  ONLINE       0     0     0"
761ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  OFFLINE      0     0     0"
771ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
781ba4a712SPawel Jakub Dawidek)`
791ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
801ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
811ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
821ba4a712SPawel Jakub Dawidek
831ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
841ba4a712SPawel Jakub Dawidekadd_msg="# TODO Sun CR 6328632, Lustre bug 16878"
851ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
861ba4a712SPawel Jakub Dawidekadd_msg=""
871ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} offline ${name0} ${disk2}
881ba4a712SPawel Jakub Dawidekexp=`(
891ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
901ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
911ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
921ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
931ba4a712SPawel Jakub Dawidek  echo "        degraded state."
941ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
951ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
961ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
971ba4a712SPawel Jakub Dawidek  echo "config:"
981ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
991ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
1001ba4a712SPawel Jakub Dawidek  echo "	  raidz2      DEGRADED     0     0     0"
1011ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  OFFLINE      0     0     0"
1021ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
1031ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
1041ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1051ba4a712SPawel Jakub Dawidek)`
1061ba4a712SPawel Jakub Dawidekadd_msg="# TODO Sun CR 6328632, Lustre bug 16878"
1071ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1081ba4a712SPawel Jakub Dawidekadd_msg=""
1091ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
1101ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
1111ba4a712SPawel Jakub Dawidek
1121ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
1131ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk1}
1141ba4a712SPawel Jakub Dawidekexp=`(
1151ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
1161ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
1171ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
1181ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
1191ba4a712SPawel Jakub Dawidek  echo "        degraded state."
1201ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
1211ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
1221ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
1231ba4a712SPawel Jakub Dawidek  echo "config:"
1241ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
1251ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
1261ba4a712SPawel Jakub Dawidek  echo "	  raidz2      DEGRADED     0     0     0"
1271ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  ONLINE       0     0     0"
1281ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
1291ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
1301ba4a712SPawel Jakub Dawidek  echo "	    ${disk3}  ONLINE       0     0     0"
1311ba4a712SPawel Jakub Dawidek  echo "	  raidz2      ONLINE       0     0     0"
1321ba4a712SPawel Jakub Dawidek  echo "	    ${disk4}  ONLINE       0     0     0"
1331ba4a712SPawel Jakub Dawidek  echo "	    ${disk5}  ONLINE       0     0     0"
1341ba4a712SPawel Jakub Dawidek  echo "	    ${disk6}  ONLINE       0     0     0"
1351ba4a712SPawel Jakub Dawidek  echo "	    ${disk7}  ONLINE       0     0     0"
1361ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1371ba4a712SPawel Jakub Dawidek)`
1381ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1391ba4a712SPawel Jakub Dawidekadd_msg="# TODO Sun CR 6328632, Lustre bug 16878"
1401ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk3}
1411ba4a712SPawel Jakub Dawidekexp=`(
1421ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
1431ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
1441ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
1451ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
1461ba4a712SPawel Jakub Dawidek  echo "        degraded state."
1471ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
1481ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
1491ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
1501ba4a712SPawel Jakub Dawidek  echo "config:"
1511ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
1521ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
1531ba4a712SPawel Jakub Dawidek  echo "	  raidz2      DEGRADED     0     0     0"
1541ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  ONLINE       0     0     0"
1551ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
1561ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
1571ba4a712SPawel Jakub Dawidek  echo "	    ${disk3}  OFFLINE      0     0     0"
1581ba4a712SPawel Jakub Dawidek  echo "	  raidz2      ONLINE       0     0     0"
1591ba4a712SPawel Jakub Dawidek  echo "	    ${disk4}  ONLINE       0     0     0"
1601ba4a712SPawel Jakub Dawidek  echo "	    ${disk5}  ONLINE       0     0     0"
1611ba4a712SPawel Jakub Dawidek  echo "	    ${disk6}  ONLINE       0     0     0"
1621ba4a712SPawel Jakub Dawidek  echo "	    ${disk7}  ONLINE       0     0     0"
1631ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1641ba4a712SPawel Jakub Dawidek)`
1651ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1661ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} offline ${name0} ${disk4} ${disk7}
1671ba4a712SPawel Jakub Dawidekadd_msg=""
1681ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} offline ${name0} ${disk0}
1691ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} offline ${name0} ${disk2}
1701ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} offline ${name0} ${disk5} ${disk6}
1711ba4a712SPawel Jakub Dawidekexp=`(
1721ba4a712SPawel Jakub Dawidek  echo "  pool: ${name0}"
1731ba4a712SPawel Jakub Dawidek  echo " state: DEGRADED"
1741ba4a712SPawel Jakub Dawidek  echo "status: One or more devices has been taken offline by the administrator."
1751ba4a712SPawel Jakub Dawidek  echo "        Sufficient replicas exist for the pool to continue functioning in a"
1761ba4a712SPawel Jakub Dawidek  echo "        degraded state."
1771ba4a712SPawel Jakub Dawidek  echo "action: Online the device using 'zpool online' or replace the device with"
1781ba4a712SPawel Jakub Dawidek  echo "        'zpool replace'."
1791ba4a712SPawel Jakub Dawidek  echo " scrub: none requested"
1801ba4a712SPawel Jakub Dawidek  echo "config:"
1811ba4a712SPawel Jakub Dawidek  echo "	NAME          STATE     READ WRITE CKSUM"
1821ba4a712SPawel Jakub Dawidek  echo "	${name0}      DEGRADED     0     0     0"
1831ba4a712SPawel Jakub Dawidek  echo "	  raidz2      DEGRADED     0     0     0"
1841ba4a712SPawel Jakub Dawidek  echo "	    ${disk0}  ONLINE       0     0     0"
1851ba4a712SPawel Jakub Dawidek  echo "	    ${disk1}  OFFLINE      0     0     0"
1861ba4a712SPawel Jakub Dawidek  echo "	    ${disk2}  ONLINE       0     0     0"
1871ba4a712SPawel Jakub Dawidek  echo "	    ${disk3}  OFFLINE      0     0     0"
1881ba4a712SPawel Jakub Dawidek  echo "	  raidz2      DEGRADED     0     0     0"
1891ba4a712SPawel Jakub Dawidek  echo "	    ${disk4}  OFFLINE      0     0     0"
1901ba4a712SPawel Jakub Dawidek  echo "	    ${disk5}  ONLINE       0     0     0"
1911ba4a712SPawel Jakub Dawidek  echo "	    ${disk6}  ONLINE       0     0     0"
1921ba4a712SPawel Jakub Dawidek  echo "	    ${disk7}  OFFLINE      0     0     0"
1931ba4a712SPawel Jakub Dawidek  echo "errors: No known data errors"
1941ba4a712SPawel Jakub Dawidek)`
1951ba4a712SPawel Jakub Dawidekadd_msg="# TODO Sun CR 6328632, Lustre bug 16878"
1961ba4a712SPawel Jakub Dawidekexpect "${exp}" ${ZPOOL} status ${name0}
1971ba4a712SPawel Jakub Dawidekadd_msg=""
1981ba4a712SPawel Jakub Dawidekexpect_ok ${ZPOOL} destroy ${name0}
1991ba4a712SPawel Jakub Dawidekexpect_fl ${ZPOOL} status -x ${name0}
2001ba4a712SPawel Jakub Dawidek
2011ba4a712SPawel Jakub Dawidekdisks_destroy
202