Skip to content

CSTACKEX-207: Automation for snapshot and revert for VM and CS-volume - #122

Open
sathvikaragi wants to merge 1 commit into
mainfrom
automation/CSTACKEX-207
Open

sathvikaragi wants to merge 1 commit into
mainfrom
automation/CSTACKEX-207

Conversation

@sathvikaragi

@sathvikaragi sathvikaragi commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR...

Test cases added :
This PR adds steps 07–21 and 23 to the ONTAP VM + volume suites for both NFS3 (nfs3/instance/test_vm_volume_attach.py) and iSCSI (iscsi/instance/test_vm_volume_attach.py). Each suite goes from 10 to 26 tests. The old detach and cleanup steps are renumbered to 22 and 24.

The guest checks use SSH (guest_ssh.py, Paramiko) to write and read marker files on ROOT and DATA. Every snapshot is also checked against a new FlexVol snapshot on ONTAP.

Guest access

07: SSH into the VM and write markers on ROOT and DATA.
Volume snapshots

08 / 09: Snapshot ROOT and DATA on a running VM (VS-01, VS-03).
10: Reverting while the VM is running is rejected (VS-19 for NFS, VS-20 for iSCSI).
11 / 12: Revert ROOT and DATA on a stopped VM; the earlier marker comes back (VS-11 for NFS, VS-12 for iSCSI).
VM snapshots

13 / 14: Take a VM snapshot while the VM is running, then another while it is stopped (VMS-01, VMS-03).
15: Revert to each of those two snapshots in turn (VMS-09).
16: Two snapshot requests for the same VM at the same time (VMS-53).
Two VMs on one pool

17: Deploy a second VM with its ROOT disk on the same ONTAP pool.
18: Reverting one VM leaves the other VM's data alone (VS-28).
19: VM snapshots of both VMs at the same time (VMS-54 for NFS, VMS-55 for iSCSI).
20 / 21: A snapshot on one VM while the other VM reverts, first with volume snapshots and then with VM snapshots.
23: Expunge a VM that still has a VM snapshot; its FlexVol snapshot is removed (VMS-38).
Supporting changes: guest_ssh.py, a paramiko>=3.4,<4 pin in setup_env.sh, and updated README.md and TEST_CASES.md. The catalog now lists 106 tests in total.

Result: Both suites passed 26/26 on the lab.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Screenshot 2026-10-14 at 3 33 52 PM Screenshot 2026-10-14 at 4 09 48 PM

How did you try to break this feature and the system with this change?

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.84%
Branch coverage 19.00%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

06 Start VM — LUN-map is re-created on ONTAP
07 Detach data volume from running VM — LUN-map removed
08 Destroy VM (cache LUN still survives), delete data volume, delete pool
07 Open an SSH port forward to the VM; write ROOT and DATA files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is 07 needed?

10 Revert a volume snapshot while the VM is Running — rejected
11 ROOT volume revert: write before-snapshot, snapshot, write
after-snapshot, revert, file is back to before-snapshot
12 DATA volume revert: same write, snapshot, write, revert check

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snapshot behaviour shouldn't change between ROOT and DATA disk, so, 12 should be enough. Let me know if you feel otherwise.

18 Revert VM-A's ROOT; VM-B's file is unchanged
19 VM snapshots of both VMs at the same time
20 Volume snapshot of VM-A while VM-B's ROOT reverts
21 VM snapshot of VM-A while VM-B reverts to its VM snapshot

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this different from 20?

fi

echo "==> Pinning paramiko<4 (CentOS 5.5 guest sshd only offers SHA-1 kex and ssh-rsa)"
if ! "${PIP}" install "paramiko>=3.4,<4"; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we are importing more dependencies, its time to create a 'requirements.txt' file with proper package versions

06 Start the VM — VM Running; volume still attached; FlexVol online
07 Detach the ONTAP data volume from the VM
08 Destroy VM (cache still survives); delete ONTAP volume; enter
07 Open an SSH port forward to the VM; write ROOT and DATA files

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments as in the iSCSI test file


ONTAP_MIN_VOLUME_SIZE = 1677721600
# ROOT + DATA disks of two VMs plus FlexVol snapshot reserve
DEFAULT_POOL_SIZE = 50 * 1024 ** 3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before calling this test ideally pool size should be properly set in ontap.cfg, while a default size should exist in case ontap.cfg has pool size empty.
Check if any such configurable variables are being hardcoded in the test files instead of being read from ontap.cfg?

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


Tests must run in order (test_01, test_02, test_03, test_03a, test_03b,
test_04 ... test_08). Each step builds on the shared state established by the
test_04 ... test_24). Each step builds on the shared state established by the

@suryag1201 suryag1201 Oct 16, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are missing, plz add
Revert to an older volume snapshot that is not the latest one.
Delete a volume/VM snapshot while the VM still exists

# ------------------------------------------------------------------

@attr(tags=[TAG], required_hardware=True)
def test_23_destroy_vm_with_vm_snapshot(self):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VM-A's data and its FlexVol snapshots must still be there. The test only checks that VM-B's own snapshot is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants