wsp-10323 bugfix + Step 8

This commit is contained in:
me 2015-03-23 09:12:14 +04:00
parent 1c4039445b
commit a26a67cbf7
13 changed files with 297 additions and 538 deletions

View file

@ -29,7 +29,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.3074 // Runtime Version:2.0.50727.5466
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -40,7 +40,6 @@
// This source code was auto-generated by wsdl, Version=2.0.50727.42. // This source code was auto-generated by wsdl, Version=2.0.50727.42.
// //
namespace WebsitePanel.EnterpriseServer { namespace WebsitePanel.EnterpriseServer {
using System.Xml.Serialization; using System.Xml.Serialization;
using System.Web.Services; using System.Web.Services;
using System.ComponentModel; using System.ComponentModel;
@ -171,10 +170,12 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback SendVirtualMachineSummaryLetterOperationCompleted; private System.Threading.SendOrPostCallback SendVirtualMachineSummaryLetterOperationCompleted;
/// <remarks/> /// <remarks/>
public esVirtualizationServer() { public esVirtualizationServer()
{
this.Url = "http://127.0.0.1:9002/esVirtualizationServer.asmx"; this.Url = "http://127.0.0.1:9002/esVirtualizationServer.asmx";
} }
/// <remarks/> /// <remarks/>
public event GetVirtualMachinesCompletedEventHandler GetVirtualMachinesCompleted; public event GetVirtualMachinesCompletedEventHandler GetVirtualMachinesCompleted;
@ -949,8 +950,8 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOperatingSystemTemplatesByServi" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOperatingSystemTemplatesByService" +
"ceId", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] "Id", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public LibraryItem[] GetOperatingSystemTemplatesByServiceId(int serviceId) { public LibraryItem[] GetOperatingSystemTemplatesByServiceId(int serviceId) {
object[] results = this.Invoke("GetOperatingSystemTemplatesByServiceId", new object[] { object[] results = this.Invoke("GetOperatingSystemTemplatesByServiceId", new object[] {
serviceId}); serviceId});
@ -1133,6 +1134,7 @@ namespace WebsitePanel.EnterpriseServer {
string osTemplateFile, string osTemplateFile,
string password, string password,
string summaryLetterEmail, string summaryLetterEmail,
int generation,
int cpuCores, int cpuCores,
int ramMB, int ramMB,
int hddGB, int hddGB,
@ -1159,6 +1161,7 @@ namespace WebsitePanel.EnterpriseServer {
osTemplateFile, osTemplateFile,
password, password,
summaryLetterEmail, summaryLetterEmail,
generation,
cpuCores, cpuCores,
ramMB, ramMB,
hddGB, hddGB,
@ -1189,6 +1192,7 @@ namespace WebsitePanel.EnterpriseServer {
string osTemplateFile, string osTemplateFile,
string password, string password,
string summaryLetterEmail, string summaryLetterEmail,
int generation,
int cpuCores, int cpuCores,
int ramMB, int ramMB,
int hddGB, int hddGB,
@ -1217,6 +1221,7 @@ namespace WebsitePanel.EnterpriseServer {
osTemplateFile, osTemplateFile,
password, password,
summaryLetterEmail, summaryLetterEmail,
generation,
cpuCores, cpuCores,
ramMB, ramMB,
hddGB, hddGB,
@ -1252,6 +1257,7 @@ namespace WebsitePanel.EnterpriseServer {
string osTemplateFile, string osTemplateFile,
string password, string password,
string summaryLetterEmail, string summaryLetterEmail,
int generation,
int cpuCores, int cpuCores,
int ramMB, int ramMB,
int hddGB, int hddGB,
@ -1272,7 +1278,7 @@ namespace WebsitePanel.EnterpriseServer {
int privateAddressesNumber, int privateAddressesNumber,
bool randomPrivateAddresses, bool randomPrivateAddresses,
string[] privateAddresses) { string[] privateAddresses) {
this.CreateVirtualMachineAsync(packageId, hostname, osTemplateFile, password, summaryLetterEmail, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, null); this.CreateVirtualMachineAsync(packageId, hostname, osTemplateFile, password, summaryLetterEmail, generation, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, null);
} }
/// <remarks/> /// <remarks/>
@ -1282,6 +1288,7 @@ namespace WebsitePanel.EnterpriseServer {
string osTemplateFile, string osTemplateFile,
string password, string password,
string summaryLetterEmail, string summaryLetterEmail,
int generation,
int cpuCores, int cpuCores,
int ramMB, int ramMB,
int hddGB, int hddGB,
@ -1312,6 +1319,7 @@ namespace WebsitePanel.EnterpriseServer {
osTemplateFile, osTemplateFile,
password, password,
summaryLetterEmail, summaryLetterEmail,
generation,
cpuCores, cpuCores,
ramMB, ramMB,
hddGB, hddGB,
@ -2462,8 +2470,8 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachineExternalIPAddress" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachineExternalIPAddresses" +
"es", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] "", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject AddVirtualMachineExternalIPAddresses(int itemId, bool selectRandom, int addressesNumber, int[] addressId) { public ResultObject AddVirtualMachineExternalIPAddresses(int itemId, bool selectRandom, int addressesNumber, int[] addressId) {
object[] results = this.Invoke("AddVirtualMachineExternalIPAddresses", new object[] { object[] results = this.Invoke("AddVirtualMachineExternalIPAddresses", new object[] {
itemId, itemId,
@ -2513,8 +2521,8 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryExternalIP" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryExternalIPAd" +
"Address", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] "dress", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject SetVirtualMachinePrimaryExternalIPAddress(int itemId, int addressId) { public ResultObject SetVirtualMachinePrimaryExternalIPAddress(int itemId, int addressId) {
object[] results = this.Invoke("SetVirtualMachinePrimaryExternalIPAddress", new object[] { object[] results = this.Invoke("SetVirtualMachinePrimaryExternalIPAddress", new object[] {
itemId, itemId,
@ -2558,8 +2566,8 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachineExternalIPAddr" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachineExternalIPAddres" +
"esses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] "ses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject DeleteVirtualMachineExternalIPAddresses(int itemId, int[] addressId) { public ResultObject DeleteVirtualMachineExternalIPAddresses(int itemId, int[] addressId) {
object[] results = this.Invoke("DeleteVirtualMachineExternalIPAddresses", new object[] { object[] results = this.Invoke("DeleteVirtualMachineExternalIPAddresses", new object[] {
itemId, itemId,
@ -2644,8 +2652,7 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachinePrivateIPAddresse" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachinePrivateIPAddresses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
"s", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject AddVirtualMachinePrivateIPAddresses(int itemId, bool selectRandom, int addressesNumber, string[] addresses) { public ResultObject AddVirtualMachinePrivateIPAddresses(int itemId, bool selectRandom, int addressesNumber, string[] addresses) {
object[] results = this.Invoke("AddVirtualMachinePrivateIPAddresses", new object[] { object[] results = this.Invoke("AddVirtualMachinePrivateIPAddresses", new object[] {
itemId, itemId,
@ -2695,8 +2702,8 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryPrivateIPA" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryPrivateIPAdd" +
"ddress", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] "ress", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject SetVirtualMachinePrimaryPrivateIPAddress(int itemId, int addressId) { public ResultObject SetVirtualMachinePrimaryPrivateIPAddress(int itemId, int addressId) {
object[] results = this.Invoke("SetVirtualMachinePrimaryPrivateIPAddress", new object[] { object[] results = this.Invoke("SetVirtualMachinePrimaryPrivateIPAddress", new object[] {
itemId, itemId,
@ -2740,8 +2747,8 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachinePrivateIPAddre" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachinePrivateIPAddress" +
"sses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] "es", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public ResultObject DeleteVirtualMachinePrivateIPAddresses(int itemId, int[] addressId) { public ResultObject DeleteVirtualMachinePrivateIPAddresses(int itemId, int[] addressId) {
object[] results = this.Invoke("DeleteVirtualMachinePrivateIPAddresses", new object[] { object[] results = this.Invoke("DeleteVirtualMachinePrivateIPAddresses", new object[] {
itemId, itemId,
@ -2826,8 +2833,7 @@ namespace WebsitePanel.EnterpriseServer {
} }
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateVirtualMachineUserPermission" + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateVirtualMachineUserPermissions", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
"s", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int UpdateVirtualMachineUserPermissions(int itemId, VirtualMachinePermission[] permissions) { public int UpdateVirtualMachineUserPermissions(int itemId, VirtualMachinePermission[] permissions) {
object[] results = this.Invoke("UpdateVirtualMachineUserPermissions", new object[] { object[] results = this.Invoke("UpdateVirtualMachineUserPermissions", new object[] {
itemId, itemId,
@ -3112,36 +3118,8 @@ namespace WebsitePanel.EnterpriseServer {
public new void CancelAsync(object userState) { public new void CancelAsync(object userState) {
base.CancelAsync(userState); base.CancelAsync(userState);
} }
} }
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void GetVirtualMachinesCompletedEventHandler(object sender, GetVirtualMachinesCompletedEventArgs e); public delegate void GetVirtualMachinesCompletedEventHandler(object sender, GetVirtualMachinesCompletedEventArgs e);
@ -4602,5 +4580,4 @@ namespace WebsitePanel.EnterpriseServer {
} }
} }
} }
} }

View file

@ -37,7 +37,10 @@ using System.ComponentModel;
using WebsitePanel.Providers.Common; using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.ResultObjects;
using Microsoft.Web.Services3; using Microsoft.Web.Services3;
using WebsitePanel.Providers;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.Virtualization;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.Virtualization;
namespace WebsitePanel.EnterpriseServer namespace WebsitePanel.EnterpriseServer
@ -183,7 +186,7 @@ namespace WebsitePanel.EnterpriseServer
[WebMethod] [WebMethod]
public IntResult CreateVirtualMachine(int packageId, public IntResult CreateVirtualMachine(int packageId,
string hostname, string osTemplateFile, string password, string summaryLetterEmail, string hostname, string osTemplateFile, string password, string summaryLetterEmail,
int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, int generation, int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock,
bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed,
bool externalNetworkEnabled, int externalAddressesNumber, bool randomExternalAddresses, int[] externalAddresses, bool externalNetworkEnabled, int externalAddressesNumber, bool randomExternalAddresses, int[] externalAddresses,
bool privateNetworkEnabled, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses) bool privateNetworkEnabled, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses)

View file

@ -35,9 +35,9 @@ namespace WebsitePanel.Providers.Virtualization
public class MemoryInfo public class MemoryInfo
{ {
public bool DynamicMemoryEnabled { get; set; } public bool DynamicMemoryEnabled { get; set; }
public Int64 Startup { get; set; } public int Startup { get; set; }
public Int64 Minimum { get; set; } public int Minimum { get; set; }
public Int64 Maximum { get; set; } public int Maximum { get; set; }
public int Buffer { get; set; } public int Buffer { get; set; }
public int Priority { get; set; } public int Priority { get; set; }
} }

View file

@ -69,8 +69,8 @@ namespace WebsitePanel.Providers.Virtualization
public int CpuUsage { get; set; } public int CpuUsage { get; set; }
[Persistent] [Persistent]
public long RamSize { get; set; } public int RamSize { get; set; }
public long RamUsage { get; set; } public int RamUsage { get; set; }
[Persistent] [Persistent]
public int HddSize { get; set; } public int HddSize { get; set; }
public LogicalDisk[] HddLogicalDisks { get; set; } public LogicalDisk[] HddLogicalDisks { get; set; }

View file

@ -21,7 +21,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("VMName", name); cmd.Parameters.Add("VMName", name);
cmd.Parameters.Add("Name", "HeartBeat"); cmd.Parameters.Add("Name", "HeartBeat");
Collection<PSObject> result = powerShell.Execute(cmd, false); Collection<PSObject> result = powerShell.Execute(cmd, true);
if (result != null && result.Count > 0) if (result != null && result.Count > 0)
{ {
var statusString = result[0].GetProperty("PrimaryOperationalStatus"); var statusString = result[0].GetProperty("PrimaryOperationalStatus");
@ -41,7 +41,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("VMName", name); cmd.Parameters.Add("VMName", name);
Collection<PSObject> result = powerShell.Execute(cmd, false); Collection<PSObject> result = powerShell.Execute(cmd, true);
if (result != null && result.Count > 0) if (result != null && result.Count > 0)
{ {
procs = Convert.ToInt32(result[0].GetProperty("Count")); procs = Convert.ToInt32(result[0].GetProperty("Count"));
@ -58,13 +58,13 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("VMName", name); cmd.Parameters.Add("VMName", name);
Collection<PSObject> result = powerShell.Execute(cmd, false); Collection<PSObject> result = powerShell.Execute(cmd, true);
if (result != null && result.Count > 0) if (result != null && result.Count > 0)
{ {
info.DynamicMemoryEnabled = Convert.ToBoolean(result[0].GetProperty("DynamicMemoryEnabled")); info.DynamicMemoryEnabled = Convert.ToBoolean(result[0].GetProperty("DynamicMemoryEnabled"));
info.Startup = Convert.ToInt64(result[0].GetProperty("Startup")) / Constants.Size1M; info.Startup = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Startup")) / Constants.Size1M);
info.Minimum = Convert.ToInt64(result[0].GetProperty("Minimum")) / Constants.Size1M; info.Minimum = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Minimum")) / Constants.Size1M);
info.Maximum = Convert.ToInt64(result[0].GetProperty("Maximum")) / Constants.Size1M; info.Maximum = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Maximum")) / Constants.Size1M);
info.Buffer = Convert.ToInt32(result[0].GetProperty("Buffer")); info.Buffer = Convert.ToInt32(result[0].GetProperty("Buffer"));
info.Priority = Convert.ToInt32(result[0].GetProperty("Priority")); info.Priority = Convert.ToInt32(result[0].GetProperty("Priority"));
} }
@ -81,7 +81,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("Reserve", Convert.ToInt64(cpuReserveSettings * 1000)); cmd.Parameters.Add("Reserve", Convert.ToInt64(cpuReserveSettings * 1000));
cmd.Parameters.Add("RelativeWeight", cpuWeightSettings); cmd.Parameters.Add("RelativeWeight", cpuWeightSettings);
powerShell.Execute(cmd, false); powerShell.Execute(cmd, true);
} }
public static void UpdateMemory(PowerShellManager powerShell, VirtualMachine vm, long ramMB) public static void UpdateMemory(PowerShellManager powerShell, VirtualMachine vm, long ramMB)
@ -91,7 +91,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("VMName", vm.Name);
cmd.Parameters.Add("StartupBytes", ramMB * Constants.Size1M); cmd.Parameters.Add("StartupBytes", ramMB * Constants.Size1M);
powerShell.Execute(cmd, false); powerShell.Execute(cmd, true);
} }
} }
} }

View file

@ -57,25 +57,6 @@ namespace WebsitePanel.Providers.Virtualization
{ {
public class HyperV2012R2 : HostingServiceProviderBase, IVirtualizationServer public class HyperV2012R2 : HostingServiceProviderBase, IVirtualizationServer
{ {
#region Constants
private const string CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG = "WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag";
private const string WMI_VIRTUALIZATION_NAMESPACE = @"root\virtualization\v2";
private const string WMI_CIMV2_NAMESPACE = @"root\cimv2";
private const int SWITCH_PORTS_NUMBER = 1024;
private const string LIBRARY_INDEX_FILE_NAME = "index.xml";
private const string EXTERNAL_NETWORK_ADAPTER_NAME = "External Network Adapter";
private const string PRIVATE_NETWORK_ADAPTER_NAME = "Private Network Adapter";
private const string MANAGEMENT_NETWORK_ADAPTER_NAME = "Management Network Adapter";
private const string KVP_RAM_SUMMARY_KEY = "VM-RAM-Summary";
private const string KVP_HDD_SUMMARY_KEY = "VM-HDD-Summary";
private const Int64 Size1G = 0x40000000;
private const Int64 Size1M = 0x100000;
#endregion
#region Provider Settings #region Provider Settings
protected string ServerNameSettings protected string ServerNameSettings
{ {
@ -119,16 +100,17 @@ namespace WebsitePanel.Providers.Virtualization
#endregion #endregion
#region Fields #region Fields
private Wmi _wmi = null;
private PowerShellManager _powerShell;
protected PowerShellManager PowerShell
{
get { return _powerShell ?? (_powerShell = new PowerShellManager(ServerNameSettings)); }
}
private Wmi _wmi;
private Wmi wmi private Wmi wmi
{ {
get get { return _wmi ?? (_wmi = new Wmi(ServerNameSettings, Constants.WMI_VIRTUALIZATION_NAMESPACE)); }
{
if (_wmi == null)
_wmi = new Wmi(ServerNameSettings, WMI_VIRTUALIZATION_NAMESPACE);
return _wmi;
}
} }
#endregion #endregion
@ -163,13 +145,13 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("Id", vmId); cmd.Parameters.Add("Id", vmId);
Collection<PSObject> result = PowerShell.Execute(cmd, false); Collection<PSObject> result = PowerShell.Execute(cmd, true);
if (result != null && result.Count > 0) if (result != null && result.Count > 0)
{ {
vm.Name = result[0].GetProperty("Name").ToString(); vm.Name = result[0].GetProperty("Name").ToString();
vm.State = result[0].GetEnum<VirtualMachineState>("State"); vm.State = result[0].GetEnum<VirtualMachineState>("State");
vm.CpuUsage = ConvertNullableToInt32(result[0].GetProperty("CpuUsage")); vm.CpuUsage = ConvertNullableToInt32(result[0].GetProperty("CpuUsage"));
vm.RamUsage = ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Size1M; vm.RamUsage = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Constants.Size1M);
vm.Uptime = Convert.ToInt64(result[0].GetProperty<TimeSpan>("UpTime").TotalMilliseconds); vm.Uptime = Convert.ToInt64(result[0].GetProperty<TimeSpan>("UpTime").TotalMilliseconds);
vm.Status = result[0].GetProperty("Status").ToString(); vm.Status = result[0].GetProperty("Status").ToString();
vm.ReplicationState = result[0].GetProperty("ReplicationState").ToString(); vm.ReplicationState = result[0].GetProperty("ReplicationState").ToString();
@ -203,7 +185,7 @@ namespace WebsitePanel.Providers.Virtualization
if (vm.Disks != null && vm.Disks.GetLength(0) > 0) if (vm.Disks != null && vm.Disks.GetLength(0) > 0)
{ {
vm.VirtualHardDrivePath = vm.Disks[0].Path; vm.VirtualHardDrivePath = vm.Disks[0].Path;
vm.HddSize = Convert.ToInt32(vm.Disks[0].FileSize / Size1G); vm.HddSize = Convert.ToInt32(vm.Disks[0].FileSize / Constants.Size1G);
} }
// network adapters // network adapters
@ -219,7 +201,6 @@ namespace WebsitePanel.Providers.Virtualization
HostedSolutionLog.LogEnd("GetVirtualMachine"); HostedSolutionLog.LogEnd("GetVirtualMachine");
return vm; return vm;
} }
public List<VirtualMachine> GetVirtualMachines() public List<VirtualMachine> GetVirtualMachines()
@ -232,7 +213,7 @@ namespace WebsitePanel.Providers.Virtualization
{ {
Command cmd = new Command("Get-VM"); Command cmd = new Command("Get-VM");
Collection<PSObject> result = PowerShell.Execute(cmd, false); Collection<PSObject> result = PowerShell.Execute(cmd, true);
foreach (PSObject current in result) foreach (PSObject current in result)
{ {
VirtualMachine vm = new VirtualMachine VirtualMachine vm = new VirtualMachine
@ -332,8 +313,9 @@ namespace WebsitePanel.Providers.Virtualization
// Add new VM // Add new VM
Command cmdNew = new Command("New-VM"); Command cmdNew = new Command("New-VM");
cmdNew.Parameters.Add("Name", vm.Name); cmdNew.Parameters.Add("Name", vm.Name);
cmdNew.Parameters.Add("Generation", vm.Generation > 1 ? vm.Generation : 1);
cmdNew.Parameters.Add("VHDPath", vm.VirtualHardDrivePath); cmdNew.Parameters.Add("VHDPath", vm.VirtualHardDrivePath);
PowerShell.Execute(cmdNew, false); PowerShell.Execute(cmdNew, true);
// Set VM // Set VM
Command cmdSet = new Command("Set-VM"); Command cmdSet = new Command("Set-VM");
@ -350,7 +332,7 @@ namespace WebsitePanel.Providers.Virtualization
} }
if (autoStopAction != AutomaticStopAction.Undefined) if (autoStopAction != AutomaticStopAction.Undefined)
cmdSet.Parameters.Add("AutomaticStopAction", autoStopAction.ToString()); cmdSet.Parameters.Add("AutomaticStopAction", autoStopAction.ToString());
PowerShell.Execute(cmdSet, false); PowerShell.Execute(cmdSet, true);
// Get created machine Id // Get created machine Id
var createdMachine = GetVirtualMachines().FirstOrDefault(m => m.Name == vm.Name); var createdMachine = GetVirtualMachines().FirstOrDefault(m => m.Name == vm.Name);
@ -396,168 +378,6 @@ namespace WebsitePanel.Providers.Virtualization
return vm; return vm;
} }
private void AddVirtualMachineDvdDrive(string vmId, ManagementObject objVM)
{
// load IDE 1 controller
ManagementObject objIDE1 = wmi.GetWmiObject(
"Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Emulated IDE Controller'"
+ " and InstanceID Like 'Microsoft:{0}%' and Address = 1", vmId);
// load default hard disk drive
ManagementObject objDefaultDvd = wmi.GetWmiObject(
"Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'"
+ " and InstanceID like '%Default'");
ManagementObject objDvd = (ManagementObject)objDefaultDvd.Clone();
objDvd["Parent"] = objIDE1.Path;
objDvd["Address"] = 0;
// add DVD drive to VM resources
AddVirtualMachineResources(objVM, objDvd);
}
private void AddNetworkAdapter(ManagementObject objVm, string switchId, string portName, string macAddress, string adapterName, bool legacyAdapter)
{
string nicClassName = GetNetworkAdapterClassName(legacyAdapter);
string vmId = (string)objVm["Name"];
// check if already exists
ManagementObject objNic = wmi.GetWmiObject(
nicClassName, "InstanceID like 'Microsoft:{0}%' and Address = '{1}'", vmId, macAddress);
if (objNic != null)
return; // exists - exit
portName = String.Format("{0} - {1}",
portName, (adapterName == EXTERNAL_NETWORK_ADAPTER_NAME) ? "External" : "Private");
// Network service
ManagementObject objNetworkSvc = GetVirtualSwitchManagementService();
// default NIC
ManagementObject objDefaultNic = wmi.GetWmiObject(nicClassName, "InstanceID like '%Default'");
// find switch
ManagementObject objSwitch = wmi.GetWmiObject("msvm_VirtualSwitch", "Name = '{0}'", switchId);
// create switch port
ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("CreateSwitchPort");
inParams["VirtualSwitch"] = objSwitch;
inParams["Name"] = portName;
inParams["FriendlyName"] = portName;
inParams["ScopeOfResidence"] = "";
// invoke method
ManagementBaseObject outParams = objNetworkSvc.InvokeMethod("CreateSwitchPort", inParams, null);
// process output parameters
ReturnCode code = (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]);
if (code == ReturnCode.OK)
{
// created port
ManagementObject objPort = wmi.GetWmiObjectByPath((string)outParams["CreatedSwitchPort"]);
// create NIC
ManagementObject objExtNic = (ManagementObject)objDefaultNic.Clone();
objExtNic["Connection"] = new string[] { objPort.Path.Path };
if (!String.IsNullOrEmpty(macAddress))
{
objExtNic["StaticMacAddress"] = true;
objExtNic["Address"] = macAddress;
}
else
{
objExtNic["StaticMacAddress"] = false;
}
objExtNic["ElementName"] = adapterName;
if (!legacyAdapter)
objExtNic["VirtualSystemIdentifiers"] = new string[] { Guid.NewGuid().ToString("B") };
// add NIC
ManagementObject objCreatedExtNic = AddVirtualMachineResources(objVm, objExtNic);
}
}
private string GetNetworkAdapterClassName(bool legacy)
{
return legacy ? "Msvm_EmulatedEthernetPortSettingData" : "Msvm_SyntheticEthernetPortSettingData";
}
private ManagementObject AddVirtualMachineResources(ManagementObject objVm, ManagementObject resource)
{
if (resource == null)
return resource;
// request management service
ManagementObject objVmsvc = GetVirtualSystemManagementService();
// add resources
string txtResource = resource.GetText(TextFormat.CimDtd20);
ManagementBaseObject inParams = objVmsvc.GetMethodParameters("AddVirtualSystemResources");
inParams["TargetSystem"] = objVm;
inParams["ResourceSettingData"] = new string[] { txtResource };
ManagementBaseObject outParams = objVmsvc.InvokeMethod("AddVirtualSystemResources", inParams, null);
JobResult result = CreateJobResultFromWmiMethodResults(outParams);
if (result.ReturnValue == ReturnCode.OK)
{
string[] wmiPaths = (string[])outParams["NewResources"];
return wmi.GetWmiObjectByPath(wmiPaths[0]);
}
else if (result.ReturnValue == ReturnCode.JobStarted)
{
if (JobCompleted(result.Job))
{
string[] wmiPaths = (string[])outParams["NewResources"];
return wmi.GetWmiObjectByPath(wmiPaths[0]);
}
else
{
throw new Exception("Cannot add virtual machine resources");
}
}
else
{
throw new Exception("Cannot add virtual machine resources: " + txtResource);
}
}
private JobResult RemoveVirtualMachineResources(ManagementObject objVm, ManagementObject resource)
{
if (resource == null)
return null;
// request management service
ManagementObject objVmsvc = GetVirtualSystemManagementService();
// remove resources
ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveVirtualSystemResources");
inParams["TargetSystem"] = objVm;
inParams["ResourceSettingData"] = new string[] { resource.Path.Path };
ManagementBaseObject outParams = objVmsvc.InvokeMethod("RemoveVirtualSystemResources", inParams, null);
JobResult result = CreateJobResultFromWmiMethodResults(outParams);
if (result.ReturnValue == ReturnCode.OK)
{
return result;
}
else if (result.ReturnValue == ReturnCode.JobStarted)
{
if (!JobCompleted(result.Job))
{
throw new Exception("Cannot remove virtual machine resources");
}
}
else
{
throw new Exception("Cannot remove virtual machine resources: " + resource.Path.Path);
}
return result;
}
public JobResult ChangeVirtualMachineState(string vmId, VirtualMachineRequestedState newState) public JobResult ChangeVirtualMachineState(string vmId, VirtualMachineRequestedState newState)
{ {
HostedSolutionLog.LogStart("ChangeVirtualMachineState"); HostedSolutionLog.LogStart("ChangeVirtualMachineState");
@ -604,8 +424,8 @@ namespace WebsitePanel.Providers.Virtualization
//cmd.Parameters.Add("AsJob"); //cmd.Parameters.Add("AsJob");
paramList.ForEach(p => cmd.Parameters.Add(p)); paramList.ForEach(p => cmd.Parameters.Add(p));
PowerShell.Execute(cmd, false); PowerShell.Execute(cmd, true);
jobResult = JobHelper.CreateSuccessResult(); jobResult = JobHelper.CreateSuccessResult(ReturnCode.JobStarted);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -633,7 +453,7 @@ namespace WebsitePanel.Providers.Virtualization
if (force) cmd.Parameters.Add("Force"); if (force) cmd.Parameters.Add("Force");
//if (!string.IsNullOrEmpty(reason)) cmd.Parameters.Add("Reason", reason); //if (!string.IsNullOrEmpty(reason)) cmd.Parameters.Add("Reason", reason);
PowerShell.Execute(cmd, false); PowerShell.Execute(cmd, true);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -665,134 +485,60 @@ namespace WebsitePanel.Providers.Virtualization
public JobResult RenameVirtualMachine(string vmId, string name) public JobResult RenameVirtualMachine(string vmId, string name)
{ {
// load virtual machine var vm = GetVirtualMachine(vmId);
ManagementObject objVm = GetVirtualMachineObject(vmId);
// load machine settings Command cmdSet = new Command("Rename-VM");
ManagementObject objVmSettings = GetVirtualMachineSettingsObject(vmId); cmdSet.Parameters.Add("Name", vm.Name);
cmdSet.Parameters.Add("NewName", name);
PowerShell.Execute(cmdSet, true);
// rename machine return JobHelper.CreateSuccessResult();
objVmSettings["ElementName"] = name;
// save
ManagementObject objVmsvc = GetVirtualSystemManagementService();
ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ModifyVirtualSystem");
inParams["ComputerSystem"] = objVm.Path.Path;
inParams["SystemSettingData"] = objVmSettings.GetText(TextFormat.CimDtd20);
ManagementBaseObject outParams = objVmsvc.InvokeMethod("ModifyVirtualSystem", inParams, null);
return CreateJobResultFromWmiMethodResults(outParams);
} }
public JobResult DeleteVirtualMachine(string vmId) public JobResult DeleteVirtualMachine(string vmId)
{ {
// load virtual machine object var vm = GetVirtualMachineEx(vmId);
ManagementObject objVm = GetVirtualMachineObject(vmId);
// check state
VirtualMachine vm = GetVirtualMachine(vmId);
// The virtual computer system must be in the powered off or saved state prior to calling this method. // The virtual computer system must be in the powered off or saved state prior to calling this method.
if (vm.State == VirtualMachineState.Saved if (vm.State != VirtualMachineState.Saved && vm.State != VirtualMachineState.Off)
|| vm.State == VirtualMachineState.Off)
{
// delete network adapters and ports
DeleteNetworkAdapters(objVm);
// destroy machine
ManagementObject objVmsvc = GetVirtualSystemManagementService();
// get method
ManagementBaseObject inParams = objVmsvc.GetMethodParameters("DestroyVirtualSystem");
inParams["ComputerSystem"] = objVm;
// invoke method
ManagementBaseObject outParams = objVmsvc.InvokeMethod("DestroyVirtualSystem", inParams, null);
return CreateJobResultFromWmiMethodResults(outParams);
}
else
{
throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Destroy method."); throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Destroy method.");
}
}
private void DeleteNetworkAdapters(ManagementObject objVM) // Delete network adapters and network switchesw
foreach (var networkAdapter in vm.Adapters)
{ {
string vmId = (string)objVM["Name"]; NetworkAdapterHelper.Delete(PowerShell, vm.Name, networkAdapter);
// delete synthetic adapters if (!string.IsNullOrEmpty(networkAdapter.SwitchName))
foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_SyntheticEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) DeleteSwitch(networkAdapter.SwitchName);
DeleteNetworkAdapter(objVM, objNic);
// delete legacy adapters
foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_EmulatedEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId))
DeleteNetworkAdapter(objVM, objNic);
} }
private void DeleteNetworkAdapter(ManagementObject objVM, string macAddress) object[] errors;
{
// locate network adapter
ManagementObject objNic = wmi.GetWmiObject("CIM_ResourceAllocationSettingData", "Address = '{0}'", macAddress);
// delete adapter Command cmdSet = new Command("Remove-VM");
DeleteNetworkAdapter(objVM, objNic); cmdSet.Parameters.Add("Name", vm.Name);
} cmdSet.Parameters.Add("Force");
PowerShell.Execute(cmdSet, false, out errors);
private void DeleteNetworkAdapter(ManagementObject objVM, ManagementObject objNic) PowerShellManager.ExceptionIfErrors(errors);
{
if (objNic == null)
return;
// delete corresponding switch port return JobHelper.CreateSuccessResult(ReturnCode.JobStarted);
string[] conn = (string[])objNic["Connection"];
if (conn != null && conn.Length > 0)
DeleteSwitchPort(conn[0]);
// delete adapter
RemoveVirtualMachineResources(objVM, objNic);
}
private void DeleteSwitchPort(string portPath)
{
// Network service
ManagementObject objNetworkSvc = GetVirtualSwitchManagementService();
// create switch port
ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("DeleteSwitchPort");
inParams["SwitchPort"] = portPath;
// invoke method
objNetworkSvc.InvokeMethod("DeleteSwitchPort", inParams, null);
} }
public JobResult ExportVirtualMachine(string vmId, string exportPath) public JobResult ExportVirtualMachine(string vmId, string exportPath)
{ {
// load virtual machine object var vm = GetVirtualMachine(vmId);
ManagementObject objVm = GetVirtualMachineObject(vmId);
// check state
VirtualMachine vm = GetVirtualMachine(vmId);
// The virtual computer system must be in the powered off or saved state prior to calling this method. // The virtual computer system must be in the powered off or saved state prior to calling this method.
if (vm.State == VirtualMachineState.Off) if (vm.State != VirtualMachineState.Off)
{
// export machine
ManagementObject objVmsvc = GetVirtualSystemManagementService();
// get method
ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ExportVirtualSystem");
inParams["ComputerSystem"] = objVm;
inParams["CopyVmState"] = true;
inParams["ExportDirectory"] = FileUtils.EvaluateSystemVariables(exportPath);
// invoke method
ManagementBaseObject outParams = objVmsvc.InvokeMethod("ExportVirtualSystem", inParams, null);
return CreateJobResultFromWmiMethodResults(outParams);
}
else
{
throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Export method."); throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Export method.");
Command cmdSet = new Command("Export-VM");
cmdSet.Parameters.Add("Name", vm.Name);
cmdSet.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(exportPath));
PowerShell.Execute(cmdSet, true);
return JobHelper.CreateSuccessResult(ReturnCode.JobStarted);
} }
}
#endregion #endregion
#region Snapshots #region Snapshots
@ -808,7 +554,7 @@ namespace WebsitePanel.Providers.Virtualization
Command cmd = new Command("Get-VMSnapshot"); Command cmd = new Command("Get-VMSnapshot");
cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("VMName", vm.Name);
Collection<PSObject> result = PowerShell.Execute(cmd, false); Collection<PSObject> result = PowerShell.Execute(cmd, true);
if (result != null && result.Count > 0) if (result != null && result.Count > 0)
{ {
foreach (PSObject psSnapshot in result) foreach (PSObject psSnapshot in result)
@ -833,7 +579,7 @@ namespace WebsitePanel.Providers.Virtualization
Command cmd = new Command("Get-VMSnapshot"); Command cmd = new Command("Get-VMSnapshot");
cmd.Parameters.Add("Id", snapshotId); cmd.Parameters.Add("Id", snapshotId);
Collection<PSObject> result = PowerShell.Execute(cmd, false); Collection<PSObject> result = PowerShell.Execute(cmd, true);
if (result != null && result.Count > 0) if (result != null && result.Count > 0)
{ {
return SnapshotHelper.GetFromPS(result[0]); return SnapshotHelper.GetFromPS(result[0]);
@ -857,7 +603,7 @@ namespace WebsitePanel.Providers.Virtualization
Command cmd = new Command("Checkpoint-VM"); Command cmd = new Command("Checkpoint-VM");
cmd.Parameters.Add("Name", vm.Name); cmd.Parameters.Add("Name", vm.Name);
PowerShell.Execute(cmd, false); PowerShell.Execute(cmd, true);
return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted);
} }
catch (Exception ex) catch (Exception ex)
@ -879,7 +625,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("Name", snapshot.Name); cmd.Parameters.Add("Name", snapshot.Name);
cmd.Parameters.Add("NewName", name); cmd.Parameters.Add("NewName", name);
PowerShell.Execute(cmd, false); PowerShell.Execute(cmd, true);
return JobHelper.CreateSuccessResult(); return JobHelper.CreateSuccessResult();
} }
catch (Exception ex) catch (Exception ex)
@ -900,7 +646,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("VMName", vm.Name);
cmd.Parameters.Add("Name", snapshot.Name); cmd.Parameters.Add("Name", snapshot.Name);
PowerShell.Execute(cmd, false); PowerShell.Execute(cmd, true);
return JobHelper.CreateSuccessResult(); return JobHelper.CreateSuccessResult();
} }
catch (Exception ex) catch (Exception ex)
@ -1042,7 +788,10 @@ namespace WebsitePanel.Providers.Virtualization
if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName); if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName);
if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type); if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type);
Collection<PSObject> result = PowerShell.Execute(cmd,false); object[] errors;
Collection<PSObject> result = PowerShell.Execute(cmd, false, out errors);
PowerShellManager.ExceptionIfErrors(errors);
foreach (PSObject current in result) foreach (PSObject current in result)
{ {
VirtualSwitch sw = new VirtualSwitch(); VirtualSwitch sw = new VirtualSwitch();
@ -1083,7 +832,7 @@ namespace WebsitePanel.Providers.Virtualization
cmd.Parameters.Add("SwitchType", "Private"); cmd.Parameters.Add("SwitchType", "Private");
cmd.Parameters.Add("Name", name); cmd.Parameters.Add("Name", name);
Collection<PSObject> result = PowerShell.Execute(cmd, false); Collection<PSObject> result = PowerShell.Execute(cmd, true);
if (result != null && result.Count > 0) if (result != null && result.Count > 0)
{ {
virtualSwitch = new VirtualSwitch(); virtualSwitch = new VirtualSwitch();
@ -1102,7 +851,7 @@ namespace WebsitePanel.Providers.Virtualization
return virtualSwitch; return virtualSwitch;
} }
public ReturnCode DeleteSwitch(string switchId) public ReturnCode DeleteSwitch(string switchId) // switchId is SwitchName
{ {
HostedSolutionLog.LogStart("DeleteSwitch"); HostedSolutionLog.LogStart("DeleteSwitch");
HostedSolutionLog.DebugInfo("switchId: {0}", switchId); HostedSolutionLog.DebugInfo("switchId: {0}", switchId);
@ -1111,7 +860,8 @@ namespace WebsitePanel.Providers.Virtualization
{ {
Command cmd = new Command("Remove-VMSwitch"); Command cmd = new Command("Remove-VMSwitch");
cmd.Parameters.Add("Name", switchId); cmd.Parameters.Add("Name", switchId);
PowerShell.Execute(cmd, false); cmd.Parameters.Add("Force");
PowerShell.Execute(cmd, true);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1127,7 +877,7 @@ namespace WebsitePanel.Providers.Virtualization
#region Library #region Library
public LibraryItem[] GetLibraryItems(string path) public LibraryItem[] GetLibraryItems(string path)
{ {
path = Path.Combine(FileUtils.EvaluateSystemVariables(path), LIBRARY_INDEX_FILE_NAME); path = Path.Combine(FileUtils.EvaluateSystemVariables(path), Constants.LIBRARY_INDEX_FILE_NAME);
// convert to UNC if it is a remote computer // convert to UNC if it is a remote computer
path = ConvertToUNC(path); path = ConvertToUNC(path);
@ -1203,14 +953,6 @@ namespace WebsitePanel.Providers.Virtualization
return items.ToArray(); return items.ToArray();
} }
private string ConvertToUNC(string path)
{
if (String.IsNullOrEmpty(ServerNameSettings)
|| path.StartsWith(@"\\"))
return path;
return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$"));
}
#endregion #endregion
#region KVP #region KVP
@ -1438,15 +1180,41 @@ namespace WebsitePanel.Providers.Virtualization
} }
} }
private string GetPropertyValue(string propertyName, XmlDocument doc)
{
string xpath = string.Format(@"//PROPERTY[@NAME = '{0}']/VALUE/child::text()", propertyName);
XmlNode node = doc.SelectSingleNode(xpath);
return node != null ? node.Value : null;
}
public MountedDiskInfo MountVirtualHardDisk(string vhdPath) public MountedDiskInfo MountVirtualHardDisk(string vhdPath)
{ {
//MountedDiskInfo diskInfo = new MountedDiskInfo();
//vhdPath = FileUtils.EvaluateSystemVariables(vhdPath);
//// Mount disk
//Command cmd = new Command("Mount-VHD");
//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(); ManagementObject objImgSvc = GetImageManagementService();
// get method params // get method params
@ -1503,11 +1271,11 @@ namespace WebsitePanel.Providers.Virtualization
// check if DiskPart must be used to bring disk online and clear read-only flag // check if DiskPart must be used to bring disk online and clear read-only flag
bool useDiskPartToClearReadOnly = false; bool useDiskPartToClearReadOnly = false;
if (ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) if (ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null)
useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]);
// determine disk index for DiskPart // determine disk index for DiskPart
Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE);
ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive",
"Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}",
targetId, lun, portNumber); targetId, lun, portNumber);
@ -1640,29 +1408,23 @@ exit", Convert.ToInt32(objDisk["Index"])));
public ReturnCode UnmountVirtualHardDisk(string vhdPath) public ReturnCode UnmountVirtualHardDisk(string vhdPath)
{ {
ManagementObject objImgSvc = GetImageManagementService(); Command cmd = new Command("Dismount-VHD");
// get method params cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath));
ManagementBaseObject inParams = objImgSvc.GetMethodParameters("Unmount");
inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath);
ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("Unmount", inParams, null); PowerShell.Execute(cmd, true);
return (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); return ReturnCode.OK;
} }
public JobResult ExpandVirtualHardDisk(string vhdPath, UInt64 sizeGB) public JobResult ExpandVirtualHardDisk(string vhdPath, UInt64 sizeGB)
{ {
const UInt64 Size1G = 0x40000000; Command cmd = new Command("Resize-VHD");
ManagementObject objImgSvc = GetImageManagementService(); cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath));
cmd.Parameters.Add("SizeBytes", sizeGB * Constants.Size1G);
// get method params PowerShell.Execute(cmd, true);
ManagementBaseObject inParams = objImgSvc.GetMethodParameters("ExpandVirtualHardDisk"); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted);
inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath);
inParams["MaxInternalSize"] = sizeGB * Size1G;
ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("ExpandVirtualHardDisk", inParams, null);
return CreateJobResultFromWmiMethodResults(outParams);
} }
public JobResult ConvertVirtualHardDisk(string sourcePath, string destinationPath, VirtualHardDiskType diskType) public JobResult ConvertVirtualHardDisk(string sourcePath, string destinationPath, VirtualHardDiskType diskType)
@ -1687,7 +1449,7 @@ exit", Convert.ToInt32(objDisk["Index"])));
cmd.Parameters.Add("DestinationPath", destinationPath); cmd.Parameters.Add("DestinationPath", destinationPath);
cmd.Parameters.Add("VHDType", diskType.ToString()); cmd.Parameters.Add("VHDType", diskType.ToString());
PowerShell.Execute(cmd, false); PowerShell.Execute(cmd, true);
return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted);
} }
catch (Exception ex) catch (Exception ex)
@ -1840,53 +1602,41 @@ exit", Convert.ToInt32(objDisk["Index"])));
#region Jobs #region Jobs
public ConcreteJob GetJob(string jobId) public ConcreteJob GetJob(string jobId)
{ {
HostedSolutionLog.LogStart("GetJob"); throw new NotImplementedException();
HostedSolutionLog.DebugInfo("jobId: {0}", jobId);
Runspace runSpace = null; //HostedSolutionLog.LogStart("GetJob");
ConcreteJob job; //HostedSolutionLog.DebugInfo("jobId: {0}", jobId);
try //Runspace runSpace = null;
{ //ConcreteJob job;
Command cmd = new Command("Get-Job");
if (!string.IsNullOrEmpty(jobId)) cmd.Parameters.Add("Id", jobId); //try
//{
// Command cmd = new Command("Get-Job");
Collection<PSObject> result = PowerShell.Execute( cmd, false); // if (!string.IsNullOrEmpty(jobId)) cmd.Parameters.Add("Id", jobId);
job = JobHelper.CreateFromPSObject(result);
}
catch (Exception ex)
{
HostedSolutionLog.LogError("GetJob", ex);
throw;
}
HostedSolutionLog.LogEnd("GetJob"); // Collection<PSObject> result = PowerShell.Execute(cmd, true);
return job; // job = JobHelper.CreateFromPSObject(result);
//}
//catch (Exception ex)
//{
// HostedSolutionLog.LogError("GetJob", ex);
// throw;
//}
//HostedSolutionLog.LogEnd("GetJob");
//return job;
} }
public List<ConcreteJob> GetAllJobs() public List<ConcreteJob> GetAllJobs()
{ {
List<ConcreteJob> jobs = new List<ConcreteJob>(); throw new NotImplementedException();
ManagementObjectCollection objJobs = wmi.GetWmiObjects("CIM_ConcreteJob");
foreach (ManagementObject objJob in objJobs)
jobs.Add(CreateJobFromWmiObject(objJob));
return jobs;
} }
public ChangeJobStateReturnCode ChangeJobState(string jobId, ConcreteJobRequestedState newState) public ChangeJobStateReturnCode ChangeJobState(string jobId, ConcreteJobRequestedState newState)
{ {
ManagementObject objJob = GetJobWmiObject(jobId); throw new NotImplementedException();
// get method
ManagementBaseObject inParams = objJob.GetMethodParameters("RequestStateChange");
inParams["RequestedState"] = (Int32)newState;
// invoke method
ManagementBaseObject outParams = objJob.InvokeMethod("RequestStateChange", inParams, null);
return (ChangeJobStateReturnCode)Convert.ToInt32(outParams["ReturnValue"]);
} }
#endregion #endregion
@ -2139,15 +1889,6 @@ exit", Convert.ToInt32(objDisk["Index"])));
return value == null ? 0 : Convert.ToInt64(value); return value == null ? 0 : Convert.ToInt64(value);
} }
//protected VirtualMachineSnapshot GetSnapshotById(string id)
//{
// var vms = GetVirtualMachines();
// var allSnapshots = vms.SelectMany(vm => GetVirtualMachineSnapshots(vm.Id.ToString()));
// return allSnapshots.FirstOrDefault(s => s.Id == id);
//}
protected JobResult CreateJobResultFromWmiMethodResults(ManagementBaseObject outParams) protected JobResult CreateJobResultFromWmiMethodResults(ManagementBaseObject outParams)
{ {
JobResult result = new JobResult(); JobResult result = new JobResult();
@ -2169,21 +1910,11 @@ exit", Convert.ToInt32(objDisk["Index"])));
return result; return result;
} }
private ManagementObject GetJobWmiObject(string id)
{
return wmi.GetWmiObject("msvm_ConcreteJob", "InstanceID = '{0}'", id);
}
private ManagementObject GetVirtualSystemManagementService() private ManagementObject GetVirtualSystemManagementService()
{ {
return wmi.GetWmiObject("msvm_VirtualSystemManagementService"); return wmi.GetWmiObject("msvm_VirtualSystemManagementService");
} }
private ManagementObject GetVirtualSwitchManagementService()
{
return wmi.GetWmiObject("msvm_VirtualSwitchManagementService");
}
protected ManagementObject GetImageManagementService() protected ManagementObject GetImageManagementService()
{ {
return wmi.GetWmiObject("msvm_ImageManagementService"); return wmi.GetWmiObject("msvm_ImageManagementService");
@ -2200,18 +1931,13 @@ exit", Convert.ToInt32(objDisk["Index"])));
wmi.GetWmiObject("Msvm_VirtualSystemSettingData", "InstanceID = '{0}'", "Microsoft:" + snapshotId); wmi.GetWmiObject("Msvm_VirtualSystemSettingData", "InstanceID = '{0}'", "Microsoft:" + snapshotId);
} }
private string ConvertToUNC(string path)
private VirtualSwitch CreateSwitchFromWmiObject(ManagementObject objSwitch)
{ {
if (objSwitch == null || objSwitch.Properties.Count == 0) if (String.IsNullOrEmpty(ServerNameSettings)
return null; || path.StartsWith(@"\\"))
return path;
VirtualSwitch sw = new VirtualSwitch(); return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$"));
sw.SwitchId = (string)objSwitch["Name"];
sw.Name = (string)objSwitch["ElementName"];
return sw;
} }
private ConcreteJob CreateJobFromWmiObject(ManagementBaseObject objJob) private ConcreteJob CreateJobFromWmiObject(ManagementBaseObject objJob)
@ -2312,7 +2038,7 @@ exit", Convert.ToInt32(objDisk["Index"])));
return File.Exists(path); return File.Exists(path);
else else
{ {
Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE);
ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", path.Replace("\\", "\\\\")); ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", path.Replace("\\", "\\\\"));
return (objFile != null); return (objFile != null);
} }
@ -2324,7 +2050,7 @@ exit", Convert.ToInt32(objDisk["Index"])));
return Directory.Exists(path); return Directory.Exists(path);
else else
{ {
Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE);
ManagementObject objDir = cimv2.GetWmiObject("Win32_Directory", "Name='{0}'", path.Replace("\\", "\\\\")); ManagementObject objDir = cimv2.GetWmiObject("Win32_Directory", "Name='{0}'", path.Replace("\\", "\\\\"));
return (objDir != null); return (objDir != null);
} }
@ -2348,7 +2074,7 @@ exit", Convert.ToInt32(objDisk["Index"])));
return false; return false;
// copy using WMI // copy using WMI
Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE);
ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", sourceFileName.Replace("\\", "\\\\")); ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", sourceFileName.Replace("\\", "\\\\"));
if (objFile == null) if (objFile == null)
throw new Exception("Source file does not exists: " + sourceFileName); throw new Exception("Source file does not exists: " + sourceFileName);
@ -2499,16 +2225,5 @@ exit", Convert.ToInt32(objDisk["Index"])));
} }
#endregion Hyper-V Cloud #endregion Hyper-V Cloud
#region PowerShell integration
private PowerShellManager _powerShell;
protected PowerShellManager PowerShell
{
get { return _powerShell ?? (_powerShell = new PowerShellManager()); }
}
#endregion
} }
} }

View file

@ -0,0 +1,52 @@
// 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.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.Providers.Mail;
using WebsitePanel.Providers.Virtualization;
namespace WebsitePanel.Portal
{
/// <summary>
/// Summary description for IVirtualMachineCreateControl
/// </summary>
public interface IVirtualMachineCreateControl
{
void BindItem(VirtualMachine item);
void SaveItem(VirtualMachine item);
}
}

View file

@ -56,15 +56,15 @@ namespace WebsitePanel.Portal
set { ViewState["DisplayText"] = value; } set { ViewState["DisplayText"] = value; }
} }
public long Progress public int Progress
{ {
get { return (ViewState["Progress"] != null) ? (long)ViewState["Progress"] : 0; } get { return (ViewState["Progress"] != null) ? (int)ViewState["Progress"] : 0; }
set { ViewState["Progress"] = value; } set { ViewState["Progress"] = value; }
} }
public long Total public int Total
{ {
get { return (ViewState["Total"] != null) ? (long)ViewState["Total"] : 0; } get { return (ViewState["Total"] != null) ? (int)ViewState["Total"] : 0; }
set { ViewState["Total"] = value; } set { ViewState["Total"] = value; }
} }
@ -101,7 +101,7 @@ namespace WebsitePanel.Portal
string bkgSrc = Page.ResolveUrl(PortalUtils.GetThemedImage("gauge_bkg.gif")); string bkgSrc = Page.ResolveUrl(PortalUtils.GetThemedImage("gauge_bkg.gif"));
// calculate the width of the gauge // calculate the width of the gauge
long fTotal = Total; int fTotal = Total;
int percent = (fTotal > 0) ? Convert.ToInt32(Math.Round((double)Progress / (double)fTotal * 100)) : 0; int percent = (fTotal > 0) ? Convert.ToInt32(Math.Round((double)Progress / (double)fTotal * 100)) : 0;
double fFilledWidth = (fTotal > 0) ? ((double)Progress / (double)fTotal * Width) : 0; double fFilledWidth = (fTotal > 0) ? ((double)Progress / (double)fTotal * Width) : 0;

View file

@ -92,7 +92,7 @@ namespace WebsitePanel.Portal
private void UpdateControl() private void UpdateControl()
{ {
long total = gauge.Total; int total = gauge.Total;
if (QuotaTypeId == 1) if (QuotaTypeId == 1)
{ {
litValue.Text = (total == 0) ? GetLocalizedString("Text.Disabled") : GetLocalizedString("Text.Enabled"); litValue.Text = (total == 0) ? GetLocalizedString("Text.Disabled") : GetLocalizedString("Text.Enabled");

View file

@ -189,6 +189,8 @@
</table> </table>
</asp:Panel> </asp:Panel>
<asp:PlaceHolder ID="providerControl" runat="server"></asp:PlaceHolder>
<wsp:CollapsiblePanel id="secSnapshots" runat="server" <wsp:CollapsiblePanel id="secSnapshots" runat="server"
TargetControlID="SnapshotsPanel" meta:resourcekey="secSnapshots" Text="Snapshots"> TargetControlID="SnapshotsPanel" meta:resourcekey="secSnapshots" Text="Snapshots">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>

View file

@ -42,6 +42,8 @@ namespace WebsitePanel.Portal.VPS
{ {
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
LoadCustomProviderControl();
if (!IsPostBack) if (!IsPostBack)
{ {
BindFormControls(); BindFormControls();
@ -54,6 +56,26 @@ namespace WebsitePanel.Portal.VPS
ToggleControls(); ToggleControls();
} }
private void LoadCustomProviderControl()
{
try
{
LoadProviderControl(PanelSecurity.PackageId, "VPS", providerControl, "Create.ascx");
}
catch { /* skip */ }
}
private IVirtualMachineCreateControl CustomProviderControl
{
get
{
if (providerControl.Controls.Count == 0)
return null;
return (IVirtualMachineCreateControl)providerControl.Controls[0];
}
}
private void ToggleWizardSteps() private void ToggleWizardSteps()
{ {
// external network // external network
@ -113,6 +135,13 @@ namespace WebsitePanel.Portal.VPS
ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item
// the custom provider control
if (CustomProviderControl != null)
{
IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0];
ctrl.BindItem(new VirtualMachine());
}
// external network details // external network details
if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS_EXTERNAL_NETWORK_ENABLED)) if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS_EXTERNAL_NETWORK_ENABLED))
{ {
@ -287,6 +316,15 @@ namespace WebsitePanel.Portal.VPS
try try
{ {
VirtualMachine virtualMachine = new VirtualMachine();
// the custom provider control
if (CustomProviderControl != null)
{
IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0];
ctrl.SaveItem(virtualMachine);
}
// collect and prepare data // collect and prepare data
string hostname = String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim()); string hostname = String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim());

View file

@ -1,35 +1,6 @@
// 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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.3053
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -401,6 +372,15 @@ namespace WebsitePanel.Portal.VPS {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Localize locGB; protected global::System.Web.UI.WebControls.Localize locGB;
/// <summary>
/// providerControl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder providerControl;
/// <summary> /// <summary>
/// secSnapshots control. /// secSnapshots control.
/// </summary> /// </summary>
@ -1354,14 +1334,5 @@ namespace WebsitePanel.Portal.VPS {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.Literal litPrivateAddressesList; protected global::System.Web.UI.WebControls.Literal litPrivateAddressesList;
/// <summary>
/// FormComments control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize FormComments;
} }
} }

View file

@ -195,6 +195,7 @@
<Compile Include="Code\ProviderControls\IDatabaseEditUserControl.cs" /> <Compile Include="Code\ProviderControls\IDatabaseEditUserControl.cs" />
<Compile Include="Code\ProviderControls\IFtpEditAccountControl.cs" /> <Compile Include="Code\ProviderControls\IFtpEditAccountControl.cs" />
<Compile Include="Code\ProviderControls\IHostingServiceProviderSettings.cs" /> <Compile Include="Code\ProviderControls\IHostingServiceProviderSettings.cs" />
<Compile Include="Code\ProviderControls\IVirtualMachineCreateControl.cs" />
<Compile Include="Code\ProviderControls\IMailEditAccountControl.cs" /> <Compile Include="Code\ProviderControls\IMailEditAccountControl.cs" />
<Compile Include="Code\ProviderControls\IMailEditDomainControl.cs" /> <Compile Include="Code\ProviderControls\IMailEditDomainControl.cs" />
<Compile Include="Code\ProviderControls\IMailEditForwardingControl.cs" /> <Compile Include="Code\ProviderControls\IMailEditForwardingControl.cs" />