From 9fcad0455de3629698e30f8bfb8607e7f924b64c Mon Sep 17 00:00:00 2001 From: me Date: Wed, 25 Mar 2015 20:46:35 +0400 Subject: [PATCH] wsp-10323 Step 10 final --- .../Virtualization/MountedDiskInfo.cs | 1 + .../Extensions/StringExtensions.cs | 73 ++ .../Helpers/VdsHelper.cs | 294 +++++++ .../HyperV2012R2.cs | 344 +------- ...oviders.Virtualization.HyperV2012R2.csproj | 2 + .../HyperV2012R2_Settings.ascx.resx | 404 +++++++++ .../HyperV2012R2_Settings.ascx | 408 +++++++++ .../HyperV2012R2_Settings.ascx.cs | 227 +++++ .../HyperV2012R2_Settings.ascx.designer.cs | 825 ++++++++++++++++++ .../WebsitePanel.Portal.Modules.csproj | 11 + 10 files changed, 2270 insertions(+), 319 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs index 8dd324e9..f44247b1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs @@ -34,6 +34,7 @@ namespace WebsitePanel.Providers.Virtualization { public class MountedDiskInfo { + public int DiskNumber { get; set; } public string DiskAddress { get; set; } public string[] DiskVolumes { get; set; } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs new file mode 100644 index 00000000..cc295c7c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs @@ -0,0 +1,73 @@ +using System; +using System.Text.RegularExpressions; + +namespace WebsitePanel.Providers.Virtualization.Extensions +{ + public static class StringExtensions + { + public static string[] ParseExact( + this string data, + string format) + { + return ParseExact(data, format, false); + } + + public static string[] ParseExact( + this string data, + string format, + bool ignoreCase) + { + string[] values; + + if (TryParseExact(data, format, out values, ignoreCase)) + return values; + else + throw new ArgumentException("Format not compatible with value."); + } + + public static bool TryExtract( + this string data, + string format, + out string[] values) + { + return TryParseExact(data, format, out values, false); + } + + public static bool TryParseExact( + this string data, + string format, + out string[] values, + bool ignoreCase) + { + int tokenCount = 0; + format = Regex.Escape(format).Replace("\\{", "{"); + + for (tokenCount = 0; ; tokenCount++) + { + string token = string.Format("{{{0}}}", tokenCount); + if (!format.Contains(token)) break; + format = format.Replace(token, + string.Format("(?'group{0}'.*)", tokenCount)); + } + + RegexOptions options = + ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None; + + Match match = new Regex(format, options).Match(data); + + if (tokenCount != (match.Groups.Count - 1)) + { + values = new string[] { }; + return false; + } + else + { + values = new string[tokenCount]; + for (int index = 0; index < tokenCount; index++) + values[index] = + match.Groups[string.Format("group{0}", index)].Value; + return true; + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs new file mode 100644 index 00000000..2d9f614e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs @@ -0,0 +1,294 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Management; +using System.Threading; +using Microsoft.Storage.Vds; +using Microsoft.Storage.Vds.Advanced; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.Virtualization.Extensions; +using Path = System.IO.Path; + +namespace WebsitePanel.Providers.Virtualization +{ + public static class VdsHelper + { + public static MountedDiskInfo GetMountedDiskInfo(string serverName, int driveNumber) + { + MountedDiskInfo diskInfo = new MountedDiskInfo { DiskNumber = driveNumber }; + + // find mounted disk using VDS + AdvancedDisk advancedDisk = null; + Pack diskPack = null; + + // first attempt + Thread.Sleep(3000); + HostedSolutionLog.LogInfo("Trying to find mounted disk - first attempt"); + FindVdsDisk(serverName, diskInfo.DiskNumber, out advancedDisk, out diskPack); + + // second attempt + if (advancedDisk == null) + { + Thread.Sleep(20000); + HostedSolutionLog.LogInfo("Trying to find mounted disk - second attempt"); + FindVdsDisk(serverName, diskInfo.DiskNumber, out advancedDisk, out diskPack); + } + + if (advancedDisk == null) + throw new Exception("Could not find mounted disk"); + + // Set disk address + diskInfo.DiskAddress = advancedDisk.DiskAddress; + var addressParts = diskInfo.DiskAddress.ParseExact("Port{0}Path{1}Target{2}Lun{3}"); + var portNumber = addressParts[0]; + var targetId = addressParts[2]; + var lun = addressParts[3]; + + // check if DiskPart must be used to bring disk online and clear read-only flag + bool useDiskPartToClearReadOnly = false; + if (ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) + useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); + + // determine disk index for DiskPart + Wmi cimv2 = new Wmi(serverName, Constants.WMI_CIMV2_NAMESPACE); + ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", + "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", + targetId, lun, portNumber); + + if (useDiskPartToClearReadOnly) + { + // *** Clear Read-Only and bring disk online with DiskPart *** + HostedSolutionLog.LogInfo("Clearing disk Read-only flag and bringing disk online"); + + if (objDisk != null) + { + // disk found + // run DiskPart + string diskPartResult = RunDiskPart(serverName, String.Format(@"select disk {0} +attributes disk clear readonly +online disk +exit", Convert.ToInt32(objDisk["Index"]))); + + HostedSolutionLog.LogInfo("DiskPart Result: " + diskPartResult); + } + } + else + { + // *** Clear Read-Only and bring disk online with VDS *** + // clear Read-Only + if ((advancedDisk.Flags & DiskFlags.ReadOnly) == DiskFlags.ReadOnly) + { + HostedSolutionLog.LogInfo("Clearing disk Read-only flag"); + advancedDisk.ClearFlags(DiskFlags.ReadOnly); + while ((advancedDisk.Flags & DiskFlags.ReadOnly) == DiskFlags.ReadOnly) + { + Thread.Sleep(100); + advancedDisk.Refresh(); + } + } + + // bring disk ONLINE + if (advancedDisk.Status == DiskStatus.Offline) + { + HostedSolutionLog.LogInfo("Bringing disk online"); + advancedDisk.Online(); + while (advancedDisk.Status == DiskStatus.Offline) + { + Thread.Sleep(100); + advancedDisk.Refresh(); + } + } + } + + // small pause after getting disk online + Thread.Sleep(3000); + + // get disk again + FindVdsDisk(serverName, diskInfo.DiskNumber, out advancedDisk, out diskPack); + + // find volumes using VDS + List volumes = new List(); + HostedSolutionLog.LogInfo("Querying disk volumes with VDS"); + foreach (Volume volume in diskPack.Volumes) + { + string letter = volume.DriveLetter.ToString(); + if (letter != "") + volumes.Add(letter); + } + + // find volumes using WMI + if (volumes.Count == 0 && objDisk != null) + { + HostedSolutionLog.LogInfo("Querying disk volumes with WMI"); + foreach (ManagementObject objPartition in objDisk.GetRelated("Win32_DiskPartition")) + { + foreach (ManagementObject objVolume in objPartition.GetRelated("Win32_LogicalDisk")) + { + volumes.Add(objVolume["Name"].ToString().TrimEnd(':')); + } + } + } + + HostedSolutionLog.LogInfo("Volumes found: " + volumes.Count); + + // Set volumes + diskInfo.DiskVolumes = volumes.ToArray(); + + return diskInfo; + } + + public static void FindVdsDisk(string serverName, int driveNumber, out AdvancedDisk advancedDisk, out Pack diskPack) + { + Func compareFunc = disk => disk.Name.EndsWith("PhysicalDrive" + driveNumber); + FindVdsDisk(serverName, compareFunc, out advancedDisk, out diskPack); + } + public static void FindVdsDisk(string serverName, string diskAddress, out AdvancedDisk advancedDisk, out Pack diskPack) + { + Func compareFunc = disk => disk.DiskAddress == diskAddress; + FindVdsDisk(serverName, compareFunc, out advancedDisk, out diskPack); + } + + private static void FindVdsDisk(string serverName, Func compareFunc, out AdvancedDisk advancedDisk, out Pack diskPack) + { + advancedDisk = null; + diskPack = null; + + ServiceLoader serviceLoader = new ServiceLoader(); + Service vds = serviceLoader.LoadService(serverName); + vds.WaitForServiceReady(); + + foreach (Disk disk in vds.UnallocatedDisks) + { + if (compareFunc(disk)) + { + advancedDisk = (AdvancedDisk) disk; + break; + } + } + + if (advancedDisk == null) + { + vds.HardwareProvider = false; + vds.SoftwareProvider = true; + + foreach (SoftwareProvider provider in vds.Providers) + foreach (Pack pack in provider.Packs) + foreach (Disk disk in pack.Disks) + if (compareFunc(disk)) + { + diskPack = pack; + advancedDisk = (AdvancedDisk) disk; + break; + } + } + } + + // obsolete and currently is not used + private static string RunDiskPart(string serverName, string script) + { + // create temp script file name + string localPath = Path.Combine(GetTempRemoteFolder(serverName), Guid.NewGuid().ToString("N")); + + // save script to remote temp file + string remotePath = ConvertToUNC(serverName, localPath); + File.AppendAllText(remotePath, script); + + // run diskpart + ExecuteRemoteProcess(serverName, "DiskPart /s " + localPath); + + // delete temp script + try + { + File.Delete(remotePath); + } + catch + { + // TODO + } + + return ""; + } + + public static string ConvertToUNC(string serverName, string path) + { + if (String.IsNullOrEmpty(serverName) + || path.StartsWith(@"\\")) + return path; + + return String.Format(@"\\{0}\{1}", serverName, path.Replace(":", "$")); + } + + public static string GetTempRemoteFolder(string serverName) + { + Wmi cimv2 = new Wmi(serverName, "root\\cimv2"); + ManagementObject objOS = cimv2.GetWmiObject("win32_OperatingSystem"); + string sysPath = (string)objOS["SystemDirectory"]; + + // remove trailing slash + if (sysPath.EndsWith("\\")) + sysPath = sysPath.Substring(0, sysPath.Length - 1); + + sysPath = sysPath.Substring(0, sysPath.LastIndexOf("\\") + 1) + "Temp"; + + return sysPath; + } + + public static void ExecuteRemoteProcess(string serverName, string command) + { + Wmi cimv2 = new Wmi(serverName, "root\\cimv2"); + ManagementClass objProcess = cimv2.GetWmiClass("Win32_Process"); + + // run process + object[] methodArgs = { command, null, null, 0 }; + objProcess.InvokeMethod("Create", methodArgs); + + // process ID + int processId = Convert.ToInt32(methodArgs[3]); + + // wait until finished + // Create event query to be notified within 1 second of + // a change in a service + WqlEventQuery query = + new WqlEventQuery("__InstanceDeletionEvent", + new TimeSpan(0, 0, 1), + "TargetInstance isa \"Win32_Process\""); + + // Initialize an event watcher and subscribe to events + // that match this query + ManagementEventWatcher watcher = new ManagementEventWatcher(cimv2.GetScope(), query); + // times out watcher.WaitForNextEvent in 20 seconds + watcher.Options.Timeout = new TimeSpan(0, 0, 20); + + // Block until the next event occurs + // Note: this can be done in a loop if waiting for + // more than one occurrence + while (true) + { + ManagementBaseObject e = null; + + try + { + // wait untill next process finish + e = watcher.WaitForNextEvent(); + } + catch + { + // nothing has been finished in timeout period + return; // exit + } + + // check process id + int pid = Convert.ToInt32(((ManagementBaseObject)e["TargetInstance"])["ProcessID"]); + if (pid == processId) + { + //Cancel the subscription + watcher.Stop(); + + // exit + return; + } + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index cb30af2e..cb14f1d2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -52,6 +52,7 @@ using WebsitePanel.Server.Utils; using Vds = Microsoft.Storage.Vds; using System.Configuration; using System.Linq; +using WebsitePanel.Providers.Virtualization.Extensions; namespace WebsitePanel.Providers.Virtualization { @@ -855,7 +856,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Remove-VMSwitch"); cmd.Parameters.Add("Name", switchId); cmd.Parameters.Add("Force"); - PowerShell.Execute(cmd, true); + PowerShell.Execute(cmd, true, false); } catch (Exception ex) { @@ -874,7 +875,7 @@ namespace WebsitePanel.Providers.Virtualization path = Path.Combine(FileUtils.EvaluateSystemVariables(path), Constants.LIBRARY_INDEX_FILE_NAME); // convert to UNC if it is a remote computer - path = ConvertToUNC(path); + path = VdsHelper.ConvertToUNC(ServerNameSettings, path); if (!File.Exists(path)) { @@ -1176,184 +1177,27 @@ namespace WebsitePanel.Providers.Virtualization public MountedDiskInfo MountVirtualHardDisk(string vhdPath) { - //MountedDiskInfo diskInfo = new MountedDiskInfo(); - //vhdPath = FileUtils.EvaluateSystemVariables(vhdPath); + vhdPath = FileUtils.EvaluateSystemVariables(vhdPath); - //// Mount disk - //Command cmd = new Command("Mount-VHD"); + // Mount disk + Command cmd = new Command("Mount-VHD"); - //cmd.Parameters.Add("Path", vhdPath); - //cmd.Parameters.Add("PassThru"); + cmd.Parameters.Add("Path", vhdPath); + cmd.Parameters.Add("PassThru"); - //// Get disk address - //var result = PowerShell.Execute(cmd, true); - - //try - //{ - // if (result == null || result.Count == 0) - // throw new Exception("Failed to mount disk"); - - // diskInfo.DiskAddress = result[0].GetString("DiskNumber"); - - // // Get disk volumes - - //} - //catch (Exception ex) - //{ - // // unmount disk - // UnmountVirtualHardDisk(vhdPath); - - // // throw error - // throw ex; - //} - - //return diskInfo; - - ManagementObject objImgSvc = GetImageManagementService(); - - // get method params - ManagementBaseObject inParams = objImgSvc.GetMethodParameters("Mount"); - inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); - - ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("Mount", inParams, null); - JobResult result = CreateJobResultFromWmiMethodResults(outParams); - - // load storage job - if (result.ReturnValue != ReturnCode.JobStarted) - throw new Exception("Failed to start Mount job with the following error: " + result.ReturnValue); ; - - ManagementObject objJob = wmi.GetWmiObject("msvm_StorageJob", "InstanceID = '{0}'", result.Job.Id); - - if (!JobCompleted(result.Job)) - throw new Exception("Failed to complete Mount job with the following error: " + result.Job.ErrorDescription); + // Get mounted disk + var result = PowerShell.Execute(cmd, true, true); try { - List volumes = new List(); + if (result == null || result.Count == 0) + throw new Exception("Failed to mount disk"); - // load output data - ManagementObject objImage = wmi.GetRelatedWmiObject(objJob, "Msvm_MountedStorageImage"); + var diskNumber = result[0].GetInt("DiskNumber"); - int pathId = Convert.ToInt32(objImage["PathId"]); - int portNumber = Convert.ToInt32(objImage["PortNumber"]); - int targetId = Convert.ToInt32(objImage["TargetId"]); - int lun = Convert.ToInt32(objImage["Lun"]); - - string diskAddress = String.Format("Port{0}Path{1}Target{2}Lun{3}", portNumber, pathId, targetId, lun); - - HostedSolutionLog.LogInfo("Disk address: " + diskAddress); - - // find mounted disk using VDS - Vds.Advanced.AdvancedDisk advancedDisk = null; - Vds.Pack diskPack = null; - - // first attempt - System.Threading.Thread.Sleep(3000); - HostedSolutionLog.LogInfo("Trying to find mounted disk - first attempt"); - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); - - // second attempt - if (advancedDisk == null) - { - System.Threading.Thread.Sleep(20000); - HostedSolutionLog.LogInfo("Trying to find mounted disk - second attempt"); - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); - } - - if (advancedDisk == null) - throw new Exception("Could not find mounted disk"); - - // check if DiskPart must be used to bring disk online and clear read-only flag - bool useDiskPartToClearReadOnly = false; - if (ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) - useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); - - // determine disk index for DiskPart - Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); - ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", - "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", - targetId, lun, portNumber); - - if (useDiskPartToClearReadOnly) - { - // *** Clear Read-Only and bring disk online with DiskPart *** - HostedSolutionLog.LogInfo("Clearing disk Read-only flag and bringing disk online"); - - if (objDisk != null) - { - // disk found - // run DiskPart - string diskPartResult = RunDiskPart(String.Format(@"select disk {0} -attributes disk clear readonly -online disk -exit", Convert.ToInt32(objDisk["Index"]))); - - HostedSolutionLog.LogInfo("DiskPart Result: " + diskPartResult); - } - } - else - { - // *** Clear Read-Only and bring disk online with VDS *** - // clear Read-Only - if ((advancedDisk.Flags & Vds.DiskFlags.ReadOnly) == Vds.DiskFlags.ReadOnly) - { - HostedSolutionLog.LogInfo("Clearing disk Read-only flag"); - advancedDisk.ClearFlags(Vds.DiskFlags.ReadOnly); - while ((advancedDisk.Flags & Vds.DiskFlags.ReadOnly) == Vds.DiskFlags.ReadOnly) - { - System.Threading.Thread.Sleep(100); - advancedDisk.Refresh(); - } - } - - // bring disk ONLINE - if (advancedDisk.Status == Vds.DiskStatus.Offline) - { - HostedSolutionLog.LogInfo("Bringing disk online"); - advancedDisk.Online(); - while (advancedDisk.Status == Vds.DiskStatus.Offline) - { - System.Threading.Thread.Sleep(100); - advancedDisk.Refresh(); - } - } - } - - // small pause after getting disk online - System.Threading.Thread.Sleep(3000); - - // get disk again - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); - - // find volumes using VDS - HostedSolutionLog.LogInfo("Querying disk volumes with VDS"); - foreach (Vds.Volume volume in diskPack.Volumes) - { - string letter = volume.DriveLetter.ToString(); - if (letter != "") - volumes.Add(letter); - } - - // find volumes using WMI - if (volumes.Count == 0 && objDisk != null) - { - HostedSolutionLog.LogInfo("Querying disk volumes with WMI"); - foreach (ManagementObject objPartition in objDisk.GetRelated("Win32_DiskPartition")) - { - foreach (ManagementObject objVolume in objPartition.GetRelated("Win32_LogicalDisk")) - { - volumes.Add(objVolume["Name"].ToString().TrimEnd(':')); - } - } - } - - HostedSolutionLog.LogInfo("Volumes found: " + volumes.Count); - - // info object - MountedDiskInfo info = new MountedDiskInfo(); - info.DiskAddress = diskAddress; - info.DiskVolumes = volumes.ToArray(); - return info; + var diskInfo = VdsHelper.GetMountedDiskInfo(ServerNameSettings, diskNumber); + + return diskInfo; } catch (Exception ex) { @@ -1365,41 +1209,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); } } - private void FindVdsDisk(string diskAddress, out Vds.Advanced.AdvancedDisk advancedDisk, out Vds.Pack diskPack) - { - advancedDisk = null; - diskPack = null; - - Vds.ServiceLoader serviceLoader = new Vds.ServiceLoader(); - Vds.Service vds = serviceLoader.LoadService(ServerNameSettings); - vds.WaitForServiceReady(); - - foreach (Vds.Disk disk in vds.UnallocatedDisks) - { - if (disk.DiskAddress == diskAddress) - { - advancedDisk = (Vds.Advanced.AdvancedDisk)disk; - break; - } - } - - if (advancedDisk == null) - { - vds.HardwareProvider = false; - vds.SoftwareProvider = true; - - foreach (Vds.SoftwareProvider provider in vds.Providers) - foreach (Vds.Pack pack in provider.Packs) - foreach (Vds.Disk disk in pack.Disks) - if (disk.DiskAddress == diskAddress) - { - diskPack = pack; - advancedDisk = (Vds.Advanced.AdvancedDisk)disk; - break; - } - } - } - public ReturnCode UnmountVirtualHardDisk(string vhdPath) { Command cmd = new Command("Dismount-VHD"); @@ -1417,7 +1226,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath)); cmd.Parameters.Add("SizeBytes", sizeGB * Constants.Size1G); - PowerShell.Execute(cmd, true); + PowerShell.Execute(cmd, true, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } @@ -1443,7 +1252,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); cmd.Parameters.Add("DestinationPath", destinationPath); cmd.Parameters.Add("VHDType", diskType.ToString()); - PowerShell.Execute(cmd, true); + PowerShell.Execute(cmd, true, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) @@ -1467,7 +1276,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); Vds.Advanced.AdvancedDisk advancedDisk = null; Vds.Pack diskPack = null; - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); + VdsHelper.FindVdsDisk(ServerNameSettings, diskAddress, out advancedDisk, out diskPack); if (advancedDisk == null) throw new Exception("Could not find mounted disk"); @@ -1522,36 +1331,11 @@ exit", Convert.ToInt32(objDisk["Index"]))); diskVolume.EndExtend(extendEvent); } - // obsolete and currently is not used - private string RunDiskPart(string script) - { - // create temp script file name - string localPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); - - // save script to remote temp file - string remotePath = ConvertToUNC(localPath); - File.AppendAllText(remotePath, script); - - // run diskpart - ExecuteRemoteProcess("DiskPart /s " + localPath); - - // delete temp script - try - { - File.Delete(remotePath); - } - catch - { - // TODO - } - - return ""; - } - + public string ReadRemoteFile(string path) { // temp file name on "system" drive available through hidden share - string tempPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); + string tempPath = Path.Combine(VdsHelper.GetTempRemoteFolder(ServerNameSettings), Guid.NewGuid().ToString("N")); HostedSolutionLog.LogInfo("Read remote file: " + path); HostedSolutionLog.LogInfo("Local file temp path: " + tempPath); @@ -1561,7 +1345,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return null; // read content of temp file - string remoteTempPath = ConvertToUNC(tempPath); + string remoteTempPath = VdsHelper.ConvertToUNC(ServerNameSettings, tempPath); HostedSolutionLog.LogInfo("Remote file temp path: " + remoteTempPath); string content = File.ReadAllText(remoteTempPath); @@ -1575,10 +1359,10 @@ exit", Convert.ToInt32(objDisk["Index"]))); public void WriteRemoteFile(string path, string content) { // temp file name on "system" drive available through hidden share - string tempPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); + string tempPath = Path.Combine(VdsHelper.GetTempRemoteFolder(ServerNameSettings), Guid.NewGuid().ToString("N")); // write to temp file - string remoteTempPath = ConvertToUNC(tempPath); + string remoteTempPath = VdsHelper.ConvertToUNC(ServerNameSettings, tempPath); File.WriteAllText(remoteTempPath, content); // delete file (WMI) @@ -1925,14 +1709,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); wmi.GetWmiObject("Msvm_VirtualSystemSettingData", "InstanceID = '{0}'", "Microsoft:" + snapshotId); } - private string ConvertToUNC(string path) - { - if (String.IsNullOrEmpty(ServerNameSettings) - || path.StartsWith(@"\\")) - return path; - - return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$")); - } private ConcreteJob CreateJobFromWmiObject(ManagementBaseObject objJob) { @@ -2136,80 +1912,10 @@ exit", Convert.ToInt32(objDisk["Index"]))); public void CreateFolder(string path) { - ExecuteRemoteProcess(String.Format("cmd.exe /c md \"{0}\"", path)); + VdsHelper.ExecuteRemoteProcess(ServerNameSettings, String.Format("cmd.exe /c md \"{0}\"", path)); } - public void ExecuteRemoteProcess(string command) - { - Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); - ManagementClass objProcess = cimv2.GetWmiClass("Win32_Process"); - // run process - object[] methodArgs = { command, null, null, 0 }; - objProcess.InvokeMethod("Create", methodArgs); - - // process ID - int processId = Convert.ToInt32(methodArgs[3]); - - // wait until finished - // Create event query to be notified within 1 second of - // a change in a service - WqlEventQuery query = - new WqlEventQuery("__InstanceDeletionEvent", - new TimeSpan(0, 0, 1), - "TargetInstance isa \"Win32_Process\""); - - // Initialize an event watcher and subscribe to events - // that match this query - ManagementEventWatcher watcher = new ManagementEventWatcher(cimv2.GetScope(), query); - // times out watcher.WaitForNextEvent in 20 seconds - watcher.Options.Timeout = new TimeSpan(0, 0, 20); - - // Block until the next event occurs - // Note: this can be done in a loop if waiting for - // more than one occurrence - while (true) - { - ManagementBaseObject e = null; - - try - { - // wait untill next process finish - e = watcher.WaitForNextEvent(); - } - catch - { - // nothing has been finished in timeout period - return; // exit - } - - // check process id - int pid = Convert.ToInt32(((ManagementBaseObject)e["TargetInstance"])["ProcessID"]); - if (pid == processId) - { - //Cancel the subscription - watcher.Stop(); - - // exit - return; - } - } - } - - public string GetTempRemoteFolder() - { - Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); - ManagementObject objOS = cimv2.GetWmiObject("win32_OperatingSystem"); - string sysPath = (string)objOS["SystemDirectory"]; - - // remove trailing slash - if (sysPath.EndsWith("\\")) - sysPath = sysPath.Substring(0, sysPath.Length - 1); - - sysPath = sysPath.Substring(0, sysPath.LastIndexOf("\\") + 1) + "Temp"; - - return sysPath; - } #endregion #region Hyper-V Cloud diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj index 65ec14ae..aa20c15c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj @@ -55,7 +55,9 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx new file mode 100644 index 00000000..3c34e5ff --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + User name + + + Both reseller account passwords should match + + + Enter default gateway IP + + + Enter DVD library folder + + + Enter path for storing exported VPS + + + Enter host name pattern + + + Alternate Name Server: + + + Default Gateway: + + + Disk Type: + + + WebsitePanel Reseller Account + + + DVD Library path: + + + Existing password: + + + Exported VPS path: + + + External Network + + + Connect to Network: + + + General Settings + + + VPS Host name + + + Host name pattern: + + + IP Addresses Format: + + + DVD Media Library + + + Network Adapter + + + OS Templates path: + + + When user is not allowed to specify their custom host name the system will generate the host name for new VPS based on this pattern.<br/><br/> +The following substitution variables can be used in the pattern:<br/> +[USERNAME], [USER_ID], [SPACE_ID] + + + Preferred Name Server: + + + Private Network + + + For automatic provisioning of WebsitePanel control panel inside VPS please enter WebsitePanel reseller account details below: + + + Confirm password: + + + Password: + + + Username: + + + seconds + + + Automatic Start Action + + + What do you want VPS to do when the physical computer starts? + + + Startup delay: + + + Specify a startup delay to reduce resource contention between virtual machines. + + + Automatic Stop Action + + + What do you want VPS to do when the physical shuts down? + + + Subnet Mask: + + + Virtual Hard Drive + + + VPS folder includes: + + + VPS root folder: + + + 10.0.0.1/8 + + + 172.16.0.1/12 + + + 192.168.0.1/16 + + + Always start VPS automatically + + + Nothing + + + Automatically start if it was running when the service stopped + + + Save VPS state + + + Shut down VPS operating system + + + Turn off VPS + + + Dynamically expanding + + + Fixed size + + + VPS identifier, for example "843FA-A0B2-34404" + + + VPS host name, for example "vps1.domain.com" + + + Enter VPS root folder + + + Startup delay could not be blank + + + Enter subnet mask + + + Enter OS templates folder + + + Enter processor limit per VPS + + + Enter processor reserve per VPS + + + Enter relative processor weight per VPS + + + Virtual machine limit: + + + Virtual machine reserve: + + + Relative weight: + + + The following variables are supported: [VPS_HOSTNAME], [USERNAME], [USER_ID], [SPACE_ID] + + + Processor Resource Settings + + + Connect + + + <Cannot read networks list> + + + <br/><b>Unable to connect to Hyper-V server</b><br/><br/>Possible reasons:<ol><li>You are going to manage remote Hyper-V server (either Server Core or Hyper-V Server 2008 machine) where WebsitePanel Server is not installed. Type the correct server name at the top of this form and then click "Connect" button.</li><li>WebsitePanel Server has insufficient permissions to connect remote Hyper-V server. Please refer administrator guide for client and server setup instructions.</li><li>Lost connectivity with WebsitePanel Server installed on Hyper-V virtualization server. Check connectivity and open service properties page once again.</li></ol> + + + Hyper-V Server + + + Server name: + + + <b>Local</b> - Hyper-V role is installed on this server + + + <b>Remote</b> - Remote Windows 2008 Server Core or Hyper-V Server 2008 + + + Enter server name + + + <Do not connect VPS to Management Network> + + + Management Network + + + Connect to Network: + + + DHCP + + + IP Addresses Pool + + + Custom + + + Network Card Configuration: + + + IP Address / CIDR: + + + Enter subnet mask in CIDR format + + + Automatically assign IP addresses to the space on creation + + + Core Svc Endpoint + + + SCCM Endpoint + + + SCCM Server + + + SCDPM Endpoint + + + SCDPM Server + + + SCOM Endpoint + + + SCOM Server + + + SCVMM Endpoint + + + SCVMM Server + + + Storage Endpoint + + + Hyper-V Cloud + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx new file mode 100644 index 00000000..cdca54c5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx @@ -0,0 +1,408 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HyperV2012R2_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.HyperV2012R2_Settings" %> +<%@ Register Src="../UserControls/EditIPAddressControl.ascx" TagName="EditIPAddressControl" TagPrefix="wsp" %> + + + +
+ + + + + + + + + + + + + +
+ + Local + Remote + +
+ + + + + +
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+
+
+ + + + +
+ + + + +
+
+
+ +
+ + + + + + + + + + + + + + + + +
+ + + + % + +
+ + + + % + +
+ + + + +
+
+
+ +
+ + + + + + + + +
+ + + + +
+
+
+ +
+ + + + + + + + +
+ + + + Dynamic + Fixed + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ +
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + POOL + DHCP + +
+ + + +
+ + + +
+
+ +
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Custom + 192.168.0.1 + 172.16.0.1 + 10.0.0.1 + +
+ + + + / + + +
+ + + +
+ + + +
+ + + +
+
+
+
+
+ +
+ + + + + + + + +
+ + + + +
+

+ +

+
+
+ +
+ + + + + + + + + + + + + + + + + +
+ +
+ + Nothing + Start + AlwaysStart + +
+ +
+ + + + +
+
+
+ +
+ + + + + + + + + + + +
+ +
+ + Save + TurnOff + ShutDown + +
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs new file mode 100644 index 00000000..88742012 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs @@ -0,0 +1,227 @@ +// Copyright (c) 2015, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections; +using System.Configuration; +using System.Data; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Collections.Specialized; +using WebsitePanel.Providers.Virtualization; +using WebsitePanel.EnterpriseServer; +using System.Web.UI.MobileControls; +using System.Collections.Generic; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class HyperV2012R2_Settings : WebsitePanelControlBase, IHostingServiceProviderSettings + { + protected void Page_Load(object sender, EventArgs e) + { + } + + void IHostingServiceProviderSettings.BindSettings(StringDictionary settings) + { + txtServerName.Text = settings["ServerName"]; + radioServer.SelectedIndex = (txtServerName.Text == "") ? 0 : 1; + + // bind networks + BindNetworksList(); + + // general settings + txtVpsRootFolder.Text = settings["RootFolder"]; + txtOSTemplatesPath.Text = settings["OsTemplatesPath"]; + txtExportedVpsPath.Text = settings["ExportedVpsPath"]; + + // CPU + txtCpuLimit.Text = settings["CpuLimit"]; + txtCpuReserve.Text = settings["CpuReserve"]; + txtCpuWeight.Text = settings["CpuWeight"]; + + // DVD library + txtDvdLibraryPath.Text = settings["DvdLibraryPath"]; + + // VHD type + radioVirtualDiskType.SelectedValue = settings["VirtualDiskType"]; + + // External network + ddlExternalNetworks.SelectedValue = settings["ExternalNetworkId"]; + externalPreferredNameServer.Text = settings["ExternalPreferredNameServer"]; + externalAlternateNameServer.Text = settings["ExternalAlternateNameServer"]; + chkAssignIPAutomatically.Checked = Utils.ParseBool(settings["AutoAssignExternalIP"], true); + + // Private network + ddlPrivateNetworkFormat.SelectedValue = settings["PrivateNetworkFormat"]; + privateIPAddress.Text = settings["PrivateIPAddress"]; + privateSubnetMask.Text = settings["PrivateSubnetMask"]; + privateDefaultGateway.Text = settings["PrivateDefaultGateway"]; + privatePreferredNameServer.Text = settings["PrivatePreferredNameServer"]; + privateAlternateNameServer.Text = settings["PrivateAlternateNameServer"]; + + // Management network + ddlManagementNetworks.SelectedValue = settings["ManagementNetworkId"]; + ddlManageNicConfig.SelectedValue = settings["ManagementNicConfig"]; + managePreferredNameServer.Text = settings["ManagementPreferredNameServer"]; + manageAlternateNameServer.Text = settings["ManagementAlternateNameServer"]; + + // host name + txtHostnamePattern.Text = settings["HostnamePattern"]; + + // start action + radioStartAction.SelectedValue = settings["StartAction"]; + txtStartupDelay.Text = settings["StartupDelay"]; + + // stop + radioStopAction.SelectedValue = settings["StopAction"]; + + ToggleControls(); + } + + void IHostingServiceProviderSettings.SaveSettings(StringDictionary settings) + { + settings["ServerName"] = txtServerName.Text.Trim(); + + // general settings + settings["RootFolder"] = txtVpsRootFolder.Text.Trim(); + settings["OsTemplatesPath"] = txtOSTemplatesPath.Text.Trim(); + settings["ExportedVpsPath"] = txtExportedVpsPath.Text.Trim(); + + // CPU + settings["CpuLimit"] = txtCpuLimit.Text.Trim(); + settings["CpuReserve"] = txtCpuReserve.Text.Trim(); + settings["CpuWeight"] = txtCpuWeight.Text.Trim(); + + // DVD library + settings["DvdLibraryPath"] = txtDvdLibraryPath.Text.Trim(); + + // VHD type + settings["VirtualDiskType"] = radioVirtualDiskType.SelectedValue; + + // External network + settings["ExternalNetworkId"] = ddlExternalNetworks.SelectedValue; + settings["ExternalPreferredNameServer"] = externalPreferredNameServer.Text; + settings["ExternalAlternateNameServer"] = externalAlternateNameServer.Text; + settings["AutoAssignExternalIP"] = chkAssignIPAutomatically.Checked.ToString(); + + // Private network + settings["PrivateNetworkFormat"] = ddlPrivateNetworkFormat.SelectedValue; + settings["PrivateIPAddress"] = ddlPrivateNetworkFormat.SelectedIndex == 0 ? privateIPAddress.Text : ""; + settings["PrivateSubnetMask"] = ddlPrivateNetworkFormat.SelectedIndex == 0 ? privateSubnetMask.Text : ""; + settings["PrivateDefaultGateway"] = privateDefaultGateway.Text; + settings["PrivatePreferredNameServer"] = privatePreferredNameServer.Text; + settings["PrivateAlternateNameServer"] = privateAlternateNameServer.Text; + + // Management network + settings["ManagementNetworkId"] = ddlManagementNetworks.SelectedValue; + settings["ManagementNicConfig"] = ddlManageNicConfig.SelectedValue; + settings["ManagementPreferredNameServer"] = ddlManageNicConfig.SelectedIndex == 0 ? managePreferredNameServer.Text : ""; + settings["ManagementAlternateNameServer"] = ddlManageNicConfig.SelectedIndex == 0 ? manageAlternateNameServer.Text : ""; + + // host name + settings["HostnamePattern"] = txtHostnamePattern.Text.Trim(); + + // start action + settings["StartAction"] = radioStartAction.SelectedValue; + settings["StartupDelay"] = Utils.ParseInt(txtStartupDelay.Text.Trim(), 0).ToString(); + + // stop + settings["StopAction"] = radioStopAction.SelectedValue; + } + + private void BindNetworksList() + { + try + { + VirtualSwitch[] switches = ES.Services.VPS.GetExternalSwitches(PanelRequest.ServiceId, txtServerName.Text.Trim()); + + ddlExternalNetworks.DataSource = switches; + ddlExternalNetworks.DataBind(); + + ddlManagementNetworks.DataSource = switches; + ddlManagementNetworks.DataBind(); + ddlManagementNetworks.Items.Insert(0, new ListItem(GetLocalizedString("ddlManagementNetworks.Text"), "")); + + locErrorReadingNetworksList.Visible = false; + } + catch + { + ddlExternalNetworks.Items.Add(new ListItem(GetLocalizedString("ErrorReadingNetworksList.Text"), "")); + ddlManagementNetworks.Items.Add(new ListItem(GetLocalizedString("ErrorReadingNetworksList.Text"), "")); + locErrorReadingNetworksList.Visible = true; + } + } + + private void ToggleControls() + { + ServerNameRow.Visible = (radioServer.SelectedIndex == 1); + + if (radioServer.SelectedIndex == 0) + { + txtServerName.Text = ""; + } + + // private network + PrivCustomFormatRow.Visible = (ddlPrivateNetworkFormat.SelectedIndex == 0); + + // management network + ManageNicConfigRow.Visible = (ddlManagementNetworks.SelectedIndex > 0); + ManageAlternateNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0); + ManagePreferredNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0); + } + + protected void radioServer_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected void btnConnect_Click(object sender, EventArgs e) + { + BindNetworksList(); + } + + protected void ddlPrivateNetworkFormat_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected void ddlManageNicConfig_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected void ddlManagementNetworks_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs new file mode 100644 index 00000000..40718603 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs @@ -0,0 +1,825 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class HyperV2012R2_Settings { + + /// + /// ValidationSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary; + + /// + /// locHyperVServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locHyperVServer; + + /// + /// radioServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioServer; + + /// + /// ServerNameRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ServerNameRow; + + /// + /// locServerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServerName; + + /// + /// txtServerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtServerName; + + /// + /// btnConnect control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnConnect; + + /// + /// ServerNameValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator ServerNameValidator; + + /// + /// ServerErrorRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ServerErrorRow; + + /// + /// locErrorReadingNetworksList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label locErrorReadingNetworksList; + + /// + /// locGeneralSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGeneralSettings; + + /// + /// locVpsRootFolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locVpsRootFolder; + + /// + /// txtVpsRootFolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtVpsRootFolder; + + /// + /// RootFolderValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RootFolderValidator; + + /// + /// locFolderVariables control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locFolderVariables; + + /// + /// locOSTemplatesPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locOSTemplatesPath; + + /// + /// txtOSTemplatesPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtOSTemplatesPath; + + /// + /// TemplatesPathValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator TemplatesPathValidator; + + /// + /// locExportedVpsPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locExportedVpsPath; + + /// + /// txtExportedVpsPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtExportedVpsPath; + + /// + /// ExportedVpsPathValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator ExportedVpsPathValidator; + + /// + /// locProcessorSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locProcessorSettings; + + /// + /// locCpuReserve control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCpuReserve; + + /// + /// txtCpuReserve control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCpuReserve; + + /// + /// CpuReserveValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuReserveValidator; + + /// + /// locCpuLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCpuLimit; + + /// + /// txtCpuLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCpuLimit; + + /// + /// CpuLimitValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuLimitValidator; + + /// + /// locCpuWeight control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCpuWeight; + + /// + /// txtCpuWeight control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCpuWeight; + + /// + /// CpuWeightValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuWeightValidator; + + /// + /// locMediaLibrary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMediaLibrary; + + /// + /// locDvdIsoPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDvdIsoPath; + + /// + /// txtDvdLibraryPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDvdLibraryPath; + + /// + /// DvdLibraryPathValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator DvdLibraryPathValidator; + + /// + /// locVhd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locVhd; + + /// + /// locDiskType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDiskType; + + /// + /// radioVirtualDiskType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioVirtualDiskType; + + /// + /// locExternalNetwork control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locExternalNetwork; + + /// + /// locExternalNetworkName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locExternalNetworkName; + + /// + /// ddlExternalNetworks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlExternalNetworks; + + /// + /// locPreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPreferredNameServer; + + /// + /// externalPreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl externalPreferredNameServer; + + /// + /// locAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locAlternateNameServer; + + /// + /// externalAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl externalAlternateNameServer; + + /// + /// chkAssignIPAutomatically control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkAssignIPAutomatically; + + /// + /// ManageUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel ManageUpdatePanel; + + /// + /// locManagementNetwork control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManagementNetwork; + + /// + /// locManagementNetworkName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManagementNetworkName; + + /// + /// ddlManagementNetworks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlManagementNetworks; + + /// + /// ManageNicConfigRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ManageNicConfigRow; + + /// + /// locManageNicConfig control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManageNicConfig; + + /// + /// ddlManageNicConfig control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlManageNicConfig; + + /// + /// ManagePreferredNameServerRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ManagePreferredNameServerRow; + + /// + /// locManagePreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManagePreferredNameServer; + + /// + /// managePreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl managePreferredNameServer; + + /// + /// ManageAlternateNameServerRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ManageAlternateNameServerRow; + + /// + /// locManageAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManageAlternateNameServer; + + /// + /// manageAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl manageAlternateNameServer; + + /// + /// PrivUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel PrivUpdatePanel; + + /// + /// locPrivateNetwork control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivateNetwork; + + /// + /// locIPFormat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locIPFormat; + + /// + /// ddlPrivateNetworkFormat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPrivateNetworkFormat; + + /// + /// PrivCustomFormatRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PrivCustomFormatRow; + + /// + /// locPrivCustomFormat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivCustomFormat; + + /// + /// privateIPAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privateIPAddress; + + /// + /// privateSubnetMask control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox privateSubnetMask; + + /// + /// privateSubnetMaskValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator privateSubnetMaskValidator; + + /// + /// locPrivDefaultGateway control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivDefaultGateway; + + /// + /// privateDefaultGateway control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privateDefaultGateway; + + /// + /// locPrivPreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivPreferredNameServer; + + /// + /// privatePreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privatePreferredNameServer; + + /// + /// locPrivAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivAlternateNameServer; + + /// + /// privateAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privateAlternateNameServer; + + /// + /// locHostname control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locHostname; + + /// + /// locHostnamePattern control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locHostnamePattern; + + /// + /// txtHostnamePattern control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtHostnamePattern; + + /// + /// HostnamePatternValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator HostnamePatternValidator; + + /// + /// locPatternText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPatternText; + + /// + /// locStartAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartAction; + + /// + /// locStartOptionsText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartOptionsText; + + /// + /// radioStartAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioStartAction; + + /// + /// locStartupDelayText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartupDelayText; + + /// + /// locStartupDelay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartupDelay; + + /// + /// txtStartupDelay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtStartupDelay; + + /// + /// locSeconds control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSeconds; + + /// + /// StartupDelayValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator StartupDelayValidator; + + /// + /// locStopAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStopAction; + + /// + /// locStopActionText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStopActionText; + + /// + /// radioStopAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioStopAction; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index ca62cd3b..388618e7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -258,6 +258,13 @@ EnterpriseStorageOwaUsersList.ascx + + HyperV2012R2_Settings.ascx + ASPXCodeBehind + + + HyperV2012R2_Settings.ascx + HyperV2012R2_Create.ascx ASPXCodeBehind @@ -4517,6 +4524,7 @@ + @@ -4570,6 +4578,9 @@ Designer + + Designer +