Check the installed verson when extension has patch version#4432
Check the installed verson when extension has patch version#4432lubaihua33 wants to merge 1 commit intomainfrom
Conversation
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
There was a problem hiding this comment.
Pull request overview
This PR improves Azure VM extension version validation for pre-publish scenarios where an extension version may be provided as Major.Minor.Patch, while Azure deployment APIs only accept Major.Minor for typeHandlerVersion. It adds helper logic to normalize requested versions for installation and (optionally) validate the installed patch version via VM extension instance view.
Changes:
- Added version parsing/normalization and installed-version lookup helpers to
AzureExtension. - Updated
verify_vm_extension_install_uninstallto install using normalizedMajor.Minorwhile validating installedMajor.Minor.Patchwhen requested.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| lisa/sut_orchestrator/azure/features.py | Add helpers to normalize typeHandlerVersion input and retrieve installed extension version from instance view. |
| lisa/microsoft/testsuites/vm_extensions/generic_vm_extension.py | Use normalization for install and assert installed patch version when a patch version is requested. |
c4dfcaf to
74bff72
Compare
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
74bff72 to
97ada11
Compare
| def get_installed_type_handler_version(self, name: str) -> str: | ||
| extension_obj = self.get(name=name) | ||
|
|
There was a problem hiding this comment.
get_installed_type_handler_version() ultimately makes an Azure SDK call via self.get(). The Azure common module documents using global_credential_access_lock around SDK calls to avoid auth-file access conflicts in parallel runs. Consider wrapping the self.get(...) call (or the underlying SDK call) with global_credential_access_lock to align with that pattern and reduce intermittent failures under parallel execution.
| f"'{version}', actual '{installed_version}'. Please double confirm if " | ||
| f"the Azure platform supports {installed_version}" |
There was a problem hiding this comment.
The assertion message reads a bit unclear/grammatically off ("double confirm") and doesn’t give a concrete next step beyond "platform supports". Consider rephrasing to something like: verify which patch version Azure delivers for the requested Major.Minor and check the extension’s published versions in this region; include the expected/actual values once.
| f"'{version}', actual '{installed_version}'. Please double confirm if " | |
| f"the Azure platform supports {installed_version}" | |
| f"'{version}', actual '{installed_version}'. Verify which patch " | |
| f"version Azure delivers for the requested major.minor version and " | |
| f"check whether this extension version is published in the current " | |
| f"region." |
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
97ada11 to
691c431
Compare
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
691c431 to
6624f91
Compare
6624f91 to
be44310
Compare
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
be44310 to
936d7bd
Compare
✅ AI Test Selection — PASSED1 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
Description
When installing a VM extension using the Python SDK or an ARM template, there is only a single parameter available for version control: typeHandlerVersion. This parameter only supports the Major.Minor format. However, for the pre-publish validation scenario, the version is in Major.Minor.Patch format.
Azure platform has the following behavior:
Customers are only able to specify the Major.Minor version during deployment of an extension. When AutoUpgradeMinorVersion is set "True", then the platform will deliver the latest Minor.Patch.Hotfix version of that Major version. If this value is set to "False" then the platform will deliver the latest Patch.Hotfix of the Major.Minor pair.
This PR adds a check for the installed version if the extension version passed in the case is Major.Minor.Patch format. From the response of GET VM extension, we can get the installed version from the instance_view.type_handler_version. Then check if the installed version same as the expected version. If yes, then the case is passed. If not, the case is failed.
Related Issue
Type of Change
Checklist
Test Validation
Test for the following runbooks:
variable:
value: "Microsoft.Azure.Monitor"
is_case_visible: true
value: "AzureMonitorLinuxAgent"
is_case_visible: true
value: "1.7.1"
is_case_visible: true
variable:
value: "Microsoft.Azure.Monitor"
is_case_visible: true
value: "AzureMonitorLinuxAgent"
is_case_visible: true
value: "1.7"
is_case_visible: true
variable:
value: "Microsoft.Azure.Monitor"
is_case_visible: true
value: "AzureMonitorLinuxAgent"
is_case_visible: true
value: "1.7.0"
is_case_visible: true
Key Test Cases:
verify_vm_extension_install_uninstall
Impacted LISA Features:
VM Extension
Tested Azure Marketplace Images:
-Canonical 0001-com-ubuntu-server-focal 20_04-lts-gen2 latest
Test Results