Repository navigation
[SCVMM] Clear retained machine kind before VM deletion - #10385
xingf-msft wants to merge 9 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi xingf-msft, |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution xingf-msft! We will review the pull request and get back to you soon. |
|
SCVMM |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Cover the retained-machine clear/relink lifecycle in the existing scenario with explicitly labeled synthetic HTTP contract fixtures. Exercise real SDK response deserialization and cleanup retry behavior, and clarify partial-success recovery guidance. Live service-side kind clearing remains unverified. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
|
/azp run |
|
Commenter does not have sufficient privileges for PR 10385 in repo Azure/azure-cli-extensions |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Restore the original recording and remove added HybridCompute GET/state assertions. Isolate the cleanup client only during historical playback of the two delete commands; recording/live execution, production cleanup and CLI contract unit coverage remain unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Remove the additional standalone VM deletion test suite rather than introducing another test structure. Keep the existing scenario and its historical-playback dependency isolation; production cleanup and recorded interactions are unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Remove the playback-only client mock helper and restore the original self.cmd deletion calls. The test tree and cassette now match the base branch. The new production cleanup requests still require an authentic recording before scenario playback can pass; do not fabricate responses or mask the missing interactions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
Remove the added long summary and recovery example. Keep the established short-summary and examples pattern; the remaining PR is limited to kind cleanup, its release notes and the extension version. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Handle retained-machine kind cleanup before the VMI request, including --no-wait, following the existing create flow. Preserve delete-machine behavior; propagate HCRP failures before starting VMI deletion and do not roll back cleanup if the VMI operation later fails. Remove the skip warning and update the release note without changing help or tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Discard the machine update return value as create-from-machines does. Continue VMI deletion when the SDK call returns normally and preserve SDK exception propagation; remove the additional kind postcondition and its exception import. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
Hi Ethan Yang (@necusjz) , I just finalize the change for this pr. Sorry I was raising this as draft at first stage. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add an authentic recording or equivalent isolated test covering the new GET, PATCH, and deletion ordering.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Updates az scvmm vm delete to clear the retained HybridCompute machine kind before deleting the VM instance.
Changes:
- Added parent-machine GET/PATCH cleanup before VMI deletion.
- Bumped the extension version to 1.2.2.
- Documented the behavior change in release history.
| File | Summary |
|---|---|
src/scvmm/setup.py |
Updates the extension version. |
src/scvmm/HISTORY.rst |
Documents the new deletion behavior. |
src/scvmm/azext_scvmm/custom.py |
Clears the machine kind before VMI deletion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Read the retained HybridCompute machine after each existing VM delete and assert its kind is empty. Reuse the current scenario without a new test suite, client mocks or synthetic HTTP recordings. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5197fc05-89af-40ce-b80f-4097f81d506c
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
@microsoft-github-policy-service agree company="Microsoft" |
|
Please fix CI issues |

🤖 PR Validation — ️✔️ All clear
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az scvmm vm deleteSummary
This is the SCVMM offboarding CLI update for
az scvmm vm delete. It supports removing SCVMM management from a VM while retaining the parentMicrosoft.HybridCompute/machinesresource for Azure Arc-enabled Servers.Request clearing of the retained HybridCompute machine's top-level SCVMM
kindbefore starting VMI deletion.--no-waitstill sends the update and only disables VMI polling. As increate-from-machines, themachine_client.update()return value is ignored: normal return proceeds to VMI deletion, while SDK exceptions propagate. No additional returned-kind check or custom exception is introduced. Later VMI failures are reported without rolling back the earlier update;--delete-machinepaths remain unchanged.The existing
test_scvmmscenario now reads the retained HybridCompute machine after each of its two delete commands and asserts thatkindis null or empty. This covers ordinary offboarding and--delete-from-hostwithout adding a test file, helper or client mock. Production logic is unchanged by this test update. Help and the original HTTP cassette remain unchanged.Recording update still required. The original cassette lacks the new cleanup interactions. No live Azure PATCH or DELETE was performed; a normal SDK return is not independent verification that the service changed kind.
Related
Validation
azdev style scvmm: pylint and flake8 passed;git diff --checkis clean.General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install azdevrequired)For new extensions:
N/A: existing extension.
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.