-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Compute] Fix #20174: az vm create: Determine plan information when using image alias
#21028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Compute |
az vm create: Determine plan information when using image alias
|
Hi jepio, |
bbbb4e2 to
aa5dcf3
Compare
|
I've rebased onto the remote dev branch. The test failures look like they test for a hard-coded sequence of remote operations, and would need updating. |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Some marketplace images require plan information to be provided when creating a virtual machine. Missing plan information results in the error message: "Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request." The "Flatcar" alias is one such case where plan information is needed. When an image is provided as a URN, the validator code takes care of determining the plan information and filling it in, but when using an alias no such action is taken. Perform the same lookup when using an alias, so that users can use the alias as intended and don't have to manually supply plan information. Signed-off-by: Jeremi Piotrowski <[email protected]>
aa5dcf3 to
ffbee38
Compare
|
@wangzelin007 OK, now I understand. I updated the dev branch now. |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
Hi @jepio, |
|
OK, how do I re-record the tests? |
| if enable_hibernation is not None: | ||
| vm_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation | ||
| if enable_hibernation is not None: | ||
| vm_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.cmd('vm get-instance-view -n {vm} -g {rg}', checks=[ | ||
| self.check('*.extensions[0].name', ['VMAccessForLinux']), | ||
| self.check('*.extensions[0].typeHandlerVersion', ['1.4.7.1']) | ||
| self.check('*.extensions[0].typeHandlerVersion', ['1.5.11']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| class VMBootDiagnostics(ScenarioTest): | ||
|
|
||
| @AllowLargeResponse() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| vm_properties = {'hardwareProfile': {'vmSize': size, 'vmSizeProperties': vm_size_properties}, | ||
| 'networkProfile': {'networkInterfaces': nics}, 'storageProfile': _build_storage_profile()} | ||
| if vm_size_properties: | ||
| vm_properties['hardwareProfile']['vmSizeProperties'] = vm_size_properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
"details": [
{
"code": "BadRequest",
"message": {
"error": {
"details": [
{
"message": "Could not find member vmSizeProperties on object of type VMHardwareProfile. Path properties.hardwareProfile.vmSizeProperties, line 1, position 110.",
"target": "vm.properties.hardwareProfile.vmSizeProperties"
},
{
"message": "Could not find member additionalCapabilities on object of type Properties. Path properties.additionalCapabilities, line 1, position 1230.",
"target": "vm.properties.additionalCapabilities"
}
],
"code": "BadRequest",
"message": "The request message is invalid."
}
}
}
]
}
}| }) | ||
|
|
||
| self.cmd('vm create -n {vm} -g {rg} --image openSUSE-Leap --admin-username user11 --private-ip-address 10.0.0.5 --public-ip-sku {public_ip_sku} --public-ip-address-dns-name {dns} --generate-ssh-keys') | ||
| self.cmd('vm create -n {vm} -g {rg} --image UbuntuLTS --admin-username user11 --private-ip-address 10.0.0.5 --public-ip-sku {public_ip_sku} --public-ip-address-dns-name {dns} --generate-ssh-keys') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| # verify the default should be "Basic" sku with "Dynamic" allocation method | ||
| self.cmd('vm create -n {vm2} -g {rg} --image openSUSE-Leap --admin-username user11 --generate-ssh-keys') | ||
| self.cmd('vm create -n {vm2} -g {rg} --image UbuntuLTS --admin-username user11 --generate-ssh-keys') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
|
|
||
| class VMSSCreateAndModify(ScenarioTest): | ||
|
|
||
| @AllowLargeResponse() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| 'vmss': 'vmss1' | ||
| }) | ||
| self.cmd("vmss create -n {vmss} -g {rg} --vm-sku Standard_DS4_v2 --image Win2022Datacenter --admin-username clittester --admin-password Test12345678!!! --accelerated-networking --instance-count 1") | ||
| self.cmd("vmss create -n {vmss} -g {rg} --vm-sku Standard_DS4_v2 --image Win2012R2Datacenter --admin-username clittester --admin-password Test12345678!!! --accelerated-networking --instance-count 1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using image Win2022Datacenter is by design for TLS 1.2 compliant, PR link: #20701, I think we need to investigate the reason why this image can no longer be found
| @@ -1077,6 +1077,7 @@ def test_vm_create_none_options(self, resource_group): | |||
|
|
|||
| class VMBootDiagnostics(ScenarioTest): | |||
|
|
|||
| @AllowLargeResponse() | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| @@ -1343,7 +1344,7 @@ def test_vm_create_custom_ip(self, resource_group): | |||
| 'public_ip_sku': 'Standard' | |||
| }) | |||
|
|
|||
| self.cmd('vm create -n {vm} -g {rg} --image openSUSE-Leap --admin-username user11 --private-ip-address 10.0.0.5 --public-ip-sku {public_ip_sku} --public-ip-address-dns-name {dns} --generate-ssh-keys') | |||
| self.cmd('vm create -n {vm} -g {rg} --image UbuntuLTS --admin-username user11 --private-ip-address 10.0.0.5 --public-ip-sku {public_ip_sku} --public-ip-address-dns-name {dns} --generate-ssh-keys') | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| @@ -1354,7 +1355,7 @@ def test_vm_create_custom_ip(self, resource_group): | |||
| checks=self.check('ipConfigurations[0].privateIpAllocationMethod', 'Static')) | |||
|
|
|||
| # verify the default should be "Basic" sku with "Dynamic" allocation method | |||
| self.cmd('vm create -n {vm2} -g {rg} --image openSUSE-Leap --admin-username user11 --generate-ssh-keys') | |||
| self.cmd('vm create -n {vm2} -g {rg} --image UbuntuLTS --admin-username user11 --generate-ssh-keys') | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| @@ -1490,6 +1491,7 @@ def test_vm_create_custom_data(self, resource_group): | |||
|
|
|||
| class VMSSCreateAndModify(ScenarioTest): | |||
|
|
|||
| @AllowLargeResponse() | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| @@ -2130,7 +2132,7 @@ def test_vm_error_on_zone_unavailable(self, resource_group, resource_group_locat | |||
| try: | |||
| self.cmd('vm create -g {rg} -n vm1 --admin-username clitester --admin-password PasswordPassword1! --image debian --zone 1') | |||
| except Exception as ex: | |||
| self.assertTrue('availability zone is not yet supported' in str(ex)) | |||
| self.assertTrue('does not support availability zones at location' in str(ex)) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| @@ -905,6 +905,7 @@ def test_vm_create_existing_ids_options(self, resource_group, storage_account): | |||
|
|
|||
| class VMSSCreateAndModify(ScenarioTest): | |||
|
|
|||
| @AllowLargeResponse() | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| @@ -3992,7 +3992,7 @@ def test_vm_error_on_zone_unavailable(self, resource_group, resource_group_locat | |||
| try: | |||
| self.cmd('vm create -g {rg} -n vm1 --admin-username clitester --admin-password PasswordPassword1! --image debian --zone 1') | |||
| except Exception as ex: | |||
| self.assertTrue('availability zone is not yet supported' in str(ex)) | |||
| self.assertTrue('does not support availability zones at location' in str(ex)) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| @@ -6728,7 +6730,7 @@ def test_vmss_windows_patch_mode(self, resource_group): | |||
| 'rg': resource_group | |||
| }) | |||
|
|
|||
| self.cmd('vmss create -g {rg} -n {vmss} --image Win2022Datacenter --enable-agent --enable-auto-update false --patch-mode Manual --orchestration-mode Flexible --admin-username azureuser --admin-password testPassword0') | |||
| self.cmd('vmss create -g {rg} -n {vmss} --image Win2012Datacenter --enable-agent --enable-auto-update false --patch-mode Manual --orchestration-mode Flexible --admin-username azureuser --admin-password testPassword0') | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| @@ -5367,31 +5367,33 @@ def test_dedicated_host_e2e(self, resource_group, resource_group_location): | |||
| self.cmd('vm delete --name vm2 -g {rg2} --yes') | |||
| self.cmd('vm host delete --name {host-name} --host-group {host-group} -g {rg2} --yes') | |||
|
|
|||
| @ResourceGroupPreparer(name_prefix='cli_test_dedicated_host_', location='westus2') | |||
| @ResourceGroupPreparer(name_prefix='cli_test_dedicated_host3_', location='eastus2') | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Replaced by #21666 |









Description
Some image aliases require "plan information" when used. The "Flatcar" alias is one of those. When usingan image URN, the validator fetches plan information and appends to the request, but this was missing when using an alias. Add the same handling to alias validation, so that aliases can be used as is without extra work from the user.
Testing Guide
Before this PR this results in an error ("missing plan information"), after this PR the result is success.
History Notes
[Compute] Fix #20174:
az vm create: Determine plan information when using image aliasThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.