Skip to content

AzureRT PR S45 #1 - Add-AzureVMImage #9

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 34 commits into from
Feb 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ac5f0dd
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Jan 19, 2015
26af55d
Merge branch 'dev' of https://github.com/AzureRT/azure-powershell int…
huangpf Jan 19, 2015
5349782
Merge branch 'dev' of https://github.com/AzureRT/azure-powershell int…
huangpf Jan 20, 2015
5273a4d
Update version to 0.8.14
markcowl Jan 21, 2015
65ac5d3
Merge pull request #103 from markcowl/release-0.8.14
markcowl Jan 21, 2015
32d47c2
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Jan 21, 2015
45396c8
Update management library
markcowl Jan 21, 2015
4581f78
Removing app.config files
markcowl Jan 21, 2015
38076ef
Removing additional app.con fig files
markcowl Jan 21, 2015
0b89856
Updating csproj management reference versions
markcowl Jan 21, 2015
59dcb6a
Updating azure common extensions library to resolve conflicts
markcowl Jan 22, 2015
1f11607
Updating Insights package
markcowl Jan 22, 2015
ceddbf4
Fix for StorSimple tests
markcowl Jan 22, 2015
f254254
Merge pull request #104 from markcowl/release-0.8.14
markcowl Jan 22, 2015
0a8bdcd
Merge branch 'release-0.8.14' of https://github.com/Azure/azure-power…
huangpf Jan 22, 2015
e8054c8
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Jan 23, 2015
fd045b5
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Jan 24, 2015
1cfe124
Merge branch 'dev' of https://github.com/AzureRT/azure-powershell int…
huangpf Jan 26, 2015
33a4d32
Add-AzureVMImage update
huangpf Jan 27, 2015
9cccfcc
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Jan 27, 2015
9d9c86f
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Jan 29, 2015
5e77721
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
huangpf Jan 29, 2015
d7c308e
update compute library
huangpf Jan 30, 2015
e407a39
update tests
huangpf Jan 30, 2015
666797c
revert 0.8.14 changes
huangpf Jan 31, 2015
960e26f
update
huangpf Jan 31, 2015
3274d4c
Merge branch 'dev' of https://github.com/AzureRT/azure-powershell int…
huangpf Jan 31, 2015
7c62529
update
huangpf Jan 31, 2015
9f1d5bd
IconName & SmallIconName
huangpf Jan 31, 2015
0748fdb
update test
huangpf Jan 31, 2015
5b507d2
update test
huangpf Jan 31, 2015
65ba319
update test
huangpf Jan 31, 2015
2ee0652
update test
huangpf Jan 31, 2015
e29d0ae
Update param. sets for OS/Disk config cmdlets
huangpf Jan 31, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.Common.Test/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.ScenarioTest/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.WebSites" version="4.4.0-prerelease" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="System.Spatial" version="5.6.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="8.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.8.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public static string DefaultStorageName
}
}

public static void CopyTestData(string srcContainer, string srcBlob, string destContainer, string destBlob)
public static void CopyTestData(string srcContainer, string srcBlob, string destContainer, string destBlob = null)
{
ServiceManagementCmdletTestHelper vmPowershellCmdlets = new ServiceManagementCmdletTestHelper();
Process currentProcess = Process.GetCurrentProcess();
Expand All @@ -262,7 +262,15 @@ public static void CopyTestData(string srcContainer, string srcBlob, string dest
// Make SAS Uri for the source blob.
string srcSasUri = Utilities.GenerateSasUri(CredentialHelper.CredentialBlobUriFormat, storageAccount, storageAccountKey, srcContainer, srcBlob);

vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));
if (string.IsNullOrEmpty(destBlob))
{
vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcContainer {0} -SrcBlob {1} -DestContainer {2} -Force", srcContainer, srcBlob, destContainer));
destBlob = srcBlob;
}
else
{
vmPowershellCmdlets.RunPSScript(string.Format("Start-AzureStorageBlobCopy -SrcUri \"{0}\" -DestContainer {1} -DestBlob {2} -Force", srcSasUri, destContainer, destBlob));
}

for (int i = 0; i < 60; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public void AzureVMImageTest()

try
{
// BVT Tests for OS Images
OSImageContext result = vmPowershellCmdlets.AddAzureVMImage(newImageName, mediaLocation, OS.Windows, oldLabel, vmSize, iconUri, smallIconUri, showInGui);

OSImageContext resultReturned = vmPowershellCmdlets.GetAzureVMImage(newImageName)[0];
Expand All @@ -174,6 +175,97 @@ public void AzureVMImageTest()
vmPowershellCmdlets.RemoveAzureVMImage(newImageName, false);
Assert.IsTrue(Utilities.CheckRemove(vmPowershellCmdlets.GetAzureVMImage, newImageName));

// BVT Tests for VM Images
// Unique Container Prefix
var containerPrefix = Utilities.GetUniqueShortName("vmimg");

// Disk Blobs
var srcVhdName = "os1.vhd";
var srcVhdContainer = vhdContainerName;
var dstOSVhdContainer = containerPrefix.ToLower() + "os" + vhdContainerName;
CredentialHelper.CopyTestData(srcVhdContainer, srcVhdName, dstOSVhdContainer);
string osVhdLink = string.Format("{0}{1}/{2}", blobUrlRoot, dstOSVhdContainer, srcVhdName);

var dstDataVhdContainer = containerPrefix.ToLower() + "data" + vhdContainerName;
CredentialHelper.CopyTestData(srcVhdContainer, srcVhdName, dstDataVhdContainer);
string dataVhdLink = string.Format("{0}{1}/{2}", blobUrlRoot, dstDataVhdContainer, srcVhdName);

// VM Image OS/Data Disk Configuration
var addVMImageName = containerPrefix + "Image";
var diskConfig = new VirtualMachineImageDiskConfigSet
{
OSDiskConfiguration = new OSDiskConfiguration
{
HostCaching = HostCaching.ReadWrite.ToString(),
OS = OSType.Windows.ToString(),
OSState = "Generalized",
MediaLink = new Uri(osVhdLink)
},
DataDiskConfigurations = new DataDiskConfigurationList
{
new DataDiskConfiguration
{
HostCaching = HostCaching.ReadOnly.ToString(),
Lun = 0,
MediaLink = new Uri(dataVhdLink)
}
}
};

// Add-AzureVMImage
string label = addVMImageName;
string description = "test";
string eula = "http://www.bing.com/";
string imageFamily = "Windows";
DateTime? publishedDate = new DateTime(2015, 1, 1);
string privacyUri = "http://www.bing.com/";
string recommendedVMSize = vmSize;
string iconName = "iconName";
string smallIconName = "smallIconName";

vmPowershellCmdlets.AddAzureVMImage(
addVMImageName,
label,
diskConfig,
description,
eula,
imageFamily,
publishedDate,
privacyUri,
recommendedVMSize,
iconName,
smallIconName,
showInGui);

// Get-AzureVMImage
var vmImage = vmPowershellCmdlets.GetAzureVMImageReturningVMImages(addVMImageName).First();

Assert.IsTrue(vmImage.ImageName == addVMImageName);
Assert.IsTrue(vmImage.Label == label);
Assert.IsTrue(vmImage.Description == description);
Assert.IsTrue(vmImage.Eula == eula);
Assert.IsTrue(vmImage.ImageFamily == imageFamily);
Assert.IsTrue(vmImage.PublishedDate.Value.Year == publishedDate.Value.Year);
Assert.IsTrue(vmImage.PublishedDate.Value.Month == publishedDate.Value.Month);
Assert.IsTrue(vmImage.PublishedDate.Value.Day == publishedDate.Value.Day);
Assert.IsTrue(vmImage.PrivacyUri.AbsoluteUri.ToString() == privacyUri);
Assert.IsTrue(vmImage.RecommendedVMSize == recommendedVMSize);
Assert.IsTrue(vmImage.IconName == iconName);
Assert.IsTrue(vmImage.IconUri == iconName);
Assert.IsTrue(vmImage.SmallIconName == smallIconName);
Assert.IsTrue(vmImage.SmallIconUri == smallIconName);
Assert.IsTrue(vmImage.ShowInGui == showInGui);
Assert.IsTrue(vmImage.OSDiskConfiguration.HostCaching == diskConfig.OSDiskConfiguration.HostCaching);
Assert.IsTrue(vmImage.OSDiskConfiguration.OS == diskConfig.OSDiskConfiguration.OS);
Assert.IsTrue(vmImage.OSDiskConfiguration.OSState == diskConfig.OSDiskConfiguration.OSState);
Assert.IsTrue(vmImage.OSDiskConfiguration.MediaLink == diskConfig.OSDiskConfiguration.MediaLink);
Assert.IsTrue(vmImage.DataDiskConfigurations.First().HostCaching == diskConfig.DataDiskConfigurations.First().HostCaching);
Assert.IsTrue(vmImage.DataDiskConfigurations.First().Lun == diskConfig.DataDiskConfigurations.First().Lun);
Assert.IsTrue(vmImage.DataDiskConfigurations.First().MediaLink == diskConfig.DataDiskConfigurations.First().MediaLink);

// Remove-AzureVMImage
vmPowershellCmdlets.RemoveAzureVMImage(addVMImageName);

pass = true;
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PowershellCore;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;

namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.IaasCmdletInfo
{
Expand Down Expand Up @@ -96,5 +97,76 @@ public AddAzureVMImageCmdletInfo(
cmdletParams.Add(new CmdletParam("PublishedDate", publishedDate.ToString()));
}
}

public AddAzureVMImageCmdletInfo(
string imageName,
string label,
VirtualMachineImageDiskConfigSet diskConfig,
string description,
string eula,
string imageFamily,
DateTime? publishedDate,
string privacyUri,
string recommendedVMSize,
string iconName,
string smallIconName,
bool? showInGui)
{
cmdletName = Utilities.AddAzureVMImageCmdletName;

cmdletParams.Add(new CmdletParam("ImageName", imageName));

cmdletParams.Add(new CmdletParam("Label", label));

if (diskConfig != null)
{
cmdletParams.Add(new CmdletParam("DiskConfig", diskConfig));
}

if (!string.IsNullOrEmpty(description))
{
cmdletParams.Add(new CmdletParam("Description", description));
}

if (!string.IsNullOrEmpty(eula))
{
cmdletParams.Add(new CmdletParam("Eula", eula));
}

if (!string.IsNullOrEmpty(imageFamily))
{
cmdletParams.Add(new CmdletParam("ImageFamily", imageFamily));
}

if (publishedDate != null)
{
cmdletParams.Add(new CmdletParam("PublishedDate", publishedDate));
}

if (!string.IsNullOrEmpty(privacyUri))
{
cmdletParams.Add(new CmdletParam("PrivacyUri", privacyUri));
}

if (!string.IsNullOrEmpty(recommendedVMSize))
{
cmdletParams.Add(new CmdletParam("RecommendedVMSize", recommendedVMSize));
}

if (!string.IsNullOrEmpty(iconName))
{
cmdletParams.Add(new CmdletParam("IconName", iconName));
}

if (!string.IsNullOrEmpty(smallIconName))
{
cmdletParams.Add(new CmdletParam("SmallIconName", smallIconName));
}

if (showInGui != null)
{
cmdletParams.Add(new CmdletParam("ShowInGui", showInGui));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public UpdateAzureVMImageCmdletInfo(
Uri privacyUri,
DateTime publishedDate,
string language,
Uri iconUri,
Uri smallIconUri,
string iconName,
string smallIconName,
bool showInGui)
: this(imageName, label, recommendedSize, null, !showInGui)
{
Expand Down Expand Up @@ -81,13 +81,13 @@ public UpdateAzureVMImageCmdletInfo(
{
cmdletParams.Add(new CmdletParam("Language", language));
}
if (iconUri != null)
if (!string.IsNullOrEmpty(iconName))
{
cmdletParams.Add(new CmdletParam("IconUri", iconUri));
cmdletParams.Add(new CmdletParam("IconName", iconName));
}
if (smallIconUri != null)
if (!string.IsNullOrEmpty(smallIconName))
{
cmdletParams.Add(new CmdletParam("SmallIconUri", smallIconUri));
cmdletParams.Add(new CmdletParam("SmallIconName", smallIconName));
}
}
}
Expand Down
Loading