|
12 | 12 | invalid_size2: none |
13 | 13 | unused_disk_subfact: '{{ ansible_devices[unused_disks[0]] }}' |
14 | 14 | too_large_size: '{{ unused_disk_subfact.sectors | int * 1.2 * 512 }}' |
| 15 | + acc_large_size: '{{ unused_disk_subfact.sectors | int * 1.015 * 512 }}' |
| 16 | + acc_small_size: '{{ unused_disk_subfact.sectors | int * 0.985 * 512 }}' |
15 | 17 | disk_size: '{{ unused_disk_subfact.sectors | int * 512 }}' |
16 | 18 | tags: |
17 | 19 | - tests::lvm |
|
129 | 131 | - name: Verify role results |
130 | 132 | include_tasks: verify-role-results.yml |
131 | 133 |
|
| 134 | + - name: Test for correct handling of acceptable size difference (slightly bigger than max) |
| 135 | + block: |
| 136 | + - name: >- |
| 137 | + Try to resize LVM volume size to disk size + 1.5 % (less than 2 % than |
| 138 | + maximum size should be tolerated) |
| 139 | + include_role: |
| 140 | + name: linux-system-roles.storage |
| 141 | + vars: |
| 142 | + storage_pools: |
| 143 | + - name: foo |
| 144 | + disks: "{{ unused_disks }}" |
| 145 | + volumes: |
| 146 | + - name: test1 |
| 147 | + fs_type: ext4 |
| 148 | + size: "{{ acc_large_size }}" |
| 149 | + mount_point: "{{ mount_location }}" |
| 150 | +
|
| 151 | + - name: Verify role results |
| 152 | + include_tasks: verify-role-results.yml |
| 153 | + |
132 | 154 | - name: Test for correct handling of invalid size specification |
133 | 155 | include_tasks: verify-role-failed.yml |
134 | 156 | vars: |
|
428 | 450 |
|
429 | 451 | - name: Verify role results |
430 | 452 | include_tasks: verify-role-results.yml |
| 453 | + |
| 454 | + # For XFS |
| 455 | + |
| 456 | + - name: Test xfs |
| 457 | + block: |
| 458 | + - name: Run test on supported platforms |
| 459 | + when: ((is_fedora and blivet_pkg_version is version("3.12.1-3", ">=")) or |
| 460 | + (is_rhel8 and blivet_pkg_version is version("3.4.0-1", ">=")) or |
| 461 | + is_rhel9 or is_rhel10) |
| 462 | + block: |
| 463 | + - name: >- |
| 464 | + Create a LVM logical volume with for XFS size |
| 465 | + {{ volume_size_before }} |
| 466 | + include_role: |
| 467 | + name: linux-system-roles.storage |
| 468 | + vars: |
| 469 | + storage_pools: |
| 470 | + - name: foo |
| 471 | + type: lvm |
| 472 | + disks: "{{ unused_disks }}" |
| 473 | + volumes: |
| 474 | + - name: test1 |
| 475 | + fs_type: xfs |
| 476 | + size: "{{ volume_size_before }}" |
| 477 | + mount_point: "{{ mount_location }}" |
| 478 | +
|
| 479 | + - name: Verify role results |
| 480 | + include_tasks: verify-role-results.yml |
| 481 | + |
| 482 | + - name: Change volume size to {{ volume_size_after }} |
| 483 | + include_role: |
| 484 | + name: linux-system-roles.storage |
| 485 | + vars: |
| 486 | + storage_pools: |
| 487 | + - name: foo |
| 488 | + type: lvm |
| 489 | + disks: "{{ unused_disks }}" |
| 490 | + volumes: |
| 491 | + - name: test1 |
| 492 | + fs_type: xfs |
| 493 | + size: "{{ volume_size_after }}" |
| 494 | + mount_point: "{{ mount_location }}" |
| 495 | + |
| 496 | + - name: Verify role results |
| 497 | + include_tasks: verify-role-results.yml |
| 498 | + |
| 499 | + - name: Repeat for idempotency test |
| 500 | + include_role: |
| 501 | + name: linux-system-roles.storage |
| 502 | + vars: |
| 503 | + storage_pools: |
| 504 | + - name: foo |
| 505 | + type: lvm |
| 506 | + disks: "{{ unused_disks }}" |
| 507 | + volumes: |
| 508 | + - name: test1 |
| 509 | + fs_type: xfs |
| 510 | + size: "{{ volume_size_after }}" |
| 511 | + mount_point: "{{ mount_location }}" |
| 512 | + |
| 513 | + - name: Verify role results |
| 514 | + include_tasks: verify-role-results.yml |
| 515 | + |
| 516 | + - name: Test for correct handling of shrinking (not supported by XFS) |
| 517 | + include_tasks: verify-role-failed.yml |
| 518 | + vars: |
| 519 | + __storage_failed_regex: volume.+cannot be resized.+ |
| 520 | + __storage_failed_msg: >- |
| 521 | + Unexpected behavior w/ invalid volume size |
| 522 | + __storage_failed_params: |
| 523 | + storage_pools: |
| 524 | + - name: foo |
| 525 | + disks: "{{ unused_disks }}" |
| 526 | + volumes: |
| 527 | + - name: test1 |
| 528 | + fs_type: xfs |
| 529 | + size: "{{ volume_size_before }}" |
| 530 | + mount_point: "{{ mount_location }}" |
| 531 | + |
| 532 | + - name: Test for correct handling of acceptable size difference (slightly smaller than min) |
| 533 | + block: |
| 534 | + - name: >- |
| 535 | + Try to resize LVM volume size to disk size - 1.5 % (less than 2 % than |
| 536 | + minimum size should be tolerated) |
| 537 | + include_role: |
| 538 | + name: linux-system-roles.storage |
| 539 | + vars: |
| 540 | + storage_pools: |
| 541 | + - name: foo |
| 542 | + disks: "{{ unused_disks }}" |
| 543 | + volumes: |
| 544 | + - name: test1 |
| 545 | + fs_type: xfs |
| 546 | + size: "{{ acc_small_size }}" |
| 547 | + mount_point: "{{ mount_location }}" |
| 548 | +
|
| 549 | + - name: Verify role results |
| 550 | + include_tasks: verify-role-results.yml |
| 551 | + |
| 552 | + always: |
| 553 | + - name: Clean up |
| 554 | + include_role: |
| 555 | + name: linux-system-roles.storage |
| 556 | + vars: |
| 557 | + storage_pools: |
| 558 | + - name: foo |
| 559 | + disks: "{{ unused_disks }}" |
| 560 | + state: absent |
| 561 | + volumes: |
| 562 | + - name: test1 |
| 563 | + size: "{{ volume_size_before }}" |
| 564 | + mount_point: "{{ mount_location }}" |
| 565 | + |
| 566 | + - name: Verify role results |
| 567 | + include_tasks: verify-role-results.yml |
0 commit comments