Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 11 additions & 7 deletions src/azure-cli/azure/cli/command_modules/vm/_template_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,18 @@ def _build_storage_profile():

return profile

vm_properties = {'hardwareProfile': {'vmSize': size}, 'networkProfile': {'networkInterfaces': nics},
'storageProfile': _build_storage_profile()}

vm_size_properties = {}
if v_cpus_available is not None:
vm_size_properties['vCPUsAvailable'] = v_cpus_available

if v_cpus_per_core is not None:
vm_size_properties['vCPUsPerCore'] = v_cpus_per_core

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
Copy link
Member

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."
          }
        }
      }
    ]
  }
}


if availability_set_id:
vm_properties['availabilitySet'] = {'id': availability_set_id}
Expand All @@ -529,12 +532,13 @@ def _build_storage_profile():
}
}

vm_properties['additionalCapabilities'] = {}
if ultra_ssd_enabled is not None:
vm_properties['additionalCapabilities']['ultraSSDEnabled'] = ultra_ssd_enabled
if cmd.supported_api_version(min_api='2018-06-01'):
vm_properties['additionalCapabilities'] = {}
if ultra_ssd_enabled is not None:
vm_properties['additionalCapabilities']['ultraSSDEnabled'] = ultra_ssd_enabled

if enable_hibernation is not None:
vm_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation
if enable_hibernation is not None:
vm_properties['additionalCapabilities']['hibernationEnabled'] = enable_hibernation
Copy link
Member

@wangzelin007 wangzelin007 Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix
additionalCapabilities


if proximity_placement_group:
vm_properties['proximityPlacementGroup'] = {'id': proximity_placement_group}
Expand Down
6 changes: 6 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ def _parse_image_argument(cmd, namespace):
namespace.os_offer = matched['offer']
namespace.os_sku = matched['sku']
namespace.os_version = matched['version']
if not any([namespace.plan_name, namespace.plan_product, namespace.plan_publisher]):
image_plan = _get_image_plan_info_if_exists(cmd, namespace)
if image_plan:
namespace.plan_name = image_plan.name
namespace.plan_product = image_plan.product
namespace.plan_publisher = image_plan.publisher
return 'urn'
except requests.exceptions.ConnectionError:
pass
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def test_vm_extension(self, resource_group):
self.cmd('vm extension set -n {ext} --publisher {pub} --version 1.2 --vm-name {vm} --resource-group {rg} --protected-settings "{config}" --force-update')
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'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix
1 4 7 1

])
result = self.cmd('vm extension show --resource-group {rg} --vm-name {vm} --name {ext}', checks=[
self.check('type(@)', 'object'),
Expand Down Expand Up @@ -928,6 +928,7 @@ def test_vm_create_none_options(self, resource_group):

class VMBootDiagnostics(ScenarioTest):

@AllowLargeResponse()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix
AllowLargeResponse

@ResourceGroupPreparer(name_prefix='cli_test_vm_diagnostics')
@StorageAccountPreparer(name_prefix='clitestbootdiag')
def test_vm_boot_diagnostics(self, resource_group, storage_account):
Expand Down Expand Up @@ -1148,7 +1149,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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix
ImageNotFound2


self.cmd('network public-ip show -n {vm}PublicIP -g {rg}', checks=[
self.check('publicIpAllocationMethod', 'Static'),
Expand All @@ -1159,7 +1160,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')
Copy link
Member

@wangzelin007 wangzelin007 Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

self.cmd('network public-ip show -n {vm2}PublicIP -g {rg}', checks=[
self.check('publicIpAllocationMethod', 'Dynamic'),
self.check('sku.name', 'Basic')
Expand Down Expand Up @@ -1283,6 +1284,7 @@ def test_vm_create_custom_data(self, resource_group):

class VMSSCreateAndModify(ScenarioTest):

@AllowLargeResponse()
Copy link
Member

@wangzelin007 wangzelin007 Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

@ResourceGroupPreparer(name_prefix='cli_test_vmss_create_and_modify')
def test_vmss_create_and_modify(self):

Expand Down Expand Up @@ -1497,7 +1499,7 @@ def test_vmss_accelerated_networking(self, resource_group):
self.kwargs.update({
'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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix
Win2022Datacenter

Copy link
Contributor

@zhoxing-ms zhoxing-ms Jan 28, 2022

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

self.cmd('vmss show -n {vmss} -g {rg}',
checks=self.check('virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].enableAcceleratedNetworking', True))

Expand Down
Loading