Skip to content

Commit

Permalink
Add location to VM's nsg create (fixes Azure#332). Added param foldin…
Browse files Browse the repository at this point in the history
…g to VMSS. Uncommented VMSS test now that bugs are fixed (fixes Azure#510).  Fixed multi-nic vm bug (fixes Azure#545) and added multi-nic VM test. (Azure#599)
  • Loading branch information
BurtBiel authored Aug 3, 2016
1 parent e760485 commit 4a42794
Show file tree
Hide file tree
Showing 22 changed files with 5,709 additions and 1,555 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def _handle_vm_nics(namespace):
namespace.network_interface_ids = nics
namespace.network_interface_type = 'existing'

namespace.public_ip_address_type = 'none'

def _resource_not_exists(resource_type):
def _handle_resource_not_exists(namespace):
# TODO: hook up namespace._subscription_id once we support it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
parameters:
- name: --image
type: string
short-summary: 'OS image (URN alias, URN or URI) [default: Win2012R2Datacenter].'
short-summary: 'OS image (URN alias, URN or URI).'
long-summary: |
{0}
examples:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,10 @@ def get_vm_size_completion_list(prefix, action, parsed_args, **kwargs):#pylint:
for scope in ['vm create', 'vmss create']:
register_cli_argument(scope, 'location', CliArgumentType(completer=get_location_completion_list))
register_cli_argument(scope, 'custom_os_disk_uri', CliArgumentType(help=argparse.SUPPRESS))
register_cli_argument(scope, 'custom_os_disk_type', CliArgumentType(choices=['windows', 'linux'], type=str.lower), options_list=('--custom-disk-os-type',))
register_cli_argument(scope, 'os_disk_type', CliArgumentType(help=argparse.SUPPRESS))
register_cli_argument(scope, 'os_disk_name', CliArgumentType(validator=_os_disk_default))
register_cli_argument(scope, 'overprovision', CliArgumentType(action='store_false', default=None, options_list=('--disable-overprovision',)))
register_cli_argument(scope, 'load_balancer_type', CliArgumentType(choices=['new', 'existing', 'none'], type=str.lower))
register_cli_argument(scope, 'storage_caching', CliArgumentType(choices=['ReadOnly', 'ReadWrite']))
register_cli_argument(scope, 'upgrade_policy_mode', CliArgumentType(choices=choices_upgrade_mode, help=None, type=str.lower))
register_cli_argument(scope, 'nat_backend_port', CliArgumentType(help='Backend NAT port to map. Defaults to 22 for Linux and 3389 for Windows.', default=None))
register_cli_argument(scope, 'os_disk_uri', CliArgumentType(help=argparse.SUPPRESS))
register_cli_argument(scope, 'os_offer', CliArgumentType(help=argparse.SUPPRESS))
register_cli_argument(scope, 'os_publisher', CliArgumentType(help=argparse.SUPPRESS))
Expand All @@ -165,7 +161,7 @@ def get_vm_size_completion_list(prefix, action, parsed_args, **kwargs):#pylint:
register_cli_argument(scope, 'admin_password', help='Password for the Virtual Machine if Authentication Type is Password.')
register_cli_argument(scope, 'ssh_key_value', CliArgumentType(action=VMSSHFieldAction))
register_cli_argument(scope, 'ssh_dest_key_path', completer=FilesCompleter())
register_cli_argument(scope, 'dns_name_for_public_ip', CliArgumentType(action=VMDNSNameAction), options_list=('--public-ip-address-dns-name',), help='Globally unique DNS Name for the Public IP used to access the Virtual Machine.')
register_cli_argument(scope, 'dns_name_for_public_ip', CliArgumentType(action=VMDNSNameAction), options_list=('--public-ip-address-dns-name',), help='Globally unique DNS Name for the Public IP.')
register_cli_argument(scope, 'authentication_type', authentication_type)
register_folded_cli_argument(scope, 'availability_set', 'Microsoft.Compute/availabilitySets')
register_cli_argument(scope, 'private_ip_address_allocation', help=argparse.SUPPRESS)
Expand All @@ -177,5 +173,6 @@ def get_vm_size_completion_list(prefix, action, parsed_args, **kwargs):#pylint:
register_folded_cli_argument(scope, 'storage_account', 'Microsoft.Storage/storageAccounts', help='Name or ID of storage account (creates if doesn\'t exist). Chooses an existing storage account if none specified.', validator=_find_default_storage_account)
register_folded_cli_argument(scope, 'virtual_network', 'Microsoft.Network/virtualNetworks', help='Name or ID of virtual network (creates if doesn\'t exist). Chooses an existing VNet if none specified.', options_list=('--vnet',), validator=_find_default_vnet)
register_folded_cli_argument(scope, 'network_security_group', 'Microsoft.Network/networkSecurityGroups', help='Name or ID of network security group (creates if doesn\'t exist)', options_list=('--nsg',))
register_folded_cli_argument(scope, 'load_balancer', 'Microsoft.Network/loadBalancers', help='Name or ID of load balancer (creates if doesn\'t exist)')
register_cli_argument(scope, 'network_security_group_rule', nsg_rule_type, options_list=('--nsg-rule',))
register_extra_cli_argument(scope, 'image', options_list=('--image',), action=VMImageFieldAction, completer=get_urn_aliases_completion_list, default='Win2012R2Datacenter')
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@
"contentVersion": "1.0.0.0"
},
"parameters": {
"location": { "value": "[parameters('location')]" },
"networkSecurityGroupRule": { "value": "[parameters('networkSecurityGroupRule')]" },
"networkSecurityGroup": { "value": "[parameters('networkSecurityGroup')]" },
"tags": { "value": "[parameters('tags')]" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ Size Standard_A3, existing storage account, existing storage container name, exi
- delete test_vm_create_custom_ip.yaml
- re-record test

**Multi-NIC VM**

- create vm with multiple nics
- verify create succeeds and that nics are added in the correct order

OR

- delete test_vm_create_multinic.yaml
- re-record test

**custom Linux image**

- create VM, add a customization such as "sudo apt-get install emacs23"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"networkSecurityGroup": {
"type": "string"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"networkSecurityGroup": {
"type": "string"
},
Expand Down Expand Up @@ -47,7 +50,7 @@
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[parameters('networkSecurityGroup')]",
"apiVersion": "2015-06-15",
"location": "westus",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
"properties": {
"securityRules": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,20 @@
"description": "Name of load balancer backend pool."
}
},
"loadBalancerName": {
"loadBalancer": {
"type": "string",
"defaultValue": "[concat(parameters('name'), 'lb')]",
"metadata": {
"description": "Name for load balancer."
"description": "Name or ID of load balancer."
}
},
"loadBalancerType": {
"type": "string",
"defaultValue": "new",
"allowedValues": [
"new",
"existing",
"existingName",
"existingId",
"none"
],
"metadata": {
Expand Down Expand Up @@ -193,11 +194,11 @@
"description": "Public IP address allocation method."
}
},
"publicIpAddressName": {
"publicIpAddress": {
"type": "string",
"defaultValue": "[concat(parameters('name'), 'PublicIP')]",
"metadata": {
"description": "Name of public IP address to use."
"description": "Name or ID of public IP address to use."
}
},
"publicIpAddressType": {
Expand All @@ -206,7 +207,8 @@
"allowedValues": [
"none",
"new",
"existingName"
"existingName",
"existingId"
],
"metadata": {
"description": "Use a public IP Address for the VM Nic."
Expand Down Expand Up @@ -244,7 +246,7 @@
"description": "Name of storage container for the VM OS disk."
}
},
"storageRedundancyType": {
"storageType": {
"type": "string",
"defaultValue": "Standard_LRS",
"metadata": {
Expand Down Expand Up @@ -290,19 +292,20 @@
"description": "The virtual network IP address prefix in CIDR format."
}
},
"virtualNetworkName": {
"virtualNetwork": {
"type": "string",
"defaultValue": "[concat(parameters('name'), 'VNET')]",
"metadata": {
"description": "Name of virtual network to add VM to."
"description": "Name or ID of virtual network."
}
},
"virtualNetworkType": {
"type": "string",
"defaultValue": "new",
"allowedValues": [
"new",
"existing"
"existingName",
"existingId"
],
"metadata": {
"description": "Whether to use an existing VNet or create a new one."
Expand All @@ -321,7 +324,7 @@
"apiVersion": "2015-06-15",
"vmssApiVersion": "2016-03-30",
"resourceLocation": "[parameters('location')]",
"storageAccountType": "[parameters('storageRedundancyType')]",
"storageAccountType": "[parameters('storageType')]",
"saCount": 5,
"namingInfix": "[toLower(substring(concat(parameters('name'), uniqueString(resourceGroup().id)), 0, 9))]",
"longNamingInfix": "[toLower(parameters('name'))]",
Expand All @@ -337,16 +340,31 @@
"osDiskName": "[parameters('osDiskName')]",
"addressPrefix": "10.0.0.0/16",
"subnetPrefix": "10.0.0.0/24",
"virtualNetworkName": "[parameters('virtualNetworkName')]",
"publicIPAddressName": "[parameters('publicIpAddressName')]",
"virtualNetworkIds": {
"existingId": "[parameters('virtualNetwork')]",
"existingName": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/virtualNetworks/',parameters('virtualNetwork'))]",
"new": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/virtualNetworks/',parameters('virtualNetwork'))]"
},
"virtualNetworkId": "[variables('virtualNetworkIds')[parameters('virtualNetworkType')]]",
"publicIpAddressIds": {
"existingId": "[parameters('publicIpAddress')]",
"existingName": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/publicIPAddresses/',parameters('publicIpAddress'))]",
"new": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/publicIPAddresses/',parameters('publicIpAddress'))]",
"none": null
},
"publicIpAddressId": "[variables('publicIpAddressIds')[parameters('publicIpAddressType')]]",
"loadBalancerIds": {
"existingId": "[parameters('loadBalancer')]",
"existingName": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/loadBalancers/',parameters('loadBalancer'))]",
"new": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',resourceGroup().name,'/providers/Microsoft.Network/loadBalancers/',parameters('loadBalancer'))]",
"none": null
},
"loadBalancerId": "[variables('loadBalancerIds')[parameters('loadBalancerType')]]",
"subnetName": "[parameters('subnetName')]",
"loadBalancerName": "[parameters('loadBalancerName')]",
"publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]",
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('loadBalancerName'))]",
"bePoolName": "[parameters('loadBalancerBackendPoolName')]",
"nicName": "[concat(variables('namingInfix'), 'nic')]",
"ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]",
"frontEndIPConfigID": "[concat(variables('lbID'),'/frontendIPConfigurations/loadBalancerFrontEnd')]",
"frontEndIPConfigID": "[concat(variables('loadBalancerId'),'/frontendIPConfigurations/loadBalancerFrontEnd')]",
"osProfilepassword": {
"computerNamePrefix": "[variables('namingInfix')]",
"adminUsername": "[parameters('adminUsername')]",
Expand Down Expand Up @@ -402,42 +420,54 @@
"lbDeploymentName": "[concat(parameters('name'), 'LB')]",
"vnetAddressPrefix": "[parameters('virtualNetworkIpAddressPrefix')]",
"subnetAddressPrefix": "[parameters('subnetIpAddressPrefix')]",
"vhdStorageType": "[parameters('storageRedundancyType')]",
"publicIPName": "[parameters('publicIpAddressName')]",
"vhdStorageType": "[parameters('storageType')]",
"publicIpAddressAllocation": "[parameters('publicIpAddressAllocation')]",
"vhdStorageContainerName": "vhds",
"vmSize": "[parameters('vmSku')]",
"vmDeploymentName": "[concat(parameters('name'), 'VM')]",
"nicDeploymentName": "[concat(parameters('name'), 'NicIp')]",
"vnetName": "[parameters('virtualNetworkName')]",
"vnetId": "[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]",
"subnetRef": "[concat(variables('virtualNetworkId'), '/subnets/', variables('subnetName'))]",
"ipConfigurations": {
"new": [
{
"name": "[variables('ipConfigName')]",
"properties": {
"subnet": {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'), '/subnets/', variables('subnetName'))]"
"id": "[variables('subnetRef')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/backendAddressPools/', variables('bePoolName'))]"
"id": "[concat(variables('loadBalancerId'), '/backendAddressPools/', variables('bePoolName'))]"
}
]
}
}
],
"existing": [
"existingName": [
{
"name": "[variables('ipConfigName')]",
"properties": {
"subnet": {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'), '/subnets/', variables('subnetName'))]"
"id": "[variables('subnetRef')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/loadBalancers/', variables('loadBalancerName'), '/backendAddressPools/', variables('bePoolName'))]"
"id": "[concat(variables('loadBalancerId'), '/backendAddressPools/', variables('bePoolName'))]"
}
]
}
}
],
"existingId": [
{
"name": "[variables('ipConfigName')]",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[concat(variables('loadBalancerId'), '/backendAddressPools/', variables('bePoolName'))]"
}
]
}
Expand All @@ -448,7 +478,7 @@
"name": "[variables('ipConfigName')]",
"properties": {
"subnet": {
"id": "[concat('/subscriptions/', subscription().subscriptionId,'/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'), '/subnets/', variables('subnetName'))]"
"id": "[variables('subnetRef')]"
}
}
}
Expand All @@ -461,28 +491,26 @@
"vnetTemplateUri": "https://azuresdkci.blob.core.windows.net/templatehost/CreateVnet_2016-07-18/azuredeploy.json",
"vnetTemplateUriEmpty": "https://azuresdkci.blob.core.windows.net/templatehost/CreateVnet_2016-07-18/azuredeploy_empty.json",
"vnetTemplateFilePaths": {
"existing": "[variables('vnetTemplateUriEmpty')]",
"existingId": "[variables('vnetTemplateUriEmpty')]",
"existingName": "[variables('vnetTemplateUriEmpty')]",
"new": "[variables('vnetTemplateUri')]"
},
"publicIpTemplateUri": "https://azuresdkci.blob.core.windows.net/templatehost/CreatePublicIp_2016-07-19/azuredeploy.json",
"publicIpTemplateUriEmpty": "https://azuresdkci.blob.core.windows.net/templatehost/CreatePublicIp_2016-07-19/azuredeploy_empty.json",
"ipTemplateFilePaths": {
"existingId": "[variables('publicIpTemplateUriEmpty')]",
"existingName": "[variables('publicIpTemplateUriEmpty')]",
"new": "[variables('publicIpTemplateUri')]",
"none": "[variables('publicIpTemplateUriEmpty')]"
},
"lbTemplateUri": "https://azuresdkci.blob.core.windows.net/templatehost/CreateLb_2016-07-19/azuredeploy.json",
"lbTemplateUriEmpty": "https://azuresdkci.blob.core.windows.net/templatehost/CreateLb_2016-07-19/azuredeploy_empty.json",
"lbTemplateFilePaths": {
"existing": "[variables('lbTemplateUriEmpty')]",
"existingId": "[variables('lbTemplateUriEmpty')]",
"existingName": "[variables('lbTemplateUriEmpty')]",
"new": "[variables('lbTemplateUri')]",
"none": "[variables('lbTemplateUriEmpty')]"
},
"nicTemplateFilePaths": {
"none": "[concat('/nested_templates/nic_ip_none_dns_', parameters('dnsNameType'), '.json')]",
"new": "[concat('/nested_templates/nic_ip_new_dns_', parameters('dnsNameType'), '.json')]",
"existing": "[concat('/nested_templates/nic_ip_existing_dns_', parameters('dnsNameType'), '.json')]"
},
"vhdContainers": [
"[concat('https://', variables('uniqueStringArray')[0], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))]",
"[concat('https://', variables('uniqueStringArray')[1], variables('newStorageAccountSuffix'), '.blob.core.windows.net/', variables('vhdContainerName'))]",
Expand Down Expand Up @@ -537,7 +565,7 @@
"contentVersion": "1.0.0.0"
},
"parameters": {
"virtualNetworkName": { "value": "[variables('vnetName')]" },
"virtualNetworkName": { "value": "[parameters('virtualNetwork')]" },
"virtualNetworkPrefix": { "value": "[variables('vnetAddressPrefix')]" },
"subnetPrefix": { "value": "[variables('subnetAddressPrefix')]" },
"subnetName": { "value": "[variables('subnetName')]" },
Expand All @@ -559,7 +587,7 @@
},
"parameters": {
"dnsName": { "value": "[parameters('dnsNameForPublicIP')]" },
"name": { "value": "[variables('publicIPAddressName')]" },
"name": { "value": "[parameters('publicIpAddress')]" },
"allocationMethod": { "value": "[variables('publicIpAddressAllocation')]" },
"location": { "value": "[parameters('location')]" },
"dnsNameType": { "value": "[parameters('dnsNameType')]" },
Expand All @@ -581,7 +609,7 @@
"contentVersion": "1.0.0.0"
},
"parameters": {
"loadBalancerName": { "value": "[variables('loadBalancerName')]" },
"loadBalancerName": { "value": "[parameters('loadBalancer')]" },
"location": { "value": "[variables('resourceLocation')]" },
"publicIpAddress": { "value": "[variables('publicIPAddressID')]" },
"backendPoolName": { "value": "[variables('bePoolName')]" },
Expand Down
Loading

0 comments on commit 4a42794

Please sign in to comment.