Skip to content

Commit fcdb970

Browse files
committed
CSTACKEX-207: Automation for snapshot and revert for VM and CS-volume
1 parent c037cd9 commit fcdb970

8 files changed

Lines changed: 1886 additions & 44 deletions

File tree

‎test/integration/plugins/ontap/README.md‎

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ for the deployment, health-gate, and artifact contracts.
4343
test/integration/plugins/ontap/
4444
├── ontap.cfg # Environment config (IPs, credentials, zone info)
4545
├── ontap_test_base.py # Shared base class and ONTAP REST client
46-
├── TEST_CASES.md # Full test case reference table (72 tests)
46+
├── guest_ssh.py # Guest SSH (paramiko) for the VM workflow suites
47+
├── setup_env.sh # venv: Marvin, pyvmomi, paramiko<4
48+
├── TEST_CASES.md # Full test case reference table (106 tests)
4749
├── README.md # This file
4850
│
4951
├── nfs3/
@@ -122,6 +124,39 @@ python3 -m pip install --user \
122124
python3 -c "import marvin; print('Marvin OK')"
123125
```
124126

127+
The VM workflow suites also need a venv with pinned dependencies. From the repo root:
128+
129+
```bash
130+
bash test/integration/plugins/ontap/setup_env.sh
131+
```
132+
133+
The script is safe to re-run. It creates `test/integration/plugins/ontap/.venv` when that directory is missing, then installs into it:
134+
135+
- Marvin (from `MARVIN_ARCHIVE` when set, otherwise from `tools/marvin` after generating `commands.xml`)
136+
- `pyvmomi==8.0.2.0.1` (pyvmomi 9.x needs Python 3.10+)
137+
- `paramiko>=3.4,<4`
138+
139+
`run_tests.sh` uses that venv automatically.
140+
141+
#### Paramiko (guest SSH)
142+
143+
`nfs3/instance/test_vm_volume_attach.py` and `iscsi/instance/test_vm_volume_attach.py` log into the guest through `guest_ssh.py`. The lab template is CentOS 5.5, and its sshd only offers SHA-1 key exchange (`diffie-hellman-group14-sha1`) and `ssh-rsa` host keys. Paramiko 4.x removed SHA-1, so those logins fail unless the venv has Paramiko 3.x.
144+
145+
`setup_env.sh` installs the pin:
146+
147+
```bash
148+
test/integration/plugins/ontap/.venv/bin/pip install "paramiko>=3.4,<4"
149+
```
150+
151+
`guest_ssh.check_paramiko()` checks for `diffie-hellman-group14-sha1` before the first guest connection and tells you to re-run `setup_env.sh` when the active interpreter has Paramiko 4. Guest login itself comes from `ontap.cfg` (`cloudstack.templateUsername` / `cloudstack.templatePassword`).
152+
153+
Confirm the venv before a VM workflow run:
154+
155+
```bash
156+
test/integration/plugins/ontap/.venv/bin/python -c \
157+
"import paramiko; print(paramiko.__version__); assert 'diffie-hellman-group14-sha1' in paramiko.Transport._kex_info"
158+
```
159+
125160
---
126161

127162
## Configuration — `ontap.cfg`
@@ -334,13 +369,13 @@ self.assertEqual(result.state, "Maintenance")
334369
| NFS3 Pool with Volumes | `nfs3/pool/test_pool_with_volumes.py` | 7 | Same + live volume present; negative delete guard |
335370
| NFS3 Zone-Scoped Pool | `nfs3/pool/test_zone_scoped_pool.py` | 4 | Zone scope — all hosts connected via `attachZone` |
336371
| NFS3 Volume Lifecycle | `nfs3/volume/test_volume_lifecycle.py` | 5 | Volume is metadata-only; FlexVol unchanged on delete |
337-
| NFS3 VM + Volume Attach | `nfs3/instance/test_vm_volume_attach.py` | 10 | Full VM lifecycle with hot-plug/detach; ROOT on tagged pool seeds/reuses template cache, which survives VM delete |
372+
| NFS3 VM + Volume Attach | `nfs3/instance/test_vm_volume_attach.py` | 26 | Full VM lifecycle with hot-plug/detach, guest SSH, volume and VM snapshots; ROOT on tagged pool seeds/reuses template cache, which survives VM delete |
338373
| NFS3 Template Cache Negative | `nfs3/template/test_template_cache_negative.py` | 3 | Tag mismatch; undersized pool; out-of-band cache delete |
339374
| iSCSI Pool Lifecycle | `iscsi/pool/test_pool_lifecycle.py` | 8 | Create, disable, enable, maintenance, delete + igroups |
340375
| iSCSI Pool with Volumes | `iscsi/pool/test_pool_with_volumes.py` | 7 | Same + live LUN present; negative delete guard |
341376
| iSCSI Zone-Scoped Pool | `iscsi/pool/test_zone_scoped_pool.py` | 4 | Zone scope |
342377
| iSCSI Volume Lifecycle | `iscsi/volume/test_volume_lifecycle.py` | 5 | LUN created per CS volume; LUN removed on delete |
343-
| iSCSI VM + Volume Attach | `iscsi/instance/test_vm_volume_attach.py` | 10 | Full VM lifecycle; LUN-maps on VM start/stop/detach; ROOT on tagged pool seeds/reuses `cs_tmpl_*` LUN cache |
378+
| iSCSI VM + Volume Attach | `iscsi/instance/test_vm_volume_attach.py` | 26 | Full VM lifecycle; LUN-maps on VM start/stop/detach; guest SSH, volume and VM snapshots; ROOT on tagged pool seeds/reuses `cs_tmpl_*` LUN cache |
344379
| iSCSI Template Cache Negative | `iscsi/template/test_template_cache_negative.py` | 3 | Tag mismatch; undersized pool; out-of-band cache delete |
345380

346381
For the goal, dependencies, and exact success criteria of every individual test, see [TEST_CASES.md](TEST_CASES.md).
@@ -351,12 +386,13 @@ For the goal, dependencies, and exact success criteria of every individual test,
351386

352387
| Symptom | Likely cause | Fix |
353388
|---------|-------------|-----|
389+
| `paramiko … has no SHA-1 key exchange` / guest SSH fails on CentOS 5.5 | Paramiko 4.x is installed; the guest sshd only offers SHA-1 | Re-run `bash test/integration/plugins/ontap/setup_env.sh` and run tests with `test/integration/plugins/ontap/.venv` (`paramiko>=3.4,<4`) |
354390
| `ModuleNotFoundError: No module named 'ontap_test_base'` | Missing `PYTHONPATH` prefix | Prefix every run with `PYTHONPATH=test/integration/plugins/ontap` |
355391
| `Marvin Init Failed` | CloudStack API unreachable | Check `mgtSvrIp:8096` is reachable; restart `cloudstack-management` |
356392
| `Lost connection to MySQL` | MySQL not accepting remote connections | Enable remote MySQL access (see Prerequisites §3) |
357393
| `sh: python: command not found` (repeated) | Marvin internal call — harmless on macOS | Ignore; Marvin Init still succeeds |
358394
| Pool state never reaches `Maintenance` | KVM agent not responding | Check `cloudstack-agent` on KVM host; verify host is connected in CloudStack UI |
359-
| iSCSI `test_07` error 530 | KVM guest does not ACK SCSI hot-unplug | Known environment limitation — see TEST_CASES.md Suite 10 note |
395+
| iSCSI `test_22` error 530 | KVM guest does not ACK SCSI hot-unplug | Detach of the data LUN from a running VM; see TEST_CASES.md Suite 10 `test_22_detach_volume_from_vm` |
360396
| ONTAP REST `401 Unauthorized` | Wrong credentials in `ontap.cfg` | Verify `username`/`password` under `ontap` section |
361397
| `ISCSI protocol is not enabled on SVM` / many pool tests EXCEPTION then FAIL | SVM iSCSI service off or no `data_iscsi` LIF | Enable iSCSI on the SVM and assign `default-data-iscsi` (or `default-data-blocks`) to at least one data LIF; `run_tests.sh` now fails this check before Marvin starts |
362398
| `No ready KVM user template available` | Template still downloading | Re-run `setup_zone` (step 12 waits for template readiness); or wait in CloudStack UI |

0 commit comments

Comments
 (0)