Merge pull request #3550 from ahmetalpbalkan/azure-storage-type

azure: add --azure-storage-type flag
This commit is contained in:
Nathan LeClaire
2016-07-28 11:54:57 -07:00
committed by GitHub
3 changed files with 16 additions and 3 deletions

View File

@@ -68,6 +68,7 @@ Optional:
- `--azure-static-public-ip`: Assign a static public IP address to the machine.
- `--azure-docker-port`: Port number for Docker engine.
- `--azure-environment`: Azure environment (e.g. `AzurePublicCloud`, `AzureChinaCloud`).
- `--azure-storage-type`: Type of Azure Storage account hosting the OS disk of the machine (e.g. `Standard_LRS`, `Premium_LRS`).
[vm-image]: https://azure.microsoft.com/en-us/documentation/articles/resource-groups-vm-searching/
[location]: https://azure.microsoft.com/en-us/regions/
@@ -90,6 +91,7 @@ Environment variables and default values:
| `--azure-subnet` | `AZURE_SUBNET` | `docker-machine` |
| `--azure-subnet-prefix` | `AZURE_SUBNET_PREFIX` | `192.168.0.0/16` |
| `--azure-availability-set` | `AZURE_AVAILABILITY_SET` | `docker-machine` |
| `--azure-storage-type` | `AZURE_STORAGE_TYPE` | `Standard_LRS` |
| `--azure-open-port` | - | - |
| `--azure-private-ip-address` | - | - |
| `--azure-use-private-ip` | - | - |

View File

@@ -26,7 +26,7 @@ const (
defaultAzureVNet = "docker-machine-vnet"
defaultAzureSubnet = "docker-machine"
defaultAzureSubnetPrefix = "192.168.0.0/16"
defaultStorageType = storage.StandardLRS
defaultStorageType = string(storage.StandardLRS)
defaultAzureAvailabilitySet = "docker-machine"
)
@@ -48,6 +48,7 @@ const (
flAzureUsePrivateIP = "azure-use-private-ip"
flAzureStaticPublicIP = "azure-static-public-ip"
flAzureNoPublicIP = "azure-no-public-ip"
flAzureStorageType = "azure-storage-type"
)
const (
@@ -71,6 +72,7 @@ type Driver struct {
SubnetName string
SubnetPrefix string
AvailabilitySet string
StorageType string
OpenPorts []string
PrivateIPAddr string
@@ -177,6 +179,12 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: flAzurePrivateIPAddr,
Usage: "Specify a static private IP address for the machine",
},
mcnflag.StringFlag{
Name: flAzureStorageType,
Usage: "Type of Storage Account to host the OS Disk for the machine",
EnvVar: "AZURE_STORAGE_TYPE",
Value: defaultStorageType,
},
mcnflag.BoolFlag{
Name: flAzureUsePrivateIP,
Usage: "Use private IP address of the machine to connect",
@@ -217,6 +225,7 @@ func (d *Driver) SetConfigFromFlags(fl drivers.DriverOptions) error {
{&d.SubnetName, flAzureSubnet},
{&d.SubnetPrefix, flAzureSubnetPrefix},
{&d.AvailabilitySet, flAzureAvailabilitySet},
{&d.StorageType, flAzureStorageType},
}
for _, f := range flags {
*f.target = fl.String(f.flag)
@@ -322,7 +331,7 @@ func (d *Driver) Create() error {
d.ctx.PublicIPAddressID, d.ctx.SubnetID, d.ctx.NetworkSecurityGroupID, d.PrivateIPAddr); err != nil {
return err
}
if err := c.CreateStorageAccount(d.ctx, d.ResourceGroup, d.Location, defaultStorageType); err != nil {
if err := c.CreateStorageAccount(d.ctx, d.ResourceGroup, d.Location, storage.AccountType(d.StorageType)); err != nil {
return err
}
if err := d.generateSSHKey(d.ctx); err != nil {

View File

@@ -357,7 +357,9 @@ func (a AzureClient) createStorageAccount(resourceGroup, location string, storag
name := randomAzureStorageAccountName() // if it's not random enough, then you're unlucky
f := logutil.Fields{
"name": name,
"location": location}
"location": location,
"type": storageType,
}
log.Info("Creating storage account.", f)
_, err := a.storageAccountsClient().Create(resourceGroup, name,