Skip to content

Add a VHD DiskFile parameter set to existing New-AzureRmVM cmdlet #5105

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

Merged
merged 1 commit into from
Jan 16, 2018

Conversation

huangpf
Copy link
Contributor

@huangpf huangpf commented Dec 8, 2017

Description


This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

[Parameter(ParameterSetName = DiskFileParameterSetNameStr, Mandatory = false, Position = 9, ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
[ValidateRange(1, 64)]
public int? NumberOfUploaderThreads { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

int, instead of int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

int will default to 0... but we want to set default to 2 if no value is specified, i.e. null.


[Parameter(ParameterSetName = DiskLinkParameterSetNameStr, Mandatory = false, Position = 10, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = DiskFileParameterSetNameStr, Mandatory = false, Position = 10, ValueFromPipelineByPropertyName = true)]
public bool? CheckDiskLinkExistence { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

consider switch parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

[Parameter(ParameterSetName = DiskLinkParameterSetNameStr, Mandatory = false, Position = 6, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = DiskFileParameterSetNameStr, Mandatory = false, Position = 6, ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public List<SecurityRule> SecurityRules { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

array instead of List

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why?

using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using System.Collections.Generic;
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: sort usings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

@@ -153,7 +153,7 @@ public class RemoveAzureRoleAssignmentCommand : ResourcesBaseCmdlet
public SwitchParameter PassThru { get; set; }

[ValidateNotNullOrEmpty]
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet.RoleAssignment, HelpMessage = "Role Assignment.")]
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, ParameterSetName = "RoleAssignment", HelpMessage = "Role Assignment.")]
Copy link
Contributor

Choose a reason for hiding this comment

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

is this change necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to make this change, because it's breaking my build.

Copy link
Member

Choose a reason for hiding this comment

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

Please revert all ofthese changes outside the Compute project

[Parameter(ParameterSetName = DiskLinkParameterSetNameStr, Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = DiskFileParameterSetNameStr, Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
public string Location { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding Zone parameter too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's for a single VM. Does a Zone parameter help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If so, how?

```

### -VMSize
Fill VMSize Description
Copy link
Contributor

Choose a reason for hiding this comment

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

in the help file, please indicate the default value when the parameter is not given.

@@ -64,9 +64,16 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Management.KeyVault.2.3.0-preview\lib\net452\Microsoft.Azure.Management.KeyVault.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=15.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need to update commands.compute project?

@hyonholee
Copy link
Contributor

remove files under stackadmin and tools directory.

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

Not needed

@@ -0,0 +1,126 @@
#
Copy link
Member

Choose a reason for hiding this comment

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

This should be in its own directory (Compute.ManagedService)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They were in different folders from the initial commits...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved.

# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '4.0.0'; })
Copy link
Member

Choose a reason for hiding this comment

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

Update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.Network, Version=15.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.15.1.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
Copy link
Member

Choose a reason for hiding this comment

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

This package should not take dependencies on any management clients other than Compute. Any required management operations should come from the Commands.Common.* common assembleis. This prevents modules from taking dependencies on incompatible versions of shared assemblies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.20.0-preview\lib\portable-net45+wp8+wpa81+win\Microsoft.Azure.ResourceManager.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.Edm, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Data.Edm.5.8.2\lib\net40\Microsoft.Data.Edm.dll</HintPath>
Copy link
Member

Choose a reason for hiding this comment

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

Is WindowsAzure.Storage sued for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes


[Parameter(ParameterSetName = DiskLinkParameterSetNameStr, Mandatory = false, Position = 9, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = DiskFileParameterSetNameStr, Mandatory = false, Position = 9, ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
Copy link
Member

Choose a reason for hiding this comment

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

As discussed, why do we need this parameter?


[Parameter(ParameterSetName = DiskLinkParameterSetNameStr, Mandatory = false, Position = 10, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = DiskFileParameterSetNameStr, Mandatory = false, Position = 10, ValueFromPipelineByPropertyName = true)]
public SwitchParameter NoDiskLinkExistenceCheck { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

SkipDiskLinkExistenceCheck

#>

function Move-AzureRmVhdVM
{
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we have figured out how to take the necessary depencency, or whether this shoudl be a cmdlet or a script

```

## DESCRIPTION
Fill in the Description
Copy link
Member

Choose a reason for hiding this comment

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

Please fill out the help data

@@ -153,7 +153,7 @@ public class RemoveAzureRoleAssignmentCommand : ResourcesBaseCmdlet
public SwitchParameter PassThru { get; set; }

[ValidateNotNullOrEmpty]
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, ParameterSetName = ParameterSet.RoleAssignment, HelpMessage = "Role Assignment.")]
[Parameter(Position = 0, Mandatory = true, ValueFromPipeline = true, ParameterSetName = "RoleAssignment", HelpMessage = "Role Assignment.")]
Copy link
Member

Choose a reason for hiding this comment

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

Please revert all ofthese changes outside the Compute project

@markcowl markcowl removed their assignment Dec 20, 2017
@huangpf huangpf force-pushed the vhd2 branch 2 times, most recently from d6e8797 to bad01ab Compare December 20, 2017 05:28
@maddieclayton
Copy link
Contributor

@azuresdkci Test this please

@@ -31,7 +31,7 @@ static class VirtualMachineStrategy
p.ResourceGroupName, p.Name, null, p.CancellationToken),
createOrUpdateAsync: (o, p) => o.CreateOrUpdateAsync(
p.ResourceGroupName, p.Name, p.Model, p.CancellationToken),
createTime: c => c.OsProfile.WindowsConfiguration != null ? 240 : 120);
createTime: c => c.OsProfile == null ? 240 : c.OsProfile.WindowsConfiguration != null ? 240 : 120);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not use nested ? :
Combine two conditions or use if-then-else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a lamda expression, so I just want to fit it into one line...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anyway, I will try not to use nested here.

using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.Azure.Management.Internal.Resources.Models;
using Microsoft.Azure.Commands.Compute.Strategies.ResourceManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: order usings.

public string Size { get; set; } = "Standard_DS1_v2";

Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: unnecessary spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed


[Parameter(ParameterSetName = DiskFileParameterSet, Mandatory = true)]
[ValidateNotNullOrEmpty]
public string DiskFile { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to update \help\New-AzureRmVM.md file for new parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add this parameter to the SimpleSarameterSet instead of creating a new parameter set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then the parameter set would be mixed for image & disk file cases. I don't think it's actually a good way to do so. We may expand the DiskFile set later on, as well.

@huangpf huangpf force-pushed the vhd2 branch 6 times, most recently from 071131a to 0df10c9 Compare January 11, 2018 22:47
Cmdlet = this,
BlobObjectFactory = new CloudPageBlobObjectFactory(storageCredentialsFactory, TimeSpan.FromMinutes(1))
};
if (!string.Equals(Environment.GetEnvironmentVariable("AZURE_TEST_MODE"), "playback", StringComparison.OrdinalIgnoreCase))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@markcowl @hyonholee
Is it OK to do so?

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm.. I don't think this should be in dev code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to increase testability & I think I somehow saw similar code somewhere.

```

### -DiskFile
{{Fill DiskFile Description}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Add description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -248,30 +273,45 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -Linux
{{Fill Linux Description}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Fill the description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@huangpf huangpf force-pushed the vhd2 branch 3 times, most recently from 666b685 to 290bffb Compare January 12, 2018 00:15
$thrownErrorMessage = '';
try
{
$st = New-AzureRmVM -ResourceGroupName $rgname -Name $rgname -Location $loc -DiskFile $file;
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand - you are catching an exception when this is supposed to be a positive test case. You are also not testing any properties of the VM. Please include an actual positive test case in which you create a valid VM and validate the expected properties of the resulting object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm puzzled by the test framework as well, as you can see in the checkpoint in the next few lines, the test will fail with either 'queue empty' or 'object not found' errors only in playback mode.

@@ -1,50 +1,52 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27019.1
VisualStudioVersion = 15.0.27130.2010
Copy link
Member

Choose a reason for hiding this comment

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

Why is this file changed? Did we need to add in the strategies project?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The netcore build failed, so I had to do something with it, but maybe it's not needed to change the solution file. I will try to revert this particular part and see.

@huangpf huangpf force-pushed the vhd2 branch 2 times, most recently from d566881 to 1865f89 Compare January 12, 2018 18:02
Copy link
Contributor

@sergey-shandar sergey-shandar left a comment

Choose a reason for hiding this comment

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

I would like to discuss if we can use Strategies for disks as well as for other resources.

p.ResourceGroupName, p.Name, p.CancellationToken),
createOrUpdateAsync: (o, p) => o.CreateOrUpdateAsync(
p.ResourceGroupName, p.Name, p.Model, p.CancellationToken),
createTime: d => 120);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it take 2 minutes (120 seconds) in average to create a disk ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's about right. What would happen the real timespan is more?

Copy link
Contributor

Choose a reason for hiding this comment

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

We use the number to show progress, it's ok if takes longer or shorter. We need an average.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Should be fine.

Name = disk.Name,
CreateOption = DiskCreateOptionTypes.Attach,
OsType = isWindows ? OperatingSystemTypes.Windows : OperatingSystemTypes.Linux,
ManagedDisk = new ManagedDiskParameters
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, we should modify the existing CreateVirtualMachineConfig and have ResourceConfig<Disk> disk as an optional parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to the other comment.


namespace Microsoft.Azure.Commands.Compute
{
[Cmdlet(
VerbsCommon.New,
ProfileNouns.VirtualMachine,
SupportsShouldProcess = true,
DefaultParameterSetName = "DefaultParameterSet")]
DefaultParameterSetName = "SimpleParameterSet")]
[OutputType(typeof(PSAzureOperationResponse), typeof(PSVirtualMachine))]
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO, we should still use DefaultParameterSet as default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The parameter set with the least inputs should be the default, otherwise PS is not able to resolve which set the users want to use.


[Parameter(ParameterSetName = DiskFileParameterSet, Mandatory = true)]
[ValidateNotNullOrEmpty]
public string DiskFile { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add this parameter to the SimpleSarameterSet instead of creating a new parameter set?

@@ -176,6 +209,9 @@ public override void ExecuteCmdlet()
case SimpleParameterSet:
this.StartAndWait(StrategyExecuteCmdletAsync);
break;
case DiskFileParameterSet:
this.StartAndWait(StrategyExecuteCmdletAsync);
Copy link
Contributor

Choose a reason for hiding this comment

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

The implementation is identical for SimpleParameterSet and DiskFileParameterSet. This confirms that we don't need a new parameter set ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar comment.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we actually need a parameter set to make Image and DiskFile mutually exclusive. Whether we need separate execution paths is a question.

AzureSession.Instance.ClientFactory.CreateArmClient<StorageManagementClient>(DefaultProfile.DefaultContext,
AzureEnvironment.Endpoint.ResourceManager);
var st1 = storageClient.StorageAccounts.Create(ResourceGroupName, Name, new StorageAccountCreateParameters
{
Copy link
Contributor

@sergey-shandar sergey-shandar Jan 12, 2018

Choose a reason for hiding this comment

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

It would be good if call the Create function as a part of dependency tree. I can help with this. In the future, we may generate Azure templates so let's discuss it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried, but not trivial. You can check storage account operations. They don't have Get and they have GetProperties, and they don't have CreateOrUpdate and they use Create, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is one problem then. A user may specify a new resource group which doesn't exist yet. SimpleParameterSet handles this but it will fail in DiskFileParameterSet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I use the same RG strategy?

this ResourceConfig<ResourceGroup> resourceGroup,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, you mean in the storage creation...

Can we handle it as a bug item? It doesn't seem to be trivial, and it's not an issue for the Simple parameter set, and not a P0 blocker for DiskFile set as well...

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with this as long as we track the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created for tracking: #5279

@markcowl
Copy link
Member

@@ -176,6 +209,9 @@ public override void ExecuteCmdlet()
case SimpleParameterSet:
this.StartAndWait(StrategyExecuteCmdletAsync);
break;
case DiskFileParameterSet:
this.StartAndWait(StrategyExecuteCmdletAsync);
Copy link
Member

Choose a reason for hiding this comment

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

Yes, we actually need a parameter set to make Image and DiskFile mutually exclusive. Whether we need separate execution paths is a question.

@markcowl markcowl dismissed sergey-shandar’s stale review January 13, 2018 03:37

Will resolve in separate PR

Copy link
Contributor

@sergey-shandar sergey-shandar left a comment

Choose a reason for hiding this comment

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

Will it make sense to have another parameterset which accept disk Uri?

{
Name = SkuName.PremiumLRS
},
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we create a separate static function? For example

public static StorageAccountCreateParameters WithPremiumLRS(this StorageAccountCreateParameters p)
{
#if !NETSTANDARD 
    p.AccountType = AccountType.PremiumLRS;
#else  
    p.Sku = new SM.Sku 
    { 
          Name = SkuName.PremiumLRS  
     }; 
#endif
     return p;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sergey-shandar When users give a disk file, & we upload it to the cloud, there should be no lease on it. However, if users directly refer to a disk link, it's not necessarily that case, so we need to think about what's the proper way to validate that. Thus, it's not included in this PR to make things too complicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding the macro conditionally separated code, I think we should be able to live with them for a while? Since eventually the Storage client is going to reconcile and use only the final set of input parameters. Then at that time, the static function will need to be removed as well, if they are added now.

AzureSession.Instance.ClientFactory.CreateArmClient<StorageManagementClient>(DefaultProfile.DefaultContext,
AzureEnvironment.Endpoint.ResourceManager);
var st1 = storageClient.StorageAccounts.Create(ResourceGroupName, Name, new StorageAccountCreateParameters
{
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with this as long as we track the issue.

@markcowl markcowl merged commit 4280292 into Azure:preview Jan 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants