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