1#!/bin/sh 2# $FreeBSD$ 3 4dir=`dirname $0` 5. ${dir}/../../misc.sh 6 7echo "1..141" 8 9disks_create 11 10names_create 2 11 12expect_ok ${ZPOOL} create ${name0} ${disk0} 13expect_ok ${ZPOOL} export ${name0} 14expect_ok ${ZPOOL} create ${name1} ${disk1} 15exp=`( 16 echo "invalid vdev specification" 17 echo "use '-f' to override the following errors:" 18 echo "${fdisk0} is part of exported pool '${name0}'" 19)` 20expect "${exp}" ${ZPOOL} attach ${name1} ${disk1} ${disk0} 21exp=`( 22 echo " pool: ${name1}" 23 echo " state: ONLINE" 24 echo " scrub: none requested" 25 echo "config:" 26 echo " NAME STATE READ WRITE CKSUM" 27 echo " ${name1} ONLINE 0 0 0" 28 echo " ${disk1} ONLINE 0 0 0" 29 echo "errors: No known data errors" 30)` 31expect "${exp}" ${ZPOOL} status ${name1} 32expect_ok ${ZPOOL} attach -f ${name1} ${disk1} ${disk0} 33wait_for_resilver ${name1} 34exp=`( 35 echo " pool: ${name1}" 36 echo " state: ONLINE" 37 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 38 echo "config:" 39 echo " NAME STATE READ WRITE CKSUM" 40 echo " ${name1} ONLINE 0 0 0" 41 echo " mirror ONLINE 0 0 0" 42 echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 43 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 44 echo "errors: No known data errors" 45)` 46expect "${exp}" ${ZPOOL} status ${name1} 47expect_ok ${ZPOOL} destroy ${name1} 48 49expect_ok ${ZPOOL} create ${name0} ${disk0} 50expect_ok ${ZPOOL} export ${name0} 51expect_ok ${ZPOOL} create ${name1} mirror ${disk1} ${disk2} 52exp=`( 53 echo "invalid vdev specification" 54 echo "use '-f' to override the following errors:" 55 echo "${fdisk0} is part of exported pool '${name0}'" 56)` 57expect "${exp}" ${ZPOOL} attach ${name1} ${disk1} ${disk0} 58exp=`( 59 echo " pool: ${name1}" 60 echo " state: ONLINE" 61 echo " scrub: none requested" 62 echo "config:" 63 echo " NAME STATE READ WRITE CKSUM" 64 echo " ${name1} ONLINE 0 0 0" 65 echo " mirror ONLINE 0 0 0" 66 echo " ${disk1} ONLINE 0 0 0" 67 echo " ${disk2} ONLINE 0 0 0" 68 echo "errors: No known data errors" 69)` 70expect "${exp}" ${ZPOOL} status ${name1} 71expect_ok ${ZPOOL} attach -f ${name1} ${disk1} ${disk0} 72wait_for_resilver ${name1} 73exp=`( 74 echo " pool: ${name1}" 75 echo " state: ONLINE" 76 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 77 echo "config:" 78 echo " NAME STATE READ WRITE CKSUM" 79 echo " ${name1} ONLINE 0 0 0" 80 echo " mirror ONLINE 0 0 0" 81 echo " ${disk1} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 82 echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 83 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 84 echo "errors: No known data errors" 85)` 86expect "${exp}" ${ZPOOL} status ${name1} 87expect_ok ${ZPOOL} destroy ${name1} 88 89expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0} 90expect_ok ${ZPOOL} export ${name0} 91expect_ok ${ZPOOL} create ${name1} ${disk3} log ${disk4} 92exp=`( 93 echo "invalid vdev specification" 94 echo "use '-f' to override the following errors:" 95 echo "${fdisk0} is part of exported pool '${name0}'" 96)` 97expect "${exp}" ${ZPOOL} attach ${name1} ${disk4} ${disk0} 98exp=`( 99 echo " pool: ${name1}" 100 echo " state: ONLINE" 101 echo " scrub: none requested" 102 echo "config:" 103 echo " NAME STATE READ WRITE CKSUM" 104 echo " ${name1} ONLINE 0 0 0" 105 echo " ${disk3} ONLINE 0 0 0" 106 echo " logs ONLINE 0 0 0" 107 echo " ${disk4} ONLINE 0 0 0" 108 echo "errors: No known data errors" 109)` 110expect "${exp}" ${ZPOOL} status ${name1} 111expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0} 112wait_for_resilver ${name1} 113exp=`( 114 echo " pool: ${name1}" 115 echo " state: ONLINE" 116 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 117 echo "config:" 118 echo " NAME STATE READ WRITE CKSUM" 119 echo " ${name1} ONLINE 0 0 0" 120 echo " ${disk3} ONLINE 0 0 0" 121 echo " logs ONLINE 0 0 0" 122 echo " mirror ONLINE 0 0 0" 123 echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 124 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 125 echo "errors: No known data errors" 126)` 127expect "${exp}" ${ZPOOL} status ${name1} 128expect_ok ${ZPOOL} destroy ${name1} 129expect_ok ${ZPOOL} import ${name0} 130expect_ok ${ZPOOL} destroy ${name0} 131 132expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0} 133expect_ok ${ZPOOL} export ${name0} 134expect_ok ${ZPOOL} create ${name1} ${disk3} log mirror ${disk4} ${disk5} 135exp=`( 136 echo "invalid vdev specification" 137 echo "use '-f' to override the following errors:" 138 echo "${fdisk0} is part of exported pool '${name0}'" 139)` 140expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 141exp=`( 142 echo " pool: ${name1}" 143 echo " state: ONLINE" 144 echo " scrub: none requested" 145 echo "config:" 146 echo " NAME STATE READ WRITE CKSUM" 147 echo " ${name1} ONLINE 0 0 0" 148 echo " ${disk3} ONLINE 0 0 0" 149 echo " logs ONLINE 0 0 0" 150 echo " mirror ONLINE 0 0 0" 151 echo " ${disk4} ONLINE 0 0 0" 152 echo " ${disk5} ONLINE 0 0 0" 153 echo "errors: No known data errors" 154)` 155expect "${exp}" ${ZPOOL} status ${name1} 156expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0} 157wait_for_resilver ${name1} 158exp=`( 159 echo " pool: ${name1}" 160 echo " state: ONLINE" 161 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 162 echo "config:" 163 echo " NAME STATE READ WRITE CKSUM" 164 echo " ${name1} ONLINE 0 0 0" 165 echo " ${disk3} ONLINE 0 0 0" 166 echo " logs ONLINE 0 0 0" 167 echo " mirror ONLINE 0 0 0" 168 echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 169 echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 170 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 171 echo "errors: No known data errors" 172)` 173expect "${exp}" ${ZPOOL} status ${name1} 174expect_ok ${ZPOOL} destroy ${name1} 175expect_ok ${ZPOOL} import ${name0} 176expect_ok ${ZPOOL} destroy ${name0} 177 178expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0} 179expect_ok ${ZPOOL} export ${name0} 180expect_ok ${ZPOOL} create ${name1} ${disk2} 181exp=`( 182 echo "invalid vdev specification" 183 echo "use '-f' to override the following errors:" 184 echo "${fdisk0} is part of exported pool '${name0}'" 185)` 186add_msg="# TODO It shouldn't be possible to use offlined cache vdevs." 187expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 188exp=`( 189 echo " pool: ${name1}" 190 echo " state: ONLINE" 191 echo " scrub: none requested" 192 echo "config:" 193 echo " NAME STATE READ WRITE CKSUM" 194 echo " ${name1} ONLINE 0 0 0" 195 echo " ${disk2} ONLINE 0 0 0" 196 echo "errors: No known data errors" 197)` 198expect "${exp}" ${ZPOOL} status ${name1} 199expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0} 200add_msg="" 201wait_for_resilver ${name1} 202exp=`( 203 echo " pool: ${name1}" 204 echo " state: ONLINE" 205 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 206 echo "config:" 207 echo " NAME STATE READ WRITE CKSUM" 208 echo " ${name1} ONLINE 0 0 0" 209 echo " mirror ONLINE 0 0 0" 210 echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 211 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 212 echo "errors: No known data errors" 213)` 214expect "${exp}" ${ZPOOL} status ${name1} 215expect_ok ${ZPOOL} destroy ${name1} 216expect_ok ${ZPOOL} import ${name0} 217expect_ok ${ZPOOL} destroy ${name0} 218 219expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} 220expect_ok ${ZPOOL} offline ${name0} ${disk0} 221expect_ok ${ZPOOL} export ${name0} 222expect_ok ${ZPOOL} create ${name1} ${disk2} 223exp=`( 224 echo "invalid vdev specification" 225 echo "use '-f' to override the following errors:" 226 echo "${fdisk0} is part of potentially active pool '${name0}'" 227)` 228expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 229exp=`( 230 echo " pool: ${name1}" 231 echo " state: ONLINE" 232 echo " scrub: none requested" 233 echo "config:" 234 echo " NAME STATE READ WRITE CKSUM" 235 echo " ${name1} ONLINE 0 0 0" 236 echo " ${disk2} ONLINE 0 0 0" 237 echo "errors: No known data errors" 238)` 239expect "${exp}" ${ZPOOL} status ${name1} 240expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0} 241wait_for_resilver ${name1} 242exp=`( 243 echo " pool: ${name1}" 244 echo " state: ONLINE" 245 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 246 echo "config:" 247 echo " NAME STATE READ WRITE CKSUM" 248 echo " ${name1} ONLINE 0 0 0" 249 echo " mirror ONLINE 0 0 0" 250 echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 251 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 252 echo "errors: No known data errors" 253)` 254expect "${exp}" ${ZPOOL} status ${name1} 255expect_ok ${ZPOOL} destroy ${name1} 256expect_ok ${ZPOOL} import ${name0} 257expect_ok ${ZPOOL} destroy ${name0} 258 259expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} 260expect_ok ${ZPOOL} offline ${name0} ${disk0} 261expect_ok ${ZPOOL} export ${name0} 262expect_ok ${ZPOOL} create ${name1} mirror ${disk2} ${disk3} 263exp=`( 264 echo "invalid vdev specification" 265 echo "use '-f' to override the following errors:" 266 echo "${fdisk0} is part of potentially active pool '${name0}'" 267)` 268expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 269exp=`( 270 echo " pool: ${name1}" 271 echo " state: ONLINE" 272 echo " scrub: none requested" 273 echo "config:" 274 echo " NAME STATE READ WRITE CKSUM" 275 echo " ${name1} ONLINE 0 0 0" 276 echo " mirror ONLINE 0 0 0" 277 echo " ${disk2} ONLINE 0 0 0" 278 echo " ${disk3} ONLINE 0 0 0" 279 echo "errors: No known data errors" 280)` 281expect "${exp}" ${ZPOOL} status ${name1} 282expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0} 283wait_for_resilver ${name1} 284exp=`( 285 echo " pool: ${name1}" 286 echo " state: ONLINE" 287 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 288 echo "config:" 289 echo " NAME STATE READ WRITE CKSUM" 290 echo " ${name1} ONLINE 0 0 0" 291 echo " mirror ONLINE 0 0 0" 292 echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 293 echo " ${disk3} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 294 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 295 echo "errors: No known data errors" 296)` 297expect "${exp}" ${ZPOOL} status ${name1} 298expect_ok ${ZPOOL} destroy ${name1} 299expect_ok ${ZPOOL} import ${name0} 300expect_ok ${ZPOOL} destroy ${name0} 301 302expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0} 303expect_ok ${ZPOOL} offline ${name0} ${disk0} 304expect_ok ${ZPOOL} export ${name0} 305expect_ok ${ZPOOL} create ${name1} ${disk3} log ${disk4} 306exp=`( 307 echo "invalid vdev specification" 308 echo "use '-f' to override the following errors:" 309 echo "${fdisk0} is part of potentially active pool '${name0}'" 310)` 311expect "${exp}" ${ZPOOL} attach ${name1} ${disk4} ${disk0} 312exp=`( 313 echo " pool: ${name1}" 314 echo " state: ONLINE" 315 echo " scrub: none requested" 316 echo "config:" 317 echo " NAME STATE READ WRITE CKSUM" 318 echo " ${name1} ONLINE 0 0 0" 319 echo " ${disk3} ONLINE 0 0 0" 320 echo " logs ONLINE 0 0 0" 321 echo " ${disk4} ONLINE 0 0 0" 322 echo "errors: No known data errors" 323)` 324expect "${exp}" ${ZPOOL} status ${name1} 325expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0} 326wait_for_resilver ${name1} 327exp=`( 328 echo " pool: ${name1}" 329 echo " state: ONLINE" 330 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 331 echo "config:" 332 echo " NAME STATE READ WRITE CKSUM" 333 echo " ${name1} ONLINE 0 0 0" 334 echo " ${disk3} ONLINE 0 0 0" 335 echo " logs ONLINE 0 0 0" 336 echo " mirror ONLINE 0 0 0" 337 echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 338 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 339 echo "errors: No known data errors" 340)` 341expect "${exp}" ${ZPOOL} status ${name1} 342expect_ok ${ZPOOL} destroy ${name1} 343expect_ok ${ZPOOL} import ${name0} 344expect_ok ${ZPOOL} destroy ${name0} 345 346expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0} 347expect_ok ${ZPOOL} offline ${name0} ${disk0} 348expect_ok ${ZPOOL} export ${name0} 349expect_ok ${ZPOOL} create ${name1} ${disk3} log mirror ${disk4} ${disk5} 350exp=`( 351 echo "invalid vdev specification" 352 echo "use '-f' to override the following errors:" 353 echo "${fdisk0} is part of potentially active pool '${name0}'" 354)` 355expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 356exp=`( 357 echo " pool: ${name1}" 358 echo " state: ONLINE" 359 echo " scrub: none requested" 360 echo "config:" 361 echo " NAME STATE READ WRITE CKSUM" 362 echo " ${name1} ONLINE 0 0 0" 363 echo " ${disk3} ONLINE 0 0 0" 364 echo " logs ONLINE 0 0 0" 365 echo " mirror ONLINE 0 0 0" 366 echo " ${disk4} ONLINE 0 0 0" 367 echo " ${disk5} ONLINE 0 0 0" 368 echo "errors: No known data errors" 369)` 370expect "${exp}" ${ZPOOL} status ${name1} 371expect_ok ${ZPOOL} attach -f ${name1} ${disk4} ${disk0} 372wait_for_resilver ${name1} 373exp=`( 374 echo " pool: ${name1}" 375 echo " state: ONLINE" 376 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 377 echo "config:" 378 echo " NAME STATE READ WRITE CKSUM" 379 echo " ${name1} ONLINE 0 0 0" 380 echo " ${disk3} ONLINE 0 0 0" 381 echo " logs ONLINE 0 0 0" 382 echo " mirror ONLINE 0 0 0" 383 echo " ${disk4} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 384 echo " ${disk5} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 385 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 386 echo "errors: No known data errors" 387)` 388expect "${exp}" ${ZPOOL} status ${name1} 389expect_ok ${ZPOOL} destroy ${name1} 390expect_ok ${ZPOOL} import ${name0} 391expect_ok ${ZPOOL} destroy ${name0} 392 393expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0} 394expect_ok ${ZPOOL} offline ${name0} ${disk0} 395expect_ok ${ZPOOL} export ${name0} 396expect_ok ${ZPOOL} create ${name1} ${disk2} 397exp=`( 398 echo "invalid vdev specification" 399 echo "use '-f' to override the following errors:" 400 echo "${fdisk0} is part of potentially active pool '${name0}'" 401)` 402add_msg="# TODO It shouldn't be possible to use offlined cache vdevs." 403expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 404exp=`( 405 echo " pool: ${name1}" 406 echo " state: ONLINE" 407 echo " scrub: none requested" 408 echo "config:" 409 echo " NAME STATE READ WRITE CKSUM" 410 echo " ${name1} ONLINE 0 0 0" 411 echo " ${disk2} ONLINE 0 0 0" 412 echo "errors: No known data errors" 413)` 414expect "${exp}" ${ZPOOL} status ${name1} 415expect_ok ${ZPOOL} attach -f ${name1} ${disk2} ${disk0} 416add_msg="" 417wait_for_resilver ${name1} 418exp=`( 419 echo " pool: ${name1}" 420 echo " state: ONLINE" 421 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 422 echo "config:" 423 echo " NAME STATE READ WRITE CKSUM" 424 echo " ${name1} ONLINE 0 0 0" 425 echo " mirror ONLINE 0 0 0" 426 echo " ${disk2} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 427 echo " ${disk0} ONLINE 0 0 0( [0-9.]+[A-Z] resilvered)?" 428 echo "errors: No known data errors" 429)` 430expect "${exp}" ${ZPOOL} status ${name1} 431expect_ok ${ZPOOL} destroy ${name1} 432expect_ok ${ZPOOL} import ${name0} 433expect_ok ${ZPOOL} destroy ${name0} 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455expect_ok ${ZPOOL} create ${name0} ${disk0} 456expect_ok ${ZPOOL} create ${name1} ${disk1} 457exp=`( 458 echo "invalid vdev specification" 459 echo "use '-f' to override the following errors:" 460 echo "${fdisk0} is part of active pool '${name0}'" 461)` 462expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 463exp=`( 464 echo " pool: ${name1}" 465 echo " state: ONLINE" 466 echo " scrub: none requested" 467 echo "config:" 468 echo " NAME STATE READ WRITE CKSUM" 469 echo " ${name1} ONLINE 0 0 0" 470 echo " ${disk1} ONLINE 0 0 0" 471 echo "errors: No known data errors" 472)` 473expect "${exp}" ${ZPOOL} status ${name1} 474exp=`( 475 echo "invalid vdev specification" 476 echo "the following errors must be manually repaired:" 477 echo "${fdisk0} is part of active pool '${name0}'" 478)` 479expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk2} ${disk0} 480exp=`( 481 echo " pool: ${name1}" 482 echo " state: ONLINE" 483 echo " scrub: none requested" 484 echo "config:" 485 echo " NAME STATE READ WRITE CKSUM" 486 echo " ${name1} ONLINE 0 0 0" 487 echo " ${disk1} ONLINE 0 0 0" 488 echo "errors: No known data errors" 489)` 490expect "${exp}" ${ZPOOL} status ${name1} 491expect_ok ${ZPOOL} destroy ${name1} 492expect_ok ${ZPOOL} destroy ${name0} 493 494expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} 495expect_ok ${ZPOOL} create ${name1} mirror ${disk2} ${disk3} 496exp=`( 497 echo "invalid vdev specification" 498 echo "use '-f' to override the following errors:" 499 echo "${fdisk0} is part of active pool '${name0}'" 500)` 501expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 502exp=`( 503 echo " pool: ${name1}" 504 echo " state: ONLINE" 505 echo " scrub: none requested" 506 echo "config:" 507 echo " NAME STATE READ WRITE CKSUM" 508 echo " ${name1} ONLINE 0 0 0" 509 echo " mirror ONLINE 0 0 0" 510 echo " ${disk2} ONLINE 0 0 0" 511 echo " ${disk3} ONLINE 0 0 0" 512 echo "errors: No known data errors" 513)` 514expect "${exp}" ${ZPOOL} status ${name1} 515exp=`( 516 echo "invalid vdev specification" 517 echo "the following errors must be manually repaired:" 518 echo "${fdisk0} is part of active pool '${name0}'" 519)` 520expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk2} ${disk0} 521exp=`( 522 echo " pool: ${name1}" 523 echo " state: ONLINE" 524 echo " scrub: none requested" 525 echo "config:" 526 echo " NAME STATE READ WRITE CKSUM" 527 echo " ${name1} ONLINE 0 0 0" 528 echo " mirror ONLINE 0 0 0" 529 echo " ${disk2} ONLINE 0 0 0" 530 echo " ${disk3} ONLINE 0 0 0" 531 echo "errors: No known data errors" 532)` 533expect "${exp}" ${ZPOOL} status ${name1} 534expect_ok ${ZPOOL} destroy ${name1} 535expect_ok ${ZPOOL} destroy ${name0} 536 537expect_ok ${ZPOOL} create ${name0} ${disk1} log ${disk0} 538expect_ok ${ZPOOL} create ${name1} ${disk2} log ${disk3} 539exp=`( 540 echo "invalid vdev specification" 541 echo "use '-f' to override the following errors:" 542 echo "${fdisk0} is part of active pool '${name0}'" 543)` 544expect "${exp}" ${ZPOOL} attach ${name1} ${disk3} ${disk0} 545exp=`( 546 echo " pool: ${name1}" 547 echo " state: ONLINE" 548 echo " scrub: none requested" 549 echo "config:" 550 echo " NAME STATE READ WRITE CKSUM" 551 echo " ${name1} ONLINE 0 0 0" 552 echo " ${disk2} ONLINE 0 0 0" 553 echo " logs ONLINE 0 0 0" 554 echo " ${disk3} ONLINE 0 0 0" 555 echo "errors: No known data errors" 556)` 557expect "${exp}" ${ZPOOL} status ${name1} 558exp=`( 559 echo "invalid vdev specification" 560 echo "the following errors must be manually repaired:" 561 echo "${fdisk0} is part of active pool '${name0}'" 562)` 563expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk3} ${disk0} 564exp=`( 565 echo " pool: ${name1}" 566 echo " state: ONLINE" 567 echo " scrub: none requested" 568 echo "config:" 569 echo " NAME STATE READ WRITE CKSUM" 570 echo " ${name1} ONLINE 0 0 0" 571 echo " ${disk2} ONLINE 0 0 0" 572 echo " logs ONLINE 0 0 0" 573 echo " ${disk3} ONLINE 0 0 0" 574 echo "errors: No known data errors" 575)` 576expect "${exp}" ${ZPOOL} status ${name1} 577expect_ok ${ZPOOL} destroy ${name1} 578expect_ok ${ZPOOL} destroy ${name0} 579 580expect_ok ${ZPOOL} create ${name0} ${disk1} log mirror ${disk2} ${disk0} 581expect_ok ${ZPOOL} create ${name1} ${disk3} log mirror ${disk4} ${disk5} 582exp=`( 583 echo "invalid vdev specification" 584 echo "use '-f' to override the following errors:" 585 echo "${fdisk0} is part of active pool '${name0}'" 586)` 587expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 588exp=`( 589 echo " pool: ${name1}" 590 echo " state: ONLINE" 591 echo " scrub: none requested" 592 echo "config:" 593 echo " NAME STATE READ WRITE CKSUM" 594 echo " ${name1} ONLINE 0 0 0" 595 echo " ${disk3} ONLINE 0 0 0" 596 echo " logs ONLINE 0 0 0" 597 echo " mirror ONLINE 0 0 0" 598 echo " ${disk4} ONLINE 0 0 0" 599 echo " ${disk5} ONLINE 0 0 0" 600 echo "errors: No known data errors" 601)` 602expect "${exp}" ${ZPOOL} status ${name1} 603exp=`( 604 echo "invalid vdev specification" 605 echo "the following errors must be manually repaired:" 606 echo "${fdisk0} is part of active pool '${name0}'" 607)` 608expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk4} ${disk0} 609exp=`( 610 echo " pool: ${name1}" 611 echo " state: ONLINE" 612 echo " scrub: none requested" 613 echo "config:" 614 echo " NAME STATE READ WRITE CKSUM" 615 echo " ${name1} ONLINE 0 0 0" 616 echo " ${disk3} ONLINE 0 0 0" 617 echo " logs ONLINE 0 0 0" 618 echo " mirror ONLINE 0 0 0" 619 echo " ${disk4} ONLINE 0 0 0" 620 echo " ${disk5} ONLINE 0 0 0" 621 echo "errors: No known data errors" 622)` 623expect "${exp}" ${ZPOOL} status ${name1} 624expect_ok ${ZPOOL} destroy ${name1} 625expect_ok ${ZPOOL} destroy ${name0} 626 627expect_ok ${ZPOOL} create ${name0} ${disk1} cache ${disk0} 628expect_ok ${ZPOOL} create ${name1} ${disk2} 629exp=`( 630 echo "invalid vdev specification" 631 echo "use '-f' to override the following errors:" 632 echo "${fdisk0} is part of active pool '${name0}'" 633)` 634add_msg="# TODO It shouldn't be possible to use offlined cache vdevs." 635expect "${exp}" ${ZPOOL} attach ${name1} ${disk2} ${disk0} 636add_msg="" 637exp=`( 638 echo " pool: ${name1}" 639 echo " state: ONLINE" 640 echo " scrub: none requested" 641 echo "config:" 642 echo " NAME STATE READ WRITE CKSUM" 643 echo " ${name1} ONLINE 0 0 0" 644 echo " ${disk2} ONLINE 0 0 0" 645 echo "errors: No known data errors" 646)` 647expect "${exp}" ${ZPOOL} status ${name1} 648add_msg="# TODO It shouldn't be possible to use offlined cache vdevs." 649exp=`( 650 echo "invalid vdev specification" 651 echo "the following errors must be manually repaired:" 652 echo "${fdisk0} is part of active pool '${name0}'" 653)` 654expect "${exp}" ${ZPOOL} attach -f ${name1} ${disk2} ${disk0} 655add_msg="" 656exp=`( 657 echo " pool: ${name1}" 658 echo " state: ONLINE" 659 echo " scrub: none requested" 660 echo "config:" 661 echo " NAME STATE READ WRITE CKSUM" 662 echo " ${name1} ONLINE 0 0 0" 663 echo " ${disk2} ONLINE 0 0 0" 664 echo "errors: No known data errors" 665)` 666expect "${exp}" ${ZPOOL} status ${name1} 667expect_ok ${ZPOOL} destroy ${name1} 668expect_ok ${ZPOOL} destroy ${name0} 669 670disks_destroy 671