1# CDDL HEADER START 2# 3# The contents of this file are subject to the terms of the 4# Common Development and Distribution License (the "License"). 5# You may not use this file except in compliance with the License. 6# 7# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 8# or http://www.opensolaris.org/os/licensing. 9# See the License for the specific language governing permissions 10# and limitations under the License. 11# 12# When distributing Covered Code, include this CDDL HEADER in each 13# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 14# If applicable, add the following below this CDDL HEADER, with the 15# fields enclosed by brackets "[]" replaced with your own identifying 16# information: Portions Copyright [yyyy] [name of copyright owner] 17# 18# CDDL HEADER END 19# 20 21# $FreeBSD$ 22 23# 24# Copyright 2012 Spectra Logic. All rights reserved. 25# Use is subject to license terms. 26# 27 28 29atf_test_case hotspare_add_001_pos cleanup 30hotspare_add_001_pos_head() 31{ 32 atf_set "descr" "'zpool add <pool> spare <vdev> ...' can add devices to the pool." 33 atf_set "timeout" 3600 34} 35hotspare_add_001_pos_body() 36{ 37 . $(atf_get_srcdir)/../../include/default.cfg 38 . $(atf_get_srcdir)/hotspare.kshlib 39 . $(atf_get_srcdir)/hotspare.cfg 40 41 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 42 ksh93 $(atf_get_srcdir)/hotspare_add_001_pos.ksh || atf_fail "Testcase failed" 43} 44hotspare_add_001_pos_cleanup() 45{ 46 . $(atf_get_srcdir)/../../include/default.cfg 47 . $(atf_get_srcdir)/hotspare.kshlib 48 . $(atf_get_srcdir)/hotspare.cfg 49 50 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 51} 52 53 54atf_test_case hotspare_add_002_pos cleanup 55hotspare_add_002_pos_head() 56{ 57 atf_set "descr" "'zpool add <pool> spare <vdev> ...' can add devices to the pool while it has spare-in device." 58 atf_set "require.progs" zpool 59 atf_set "timeout" 3600 60} 61hotspare_add_002_pos_body() 62{ 63 . $(atf_get_srcdir)/../../include/default.cfg 64 . $(atf_get_srcdir)/hotspare.kshlib 65 . $(atf_get_srcdir)/hotspare.cfg 66 67 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 68 ksh93 $(atf_get_srcdir)/hotspare_add_002_pos.ksh || atf_fail "Testcase failed" 69} 70hotspare_add_002_pos_cleanup() 71{ 72 . $(atf_get_srcdir)/../../include/default.cfg 73 . $(atf_get_srcdir)/hotspare.kshlib 74 . $(atf_get_srcdir)/hotspare.cfg 75 76 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 77} 78 79 80atf_test_case hotspare_add_003_neg cleanup 81hotspare_add_003_neg_head() 82{ 83 atf_set "descr" "'zpool add [-f]' with hot spares should fail with inapplicable scenarios." 84 atf_set "require.progs" zpool 85 atf_set "timeout" 3600 86} 87hotspare_add_003_neg_body() 88{ 89 . $(atf_get_srcdir)/../../include/default.cfg 90 . $(atf_get_srcdir)/hotspare.kshlib 91 . $(atf_get_srcdir)/hotspare.cfg 92 93 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 94 ksh93 $(atf_get_srcdir)/hotspare_add_003_neg.ksh || atf_fail "Testcase failed" 95} 96hotspare_add_003_neg_cleanup() 97{ 98 . $(atf_get_srcdir)/../../include/default.cfg 99 . $(atf_get_srcdir)/hotspare.kshlib 100 . $(atf_get_srcdir)/hotspare.cfg 101 102 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 103} 104 105 106atf_test_case hotspare_add_004_neg cleanup 107hotspare_add_004_neg_head() 108{ 109 atf_set "descr" "'zpool add [-f]' will not allow a swap device to be used as a hotspare'" 110 atf_set "require.progs" zpool swapon swapoff swapctl 111} 112hotspare_add_004_neg_body() 113{ 114 . $(atf_get_srcdir)/../../include/default.cfg 115 . $(atf_get_srcdir)/hotspare.kshlib 116 . $(atf_get_srcdir)/hotspare.cfg 117 118 verify_disk_count "$DISKS" 1 119 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 120 ksh93 $(atf_get_srcdir)/hotspare_add_004_neg.ksh || atf_fail "Testcase failed" 121} 122hotspare_add_004_neg_cleanup() 123{ 124 . $(atf_get_srcdir)/../../include/default.cfg 125 . $(atf_get_srcdir)/hotspare.kshlib 126 . $(atf_get_srcdir)/hotspare.cfg 127 128 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 129} 130 131 132atf_test_case hotspare_clone_001_pos cleanup 133hotspare_clone_001_pos_head() 134{ 135 atf_set "descr" "'zpool detach <pool> <vdev> ...' against hotspare should do no harm to clone." 136 atf_set "require.progs" zfs zpool sum 137 atf_set "timeout" 3600 138} 139hotspare_clone_001_pos_body() 140{ 141 . $(atf_get_srcdir)/../../include/default.cfg 142 . $(atf_get_srcdir)/hotspare.kshlib 143 . $(atf_get_srcdir)/hotspare.cfg 144 145 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 146 ksh93 $(atf_get_srcdir)/hotspare_clone_001_pos.ksh || atf_fail "Testcase failed" 147} 148hotspare_clone_001_pos_cleanup() 149{ 150 . $(atf_get_srcdir)/../../include/default.cfg 151 . $(atf_get_srcdir)/hotspare.kshlib 152 . $(atf_get_srcdir)/hotspare.cfg 153 154 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 155} 156 157 158atf_test_case hotspare_clone_002_pos cleanup 159hotspare_clone_002_pos_head() 160{ 161 atf_set "descr" "'zpool detach <pool> <vdev> ...' against basic vdev should do no harm to clone." 162 atf_set "require.progs" zfs zpool sum 163 atf_set "timeout" 3600 164} 165hotspare_clone_002_pos_body() 166{ 167 . $(atf_get_srcdir)/../../include/default.cfg 168 . $(atf_get_srcdir)/hotspare.kshlib 169 . $(atf_get_srcdir)/hotspare.cfg 170 171 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 172 ksh93 $(atf_get_srcdir)/hotspare_clone_002_pos.ksh || atf_fail "Testcase failed" 173} 174hotspare_clone_002_pos_cleanup() 175{ 176 . $(atf_get_srcdir)/../../include/default.cfg 177 . $(atf_get_srcdir)/hotspare.kshlib 178 . $(atf_get_srcdir)/hotspare.cfg 179 180 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 181} 182 183 184atf_test_case hotspare_create_001_neg cleanup 185hotspare_create_001_neg_head() 186{ 187 atf_set "descr" "'zpool create [-f]' with hot spares should be failedwith inapplicable scenarios." 188 atf_set "require.progs" dumpadm zpool 189 atf_set "timeout" 3600 190} 191hotspare_create_001_neg_body() 192{ 193 . $(atf_get_srcdir)/../../include/default.cfg 194 . $(atf_get_srcdir)/hotspare.kshlib 195 . $(atf_get_srcdir)/hotspare.cfg 196 197 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 198 ksh93 $(atf_get_srcdir)/hotspare_create_001_neg.ksh || atf_fail "Testcase failed" 199} 200hotspare_create_001_neg_cleanup() 201{ 202 . $(atf_get_srcdir)/../../include/default.cfg 203 . $(atf_get_srcdir)/hotspare.kshlib 204 . $(atf_get_srcdir)/hotspare.cfg 205 206 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 207} 208 209 210atf_test_case hotspare_detach_001_pos cleanup 211hotspare_detach_001_pos_head() 212{ 213 atf_set "descr" "'zpool detach <pool> <vdev> ...' should deactivate the spared-in hot spare device successfully." 214 atf_set "require.progs" zpool 215 atf_set "timeout" 3600 216} 217hotspare_detach_001_pos_body() 218{ 219 . $(atf_get_srcdir)/../../include/default.cfg 220 . $(atf_get_srcdir)/hotspare.kshlib 221 . $(atf_get_srcdir)/hotspare.cfg 222 223 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 224 ksh93 $(atf_get_srcdir)/hotspare_detach_001_pos.ksh || atf_fail "Testcase failed" 225} 226hotspare_detach_001_pos_cleanup() 227{ 228 . $(atf_get_srcdir)/../../include/default.cfg 229 . $(atf_get_srcdir)/hotspare.kshlib 230 . $(atf_get_srcdir)/hotspare.cfg 231 232 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 233} 234 235 236atf_test_case hotspare_detach_002_pos cleanup 237hotspare_detach_002_pos_head() 238{ 239 atf_set "descr" "'zpool detach <pool> <vdev> ...' against a functioning device that have spared should take the hot spare permanently swapping in successfully." 240 atf_set "require.progs" zpool 241 atf_set "timeout" 3600 242} 243hotspare_detach_002_pos_body() 244{ 245 . $(atf_get_srcdir)/../../include/default.cfg 246 . $(atf_get_srcdir)/hotspare.kshlib 247 . $(atf_get_srcdir)/hotspare.cfg 248 249 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 250 ksh93 $(atf_get_srcdir)/hotspare_detach_002_pos.ksh || atf_fail "Testcase failed" 251} 252hotspare_detach_002_pos_cleanup() 253{ 254 . $(atf_get_srcdir)/../../include/default.cfg 255 . $(atf_get_srcdir)/hotspare.kshlib 256 . $(atf_get_srcdir)/hotspare.cfg 257 258 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 259} 260 261 262atf_test_case hotspare_detach_003_pos cleanup 263hotspare_detach_003_pos_head() 264{ 265 atf_set "descr" "'zpool replace <pool> <vdev> <ndev>' against a functioning device that have spared should complete and the hot spare should return to available." 266 atf_set "require.progs" zpool 267 atf_set "timeout" 3600 268} 269hotspare_detach_003_pos_body() 270{ 271 . $(atf_get_srcdir)/../../include/default.cfg 272 . $(atf_get_srcdir)/hotspare.kshlib 273 . $(atf_get_srcdir)/hotspare.cfg 274 275 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 276 ksh93 $(atf_get_srcdir)/hotspare_detach_003_pos.ksh || atf_fail "Testcase failed" 277} 278hotspare_detach_003_pos_cleanup() 279{ 280 . $(atf_get_srcdir)/../../include/default.cfg 281 . $(atf_get_srcdir)/hotspare.kshlib 282 . $(atf_get_srcdir)/hotspare.cfg 283 284 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 285} 286 287 288atf_test_case hotspare_detach_004_pos cleanup 289hotspare_detach_004_pos_head() 290{ 291 atf_set "descr" "'zpool replace <pool> <vdev> <ndev>' against a hot spare device that have been activated should successful while the another dev is a available hot spare." 292 atf_set "require.progs" zpool 293 atf_set "timeout" 3600 294} 295hotspare_detach_004_pos_body() 296{ 297 . $(atf_get_srcdir)/../../include/default.cfg 298 . $(atf_get_srcdir)/hotspare.kshlib 299 . $(atf_get_srcdir)/hotspare.cfg 300 301 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 302 ksh93 $(atf_get_srcdir)/hotspare_detach_004_pos.ksh || atf_fail "Testcase failed" 303} 304hotspare_detach_004_pos_cleanup() 305{ 306 . $(atf_get_srcdir)/../../include/default.cfg 307 . $(atf_get_srcdir)/hotspare.kshlib 308 . $(atf_get_srcdir)/hotspare.cfg 309 310 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 311} 312 313 314atf_test_case hotspare_detach_005_neg cleanup 315hotspare_detach_005_neg_head() 316{ 317 atf_set "descr" "'zpool detach <pool> <vdev>' against a hot spare device that NOT activated should fail and issue an error message." 318 atf_set "require.progs" zpool 319 atf_set "timeout" 3600 320} 321hotspare_detach_005_neg_body() 322{ 323 . $(atf_get_srcdir)/../../include/default.cfg 324 . $(atf_get_srcdir)/hotspare.kshlib 325 . $(atf_get_srcdir)/hotspare.cfg 326 327 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 328 ksh93 $(atf_get_srcdir)/hotspare_detach_005_neg.ksh || atf_fail "Testcase failed" 329} 330hotspare_detach_005_neg_cleanup() 331{ 332 . $(atf_get_srcdir)/../../include/default.cfg 333 . $(atf_get_srcdir)/hotspare.kshlib 334 . $(atf_get_srcdir)/hotspare.cfg 335 336 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 337} 338 339 340atf_test_case hotspare_export_001_neg cleanup 341hotspare_export_001_neg_head() 342{ 343 atf_set "descr" "export pool that using shared hotspares will fail" 344 atf_set "require.progs" zpool 345 atf_set "timeout" 3600 346} 347hotspare_export_001_neg_body() 348{ 349 . $(atf_get_srcdir)/../../include/default.cfg 350 . $(atf_get_srcdir)/hotspare.kshlib 351 . $(atf_get_srcdir)/hotspare.cfg 352 353 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 354 ksh93 $(atf_get_srcdir)/hotspare_export_001_neg.ksh || atf_fail "Testcase failed" 355} 356hotspare_export_001_neg_cleanup() 357{ 358 . $(atf_get_srcdir)/../../include/default.cfg 359 . $(atf_get_srcdir)/hotspare.kshlib 360 . $(atf_get_srcdir)/hotspare.cfg 361 362 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 363} 364 365 366atf_test_case hotspare_import_001_pos cleanup 367hotspare_import_001_pos_head() 368{ 369 atf_set "descr" "'zpool export/import <pool>' should runs successfully regardless the hotspare is only in list, activated, or offline." 370 atf_set "require.progs" zpool sum 371 atf_set "timeout" 3600 372} 373hotspare_import_001_pos_body() 374{ 375 . $(atf_get_srcdir)/../../include/default.cfg 376 . $(atf_get_srcdir)/hotspare.kshlib 377 . $(atf_get_srcdir)/hotspare.cfg 378 379 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 380 ksh93 $(atf_get_srcdir)/hotspare_import_001_pos.ksh || atf_fail "Testcase failed" 381} 382hotspare_import_001_pos_cleanup() 383{ 384 . $(atf_get_srcdir)/../../include/default.cfg 385 . $(atf_get_srcdir)/hotspare.kshlib 386 . $(atf_get_srcdir)/hotspare.cfg 387 388 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 389} 390 391 392atf_test_case hotspare_onoffline_003_neg cleanup 393hotspare_onoffline_003_neg_head() 394{ 395 atf_set "descr" "'zpool offline/online <pool> <vdev>' should fail on inactive spares" 396 atf_set "require.progs" zpool zdb 397 atf_set "timeout" 3600 398} 399hotspare_onoffline_003_neg_body() 400{ 401 . $(atf_get_srcdir)/../../include/default.cfg 402 . $(atf_get_srcdir)/hotspare.kshlib 403 . $(atf_get_srcdir)/hotspare.cfg 404 405 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 406 ksh93 $(atf_get_srcdir)/hotspare_onoffline_003_neg.ksh || atf_fail "Testcase failed" 407} 408hotspare_onoffline_003_neg_cleanup() 409{ 410 . $(atf_get_srcdir)/../../include/default.cfg 411 . $(atf_get_srcdir)/hotspare.kshlib 412 . $(atf_get_srcdir)/hotspare.cfg 413 414 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 415} 416 417 418atf_test_case hotspare_onoffline_004_neg cleanup 419hotspare_onoffline_004_neg_head() 420{ 421 atf_set "descr" "'zpool offline/online <pool> <vdev>' against a spared basic vdev during I/O completes." 422 atf_set "require.progs" zfs zpool zdb 423 atf_set "timeout" 3600 424} 425hotspare_onoffline_004_neg_body() 426{ 427 . $(atf_get_srcdir)/../../include/default.cfg 428 . $(atf_get_srcdir)/hotspare.kshlib 429 . $(atf_get_srcdir)/hotspare.cfg 430 431 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 432 ksh93 $(atf_get_srcdir)/hotspare_onoffline_004_neg.ksh || atf_fail "Testcase failed" 433} 434hotspare_onoffline_004_neg_cleanup() 435{ 436 . $(atf_get_srcdir)/../../include/default.cfg 437 . $(atf_get_srcdir)/hotspare.kshlib 438 . $(atf_get_srcdir)/hotspare.cfg 439 440 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 441} 442 443 444atf_test_case hotspare_remove_001_pos cleanup 445hotspare_remove_001_pos_head() 446{ 447 atf_set "descr" "'zpool remove <pool> <vdev> ...' can remove spare device from the pool." 448 atf_set "require.progs" zpool 449 atf_set "timeout" 3600 450} 451hotspare_remove_001_pos_body() 452{ 453 . $(atf_get_srcdir)/../../include/default.cfg 454 . $(atf_get_srcdir)/hotspare.kshlib 455 . $(atf_get_srcdir)/hotspare.cfg 456 457 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 458 ksh93 $(atf_get_srcdir)/hotspare_remove_001_pos.ksh || atf_fail "Testcase failed" 459} 460hotspare_remove_001_pos_cleanup() 461{ 462 . $(atf_get_srcdir)/../../include/default.cfg 463 . $(atf_get_srcdir)/hotspare.kshlib 464 . $(atf_get_srcdir)/hotspare.cfg 465 466 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 467} 468 469 470atf_test_case hotspare_remove_002_neg cleanup 471hotspare_remove_002_neg_head() 472{ 473 atf_set "descr" "'zpool remove <pool> <vdev> ...' should fail with inapplicable scenarios." 474 atf_set "require.progs" zpool 475 atf_set "timeout" 3600 476} 477hotspare_remove_002_neg_body() 478{ 479 . $(atf_get_srcdir)/../../include/default.cfg 480 . $(atf_get_srcdir)/hotspare.kshlib 481 . $(atf_get_srcdir)/hotspare.cfg 482 483 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 484 ksh93 $(atf_get_srcdir)/hotspare_remove_002_neg.ksh || atf_fail "Testcase failed" 485} 486hotspare_remove_002_neg_cleanup() 487{ 488 . $(atf_get_srcdir)/../../include/default.cfg 489 . $(atf_get_srcdir)/hotspare.kshlib 490 . $(atf_get_srcdir)/hotspare.cfg 491 492 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 493} 494 495 496atf_test_case hotspare_remove_003_neg cleanup 497hotspare_remove_003_neg_head() 498{ 499 atf_set "descr" "Executing 'zpool remove' with bad options fails" 500 atf_set "require.progs" zpool 501 atf_set "timeout" 3600 502} 503hotspare_remove_003_neg_body() 504{ 505 . $(atf_get_srcdir)/../../include/default.cfg 506 . $(atf_get_srcdir)/hotspare.kshlib 507 . $(atf_get_srcdir)/hotspare.cfg 508 509 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 510 ksh93 $(atf_get_srcdir)/hotspare_remove_003_neg.ksh || atf_fail "Testcase failed" 511} 512hotspare_remove_003_neg_cleanup() 513{ 514 . $(atf_get_srcdir)/../../include/default.cfg 515 . $(atf_get_srcdir)/hotspare.kshlib 516 . $(atf_get_srcdir)/hotspare.cfg 517 518 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 519} 520 521 522atf_test_case hotspare_remove_004_pos cleanup 523hotspare_remove_004_pos_head() 524{ 525 atf_set "descr" "'zpool remove <pool> <vdev> ...' can remove spare device from the pool." 526 atf_set "require.progs" zpool 527 atf_set "timeout" 3600 528} 529hotspare_remove_004_pos_body() 530{ 531 . $(atf_get_srcdir)/../../include/default.cfg 532 . $(atf_get_srcdir)/hotspare.kshlib 533 . $(atf_get_srcdir)/hotspare.cfg 534 535 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 536 ksh93 $(atf_get_srcdir)/hotspare_remove_004_pos.ksh || atf_fail "Testcase failed" 537} 538hotspare_remove_004_pos_cleanup() 539{ 540 . $(atf_get_srcdir)/../../include/default.cfg 541 . $(atf_get_srcdir)/hotspare.kshlib 542 . $(atf_get_srcdir)/hotspare.cfg 543 544 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 545} 546 547 548atf_test_case hotspare_replace_001_neg cleanup 549hotspare_replace_001_neg_head() 550{ 551 atf_set "descr" "'zpool replace <pool> <odev> <ndev>' should fail with inapplicable scenarios." 552 atf_set "require.progs" zpool 553 atf_set "timeout" 3600 554} 555hotspare_replace_001_neg_body() 556{ 557 . $(atf_get_srcdir)/../../include/default.cfg 558 . $(atf_get_srcdir)/hotspare.kshlib 559 . $(atf_get_srcdir)/hotspare.cfg 560 561 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 562 ksh93 $(atf_get_srcdir)/hotspare_replace_001_neg.ksh || atf_fail "Testcase failed" 563} 564hotspare_replace_001_neg_cleanup() 565{ 566 . $(atf_get_srcdir)/../../include/default.cfg 567 . $(atf_get_srcdir)/hotspare.kshlib 568 . $(atf_get_srcdir)/hotspare.cfg 569 570 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 571} 572 573 574atf_test_case hotspare_replace_002_neg cleanup 575hotspare_replace_002_neg_head() 576{ 577 atf_set "descr" "'zpool replace <pool> <odev> <ndev>' should fail while the hot spares smaller than the basic vdev." 578 atf_set "require.progs" zpool 579 atf_set "timeout" 3600 580} 581hotspare_replace_002_neg_body() 582{ 583 . $(atf_get_srcdir)/../../include/default.cfg 584 . $(atf_get_srcdir)/hotspare.kshlib 585 . $(atf_get_srcdir)/hotspare.cfg 586 587 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 588 ksh93 $(atf_get_srcdir)/hotspare_replace_002_neg.ksh || atf_fail "Testcase failed" 589} 590hotspare_replace_002_neg_cleanup() 591{ 592 . $(atf_get_srcdir)/../../include/default.cfg 593 . $(atf_get_srcdir)/hotspare.kshlib 594 . $(atf_get_srcdir)/hotspare.cfg 595 596 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 597} 598 599 600atf_test_case hotspare_scrub_001_pos cleanup 601hotspare_scrub_001_pos_head() 602{ 603 atf_set "descr" "'zpool scrub <pool>' should runs successfully regardlessthe hotspare is only in list or activated." 604 atf_set "require.progs" zpool 605 atf_set "timeout" 3600 606} 607hotspare_scrub_001_pos_body() 608{ 609 . $(atf_get_srcdir)/../../include/default.cfg 610 . $(atf_get_srcdir)/hotspare.kshlib 611 . $(atf_get_srcdir)/hotspare.cfg 612 613 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 614 ksh93 $(atf_get_srcdir)/hotspare_scrub_001_pos.ksh || atf_fail "Testcase failed" 615} 616hotspare_scrub_001_pos_cleanup() 617{ 618 . $(atf_get_srcdir)/../../include/default.cfg 619 . $(atf_get_srcdir)/hotspare.kshlib 620 . $(atf_get_srcdir)/hotspare.cfg 621 622 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 623} 624 625 626atf_test_case hotspare_scrub_002_pos cleanup 627hotspare_scrub_002_pos_head() 628{ 629 atf_set "descr" "'zpool scrub' scans spare vdevs" 630 atf_set "require.progs" zpool 631} 632hotspare_scrub_002_pos_body() 633{ 634 . $(atf_get_srcdir)/../../include/default.cfg 635 . $(atf_get_srcdir)/hotspare.kshlib 636 . $(atf_get_srcdir)/hotspare.cfg 637 638 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 639 ksh93 $(atf_get_srcdir)/hotspare_scrub_002_pos.ksh || atf_fail "Testcase failed" 640} 641hotspare_scrub_002_pos_cleanup() 642{ 643 . $(atf_get_srcdir)/../../include/default.cfg 644 . $(atf_get_srcdir)/hotspare.kshlib 645 . $(atf_get_srcdir)/hotspare.cfg 646 647 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 648} 649 650 651atf_test_case hotspare_shared_001_pos cleanup 652hotspare_shared_001_pos_head() 653{ 654 atf_set "descr" "'zpool add <pool> spare <vdev> ...' can add a disk as a shared spare to multiple pools." 655 atf_set "require.progs" zpool 656 atf_set "timeout" 3600 657} 658hotspare_shared_001_pos_body() 659{ 660 . $(atf_get_srcdir)/../../include/default.cfg 661 . $(atf_get_srcdir)/hotspare.kshlib 662 . $(atf_get_srcdir)/hotspare.cfg 663 664 verify_disk_count "$DISKS" 5 665 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 666 ksh93 $(atf_get_srcdir)/hotspare_shared_001_pos.ksh || atf_fail "Testcase failed" 667} 668hotspare_shared_001_pos_cleanup() 669{ 670 . $(atf_get_srcdir)/../../include/default.cfg 671 . $(atf_get_srcdir)/hotspare.kshlib 672 . $(atf_get_srcdir)/hotspare.cfg 673 674 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 675} 676 677 678atf_test_case hotspare_snapshot_001_pos cleanup 679hotspare_snapshot_001_pos_head() 680{ 681 atf_set "descr" "'zpool detach <pool> <vdev> ...' against hotspare should do no harm to snapshot." 682 atf_set "require.progs" zfs zpool sum 683 atf_set "timeout" 3600 684} 685hotspare_snapshot_001_pos_body() 686{ 687 . $(atf_get_srcdir)/../../include/default.cfg 688 . $(atf_get_srcdir)/hotspare.kshlib 689 . $(atf_get_srcdir)/hotspare.cfg 690 691 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 692 ksh93 $(atf_get_srcdir)/hotspare_snapshot_001_pos.ksh || atf_fail "Testcase failed" 693} 694hotspare_snapshot_001_pos_cleanup() 695{ 696 . $(atf_get_srcdir)/../../include/default.cfg 697 . $(atf_get_srcdir)/hotspare.kshlib 698 . $(atf_get_srcdir)/hotspare.cfg 699 700 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 701} 702 703 704atf_test_case hotspare_snapshot_002_pos cleanup 705hotspare_snapshot_002_pos_head() 706{ 707 atf_set "descr" "'zpool detach <pool> <vdev> ...' against basic vdev do no harm to snapshot." 708 atf_set "require.progs" zfs zpool sum 709 atf_set "timeout" 3600 710} 711hotspare_snapshot_002_pos_body() 712{ 713 . $(atf_get_srcdir)/../../include/default.cfg 714 . $(atf_get_srcdir)/hotspare.kshlib 715 . $(atf_get_srcdir)/hotspare.cfg 716 717 ksh93 $(atf_get_srcdir)/setup.ksh || atf_fail "Setup failed" 718 ksh93 $(atf_get_srcdir)/hotspare_snapshot_002_pos.ksh || atf_fail "Testcase failed" 719} 720hotspare_snapshot_002_pos_cleanup() 721{ 722 . $(atf_get_srcdir)/../../include/default.cfg 723 . $(atf_get_srcdir)/hotspare.kshlib 724 . $(atf_get_srcdir)/hotspare.cfg 725 726 ksh93 $(atf_get_srcdir)/cleanup.ksh || atf_fail "Cleanup failed" 727} 728 729 730atf_init_test_cases() 731{ 732 733 atf_add_test_case hotspare_add_001_pos 734 atf_add_test_case hotspare_add_002_pos 735 atf_add_test_case hotspare_add_003_neg 736 atf_add_test_case hotspare_add_004_neg 737 atf_add_test_case hotspare_clone_001_pos 738 atf_add_test_case hotspare_clone_002_pos 739 atf_add_test_case hotspare_create_001_neg 740 atf_add_test_case hotspare_detach_001_pos 741 atf_add_test_case hotspare_detach_002_pos 742 atf_add_test_case hotspare_detach_003_pos 743 atf_add_test_case hotspare_detach_004_pos 744 atf_add_test_case hotspare_detach_005_neg 745 atf_add_test_case hotspare_export_001_neg 746 atf_add_test_case hotspare_import_001_pos 747 atf_add_test_case hotspare_onoffline_003_neg 748 atf_add_test_case hotspare_onoffline_004_neg 749 atf_add_test_case hotspare_remove_001_pos 750 atf_add_test_case hotspare_remove_002_neg 751 atf_add_test_case hotspare_remove_003_neg 752 atf_add_test_case hotspare_remove_004_pos 753 atf_add_test_case hotspare_replace_001_neg 754 atf_add_test_case hotspare_replace_002_neg 755 atf_add_test_case hotspare_scrub_001_pos 756 atf_add_test_case hotspare_scrub_002_pos 757 atf_add_test_case hotspare_shared_001_pos 758 atf_add_test_case hotspare_snapshot_001_pos 759 atf_add_test_case hotspare_snapshot_002_pos 760} 761