# Run ATVM Automation Guide This file is guide-only documentation for operating ATVM CMC automation. Do not put specific run examples here. For reusable command examples and common option combinations, use `examples.md`. Treat `examples.md` as reference-only. Do not assume the operator wants the extra options shown in examples unless they explicitly request them. ## Purpose Run ATVM CMC automation tests on the designated automation VM without unintended system or file changes. ## ATVM Cypress Automation Controller Client - Hostname: `atvm-cypres-vm-1` - IP: `192.168.3.190` - Credentials: source `/home/aw/code/cds/.env.credentials.local` and use `ATVM_CONTROLLER_USER` plus `ATVM_CONTROLLER_PASSWORD` ## ATVM Target Host Default - Treat `192.168.3.191` as the default ATVM target host reference. - For SSH to `192.168.3.191`, ignore host key mismatch by default with `-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null`. - For Linux SSH access to `192.168.3.191`, source `/home/aw/code/cds/.env.credentials.local` and use `ATVM_TARGET_USER` plus `ATVM_TARGET_PASSWORD` unless the operator explicitly overrides them. - `ATVM_LINUX_TARGET_HOST`, `ATVM_LINUX_TARGET_USER`, and `ATVM_LINUX_TARGET_PASSWORD` mirror the Linux default values when an OS-specific reference is clearer. - For Windows guest access to `192.168.3.191`, source `/home/aw/code/cds/.env.credentials.local` and use `ATVM_WINDOWS_TARGET_USER` plus `ATVM_WINDOWS_TARGET_PASSWORD` unless the operator explicitly overrides them. ## Operating Constraints - Run only scripts/commands explicitly requested. - Do not make manual system configuration changes on the client. - Do not edit client files unless explicitly requested. ## Operator Preferences - Do not include Gold Disk identifiers in `--build_name`. - `--build_name` must not contain spaces; use `-` between words. - For multiple VMs in same distro, use distro-scoped filtering (`--containsVm`) instead of long explicit VM lists. - Always include `--ignore_force_shutdown` on `cmc-templates.py` commands unless the operator explicitly asks not to. - Always include `--test_partition` on `cmc-templates.py` commands unless the operator explicitly asks not to. - Default plugin-bearing templates to `--use_specified_plugin iscsi` unless the operator explicitly requests a different plugin. - Do not add plugin or integration-type arguments to `cmc-systemOS`; that template should be planned without `--use_specified_plugin`, without `--integration_type`, and without watcher integration/plugin metadata. - For `cmc-migrateops-compute-migration` to VMware, default to `--vm_platforms vmware` and `--set_static_ip_dest` unless the operator explicitly says otherwise. - For `cmc-reboot`, treat `--use_specified_plugin both` as an exception case that requires an extra confirmation. - When `cmc-reboot` is planned with `--use_specified_plugin both`, warn that FC+iSCSI together may hit a "chicken before the egg" timing problem where iSCSI disks are not attached before mTDI / CMC services start. - For `cmc-reboot`, prefer `--use_specified_plugin fc` or `--use_specified_plugin iscsi` unless the operator explicitly reconfirms that `both` is really intended after seeing that warning. - Before preparing a new run, always check whether automation is already running. - Always report whether automation is currently running. - If running, ask whether to terminate; terminate only with explicit approval. - After termination approval, terminate first, then present planned command(s), then wait for separate execution approval. - Before any run, always show exact planned command(s) exactly as they will be executed and wait for explicit approval. - Never execute `cmc-templates.py`, `run-sorry-cypress.py`, or any other ATVM run command until the operator explicitly approves the displayed command(s). - Approval is required even for preparation-only steps such as template generation. - If the operator changes any part of the request after commands are displayed, rebuild the commands, show the updated commands, and wait for fresh approval before executing anything. - Execute ATVM run commands only after explicit approval. - Treat `approve` as approval to run and also start the per-run watcher service for that build. - Treat `approve without watcher` as approval to execute the ATVM run without starting the watcher. - When `--categorize` is used with watcher enabled, treat the watcher as a sequential grouped-run watcher: - it must post one final Mattermost status per completed categorized group/sub-run - it must stay active between grouped sub-runs while the parent categorized request is still running - it must not stop after the first grouped run simply because one grouped run completed - if the child build id label does not match the actual host/spec being executed, report the grouped run using the inferred host-based group instead of the raw child build id label - it must not wait and replace those with one single parent-only post - After execution, report immediate success/failure only. - Do not include expected, harmless `systemctl reset-failed ... unit not loaded` output in routine run-start confirmations. - Mention `reset-failed` output only when it prevents watcher startup or becomes relevant to debugging. - Do not actively monitor completion unless explicitly requested. - If monitoring is requested, allow long runtime windows (15-30+ minutes) and continue until completion unless operator instructs otherwise. - Report command errors immediately. - `sshpass` may be used where password-based SSH automation is required. ## Core Scripts - Template prep: `/root/cdc-e2e-cyp-12.17.4/cmc-templates.py` - Test execution: `./run-sorry-cypress.py` - Detailed host-level test artifacts: `/root/cdc-e2e-cyp-12.17.4/cypress/cmcReporter` ## Detailed Test Artifacts - Use `/root/cdc-e2e-cyp-12.17.4/cypress/cmcReporter` on the automation controller for detailed per-host test evidence. - Reporter subdirectories of interest: - `logs/` - per-host text and JSON logs for the executed tests - `xml/` - machine result XML files and the final `check-xml-files.ts` bookkeeping output - `mochawesome/` - per-run HTML reports - When a machine fails, use the matching `logs/` entry first to capture the detailed failure context for that host. - Apply the failed-host detail recovery path to every ATVM template type, not just reboot. - For any failed host, recover detail in this order when available: - consolidated run log - matching `mochawesome` HTML - structured reporter artifacts such as per-host JSON or XML - text reporter artifacts - When reconstructing historical status, prefer `cmcReporter` artifacts over less-specific runner output because they preserve per-host results after the live run has ended. - Do not treat the existence of a per-host reporter artifact by itself as proof that the host passed. - For categorized grouped recovery, prefer the matching per-host reporter JSON or mochawesome result and carry through the real `failures`, `pending`, and failure message instead of assuming `PASS completed`. - If grouped XML only contains `check-xml-files.ts`, cross-check the grouped result against the per-host reporter artifacts before posting or repeating status for that grouped sub-run. - Treat saved watcher state under `/var/lib/atvm-run-watcher//state.json` as cached status only. - For completed-run verification, confirm in this order: - launch log under `/tmp/.launch.log` - matching `cmcReporter` artifacts - `Cloud Run Finished` summary and Currents URL - saved watcher state only as a comparison layer - If saved watcher state disagrees with the launch log or with a replay of the exact artifacts through the current watcher code, treat the saved state as stale and do not use it as the reported result. - Never confirm a completed run from `state.json` alone. Typical sequence: 1. Build the exact `cmc-templates.py` and `run-sorry-cypress.py` commands for the request. 2. Show those exact commands to the operator. 3. Wait for explicit approval. 4. Run `cmc-templates.py` with the approved options. 5. Wait for `cmc-templates.py` to fully finish and confirm success. 6. Verify the generated `.ts` files and the config `specPattern` include every requested VM before starting the runner. 7. If the watcher is approved, make sure the controller's deployed watcher code is the intended version before relying on its posts. 8. If the watcher is approved, build the watcher-start command so it automatically includes the exact approved `cmc-templates.py` command via `--template-command` and the exact approved `run-sorry-cypress.py` command via `--runner-command`. 9. If the watcher is approved, prefer the controller-local `atvm-runner@...` systemd service instead of detached SSH background launch patterns for `run-sorry-cypress.py`. 10. If the watcher is approved, start the watcher before launching the runner service. 11. Start the runner with the matching approved config and build name. Completed-run verification sequence: 1. Read the launch log for the build. 2. Inspect the matching reporter artifacts for the relevant host(s). 3. Use the `Cloud Run Finished` summary and Currents URL as the final parent-run check when present. 4. Compare that result against saved watcher state. 5. If there is any disagreement, replay the exact artifacts through the current watcher code in an isolated temp state directory before confirming the result. ## Config File / Gold Disk Mapping - `cypress.atvm-config-gold.ts` -> Gold Disk 1 - `cypress.atvm-config-gold-2.ts` -> Gold Disk 2 - Additional numbered config variants map to corresponding Gold Disks. - Do not default to `cypress.atvm-config.ts`. - Unless the operator explicitly requests another config, use a config file with `gold` in the filename. - If the operator-specified config file is missing, stop immediately and report the missing file. - Do not search for substitute ATVM config files and do not switch to another config unless the operator explicitly instructs it. ## Available Templates - `cmc-e2e` - `cmc-group-consistency` - `cmc-h2h-diff-platf` - `cmc-h2h-same-platf` - `cmc-migrateops` - `cmc-migrateops-compute-migration` - `cmc-reboot` - `cmc-systemOS` ## Command Pattern ```bash python3 cmc-templates.py --template