Merge
This commit is contained in:
commit
5f31a9f180
8 changed files with 669 additions and 32 deletions
|
@ -113,6 +113,9 @@
|
|||
public const string INSERT_DVD_DISK_ERROR = "VPS_INSERT_DVD_DISK_ERROR";
|
||||
public const string EJECT_DVD_DISK_ERROR = "VPS_EJECT_DVD_DISK_ERROR";
|
||||
|
||||
// Replication
|
||||
public const string SET_REPLICA_SERVER_ERROR = "SET_REPLICA_SERVER_ERROR";
|
||||
|
||||
|
||||
public const string HOST_NAMER_IS_ALREADY_USED = "HOST_NAMER_IS_ALREADY_USED";
|
||||
public const string CANNOT_CHECK_HOST_EXISTS = "CANNOT_CHECK_HOST_EXISTS";
|
||||
|
|
|
@ -146,6 +146,10 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
private System.Threading.SendOrPostCallback GetCertificatesOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetReplicaServerOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback IsReplicaServerOperationCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public esVirtualizationServer2012() {
|
||||
this.Url = "http://127.0.0.1:9012/esVirtualizationServer2012.asmx";
|
||||
|
@ -319,6 +323,12 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
/// <remarks/>
|
||||
public event GetCertificatesCompletedEventHandler GetCertificatesCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetReplicaServerCompletedEventHandler SetReplicaServerCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event IsReplicaServerCompletedEventHandler IsReplicaServerCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetVirtualMachines", 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 VirtualMachineMetaItemsPaged GetVirtualMachines(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool recursive) {
|
||||
|
@ -3173,6 +3183,100 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetReplicaServer", 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 SetReplicaServer(int serviceId, string remoteServer, string thumbprint, string storagePath) {
|
||||
object[] results = this.Invoke("SetReplicaServer", new object[] {
|
||||
serviceId,
|
||||
remoteServer,
|
||||
thumbprint,
|
||||
storagePath});
|
||||
return ((ResultObject)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetReplicaServer(int serviceId, string remoteServer, string thumbprint, string storagePath, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("SetReplicaServer", new object[] {
|
||||
serviceId,
|
||||
remoteServer,
|
||||
thumbprint,
|
||||
storagePath}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ResultObject EndSetReplicaServer(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((ResultObject)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetReplicaServerAsync(int serviceId, string remoteServer, string thumbprint, string storagePath) {
|
||||
this.SetReplicaServerAsync(serviceId, remoteServer, thumbprint, storagePath, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetReplicaServerAsync(int serviceId, string remoteServer, string thumbprint, string storagePath, object userState) {
|
||||
if ((this.SetReplicaServerOperationCompleted == null)) {
|
||||
this.SetReplicaServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetReplicaServerOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetReplicaServer", new object[] {
|
||||
serviceId,
|
||||
remoteServer,
|
||||
thumbprint,
|
||||
storagePath}, this.SetReplicaServerOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetReplicaServerOperationCompleted(object arg) {
|
||||
if ((this.SetReplicaServerCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetReplicaServerCompleted(this, new SetReplicaServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/IsReplicaServer", 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 bool IsReplicaServer(int serviceId, string remoteServer) {
|
||||
object[] results = this.Invoke("IsReplicaServer", new object[] {
|
||||
serviceId,
|
||||
remoteServer});
|
||||
return ((bool)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginIsReplicaServer(int serviceId, string remoteServer, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("IsReplicaServer", new object[] {
|
||||
serviceId,
|
||||
remoteServer}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool EndIsReplicaServer(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((bool)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void IsReplicaServerAsync(int serviceId, string remoteServer) {
|
||||
this.IsReplicaServerAsync(serviceId, remoteServer, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void IsReplicaServerAsync(int serviceId, string remoteServer, object userState) {
|
||||
if ((this.IsReplicaServerOperationCompleted == null)) {
|
||||
this.IsReplicaServerOperationCompleted = new System.Threading.SendOrPostCallback(this.OnIsReplicaServerOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("IsReplicaServer", new object[] {
|
||||
serviceId,
|
||||
remoteServer}, this.IsReplicaServerOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnIsReplicaServerOperationCompleted(object arg) {
|
||||
if ((this.IsReplicaServerCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.IsReplicaServerCompleted(this, new IsReplicaServerCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public new void CancelAsync(object userState) {
|
||||
base.CancelAsync(userState);
|
||||
|
@ -4634,4 +4738,56 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
public delegate void SetReplicaServerCompletedEventHandler(object sender, SetReplicaServerCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class SetReplicaServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal SetReplicaServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ResultObject Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((ResultObject)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
public delegate void IsReplicaServerCompletedEventHandler(object sender, IsReplicaServerCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class IsReplicaServerCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal IsReplicaServerCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((bool)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3726,6 +3726,31 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return vs.GetCertificates(remoteServer);
|
||||
}
|
||||
|
||||
public static ResultObject SetReplicaServer(int serviceId, string remoteServer, string thumbprint, string storagePath)
|
||||
{
|
||||
ResultObject result = new ResultObject();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(storagePath))
|
||||
throw new Exception("Please enter replication path");
|
||||
|
||||
VirtualizationServer2012 vs = GetVirtualizationProxy(serviceId);
|
||||
vs.SetReplicaServer(remoteServer, thumbprint, storagePath);
|
||||
result.IsSuccess = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.AddError(VirtualizationErrorCodes.SET_REPLICA_SERVER_ERROR, ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool IsReplicaServer(int serviceId, string remoteServer)
|
||||
{
|
||||
VirtualizationServer2012 vs = GetVirtualizationProxy(serviceId);
|
||||
return vs.IsReplicaServer(remoteServer);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -481,6 +481,19 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return VirtualizationServerController2012.GetCertificates(serviceId, remoteServer);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject SetReplicaServer(int serviceId, string remoteServer, string thumbprint, string storagePath)
|
||||
{
|
||||
return VirtualizationServerController2012.SetReplicaServer(serviceId, remoteServer, thumbprint, storagePath);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public bool IsReplicaServer(int serviceId, string remoteServer)
|
||||
{
|
||||
return VirtualizationServerController2012.IsReplicaServer(serviceId, remoteServer);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -401,4 +401,46 @@ The following substitution variables can be used in the pattern:<br/>
|
|||
<data name="locHyperVCloud.Text" xml:space="preserve">
|
||||
<value>Hyper-V Cloud</value>
|
||||
</data>
|
||||
<data name="btnSetReplicaServer.Text" xml:space="preserve">
|
||||
<value>Set</value>
|
||||
</data>
|
||||
<data name="CertificateThumbnailValidator.ErrorMessage" xml:space="preserve">
|
||||
<value>Enter the thumbnail of a SSL certificate</value>
|
||||
</data>
|
||||
<data name="locCertThumbnail.Text" xml:space="preserve">
|
||||
<value>SSL Certificate Thumbprint:</value>
|
||||
</data>
|
||||
<data name="locErrorSetReplica.Text" xml:space="preserve">
|
||||
<value>Can not to set server as a replication server with the entered server name, replication path and SSL certificate</value>
|
||||
</data>
|
||||
<data name="locReplicaPath.Text" xml:space="preserve">
|
||||
<value>Path for Replications:</value>
|
||||
</data>
|
||||
<data name="locReplication.Text" xml:space="preserve">
|
||||
<value>Replication</value>
|
||||
</data>
|
||||
<data name="ReplicaPathValidator.ErrorMessage" xml:space="preserve">
|
||||
<value>Enter path to replication virtual machines</value>
|
||||
</data>
|
||||
<data name="ReplicaServerValidator.ErrorMessage" xml:space="preserve">
|
||||
<value>Enter a replication server</value>
|
||||
</data>
|
||||
<data name="ReplicationModeDisabled.Text" xml:space="preserve">
|
||||
<value>No Hyper-v Replication</value>
|
||||
</data>
|
||||
<data name="ReplicationModeEnabled.Text" xml:space="preserve">
|
||||
<value>Enable Hyper-V Replication</value>
|
||||
</data>
|
||||
<data name="ReplicationModeIsReplicaServer.Text" xml:space="preserve">
|
||||
<value>This is a Replica Server</value>
|
||||
</data>
|
||||
<data name="locEnableReplicaError.Text" xml:space="preserve">
|
||||
<value>Please add a server with the enabled replication and select it from list</value>
|
||||
</data>
|
||||
<data name="locErrorPathReplica.Text" xml:space="preserve">
|
||||
<value>Please enter replication path</value>
|
||||
</data>
|
||||
<data name="locReplicaServer.Text" xml:space="preserve">
|
||||
<value>Replication Server:</value>
|
||||
</data>
|
||||
</root>
|
|
@ -82,6 +82,26 @@
|
|||
Text="*" meta:resourcekey="ExportedVpsPathValidator" Display="Dynamic" SetFocusOnError="true" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px;">
|
||||
<asp:Localize ID="locDvdIsoPath" runat="server" meta:resourcekey="locDvdIsoPath" Text="Path to DVD ISO files:"></asp:Localize>
|
||||
</td>
|
||||
<td>
|
||||
<asp:TextBox Width="300px" CssClass="NormalTextBox" Runat="server" ID="txtDvdLibraryPath"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="DvdLibraryPathValidator" runat="server" ControlToValidate="txtDvdLibraryPath"
|
||||
Text="*" meta:resourcekey="DvdLibraryPathValidator" Display="Dynamic" SetFocusOnError="true" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px;">
|
||||
<asp:Localize ID="locReplicaPath" runat="server" meta:resourcekey="locReplicaPath" Text="Path to Replications:"></asp:Localize>
|
||||
</td>
|
||||
<td>
|
||||
<asp:TextBox Width="300px" CssClass="NormalTextBox" Runat="server" ID="txtReplicaPath"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="ReplicaPathValidator" runat="server" ControlToValidate="txtReplicaPath"
|
||||
Text="*" meta:resourcekey="ReplicaPathValidator" Display="Dynamic" SetFocusOnError="true" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<br />
|
||||
|
@ -129,19 +149,79 @@
|
|||
|
||||
<fieldset>
|
||||
<legend>
|
||||
<asp:Localize ID="locMediaLibrary" runat="server" meta:resourcekey="locMediaLibrary" Text="DVD Media Library"></asp:Localize>
|
||||
<asp:Localize ID="locReplication" runat="server" meta:resourcekey="locReplication" Text="Replication"></asp:Localize>
|
||||
</legend>
|
||||
<table cellpadding="2" cellspacing="0" width="100%" style="margin: 10px;">
|
||||
<tr>
|
||||
<td class="SubHead" style="width:200px;">
|
||||
<asp:Localize ID="locDvdIsoPath" runat="server" meta:resourcekey="locDvdIsoPath" Text="Path to DVD ISO files:"></asp:Localize>
|
||||
</td>
|
||||
<td>
|
||||
<asp:TextBox Width="300px" CssClass="NormalTextBox" Runat="server" ID="txtDvdLibraryPath"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="DvdLibraryPathValidator" runat="server" ControlToValidate="txtDvdLibraryPath"
|
||||
Text="*" meta:resourcekey="DvdLibraryPathValidator" Display="Dynamic" SetFocusOnError="true" />
|
||||
<table cellpadding="2" cellspacing="0" style="margin: 10px;">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<asp:RadioButtonList ID="ReplicationModeList" runat="server" AutoPostBack="true"
|
||||
OnSelectedIndexChanged="radioServer_SelectedIndexChanged">
|
||||
<asp:ListItem Value="Disable" meta:resourcekey="ReplicationModeDisabled" Selected="True">No Hyper-v Replication</asp:ListItem>
|
||||
<asp:ListItem Value="Enable" meta:resourcekey="ReplicationModeEnabled">Enable Hyper-V Replication</asp:ListItem>
|
||||
<asp:ListItem Value="IsReplicaServer" meta:resourcekey="ReplicationModeIsReplicaServer">This is a Replica Server</asp:ListItem>
|
||||
</asp:RadioButtonList>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="EnableReplicaRow" runat="server">
|
||||
<td class="SubHead" style="padding-left: 20px;" colspan="2">
|
||||
<table cellpadding="2" cellspacing="0" style="margin: 10px;">
|
||||
<tr>
|
||||
<td style="width: 180px">
|
||||
<asp:Localize ID="locReplicaServer" runat="server" meta:resourcekey="locReplicaServer" Text="Replication Server:"></asp:Localize>
|
||||
</td>
|
||||
<td>
|
||||
<asp:DropDownList ID="ddlReplicaServer" runat="server" Width="300px"></asp:DropDownList>
|
||||
|
||||
<asp:RequiredFieldValidator ID="ReplicaServerValidator" runat="server" ControlToValidate="ddlReplicaServer"
|
||||
Text="*" meta:resourcekey="ReplicaServerValidator" Display="Dynamic" SetFocusOnError="true" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="EnableReplicaErrorTr" runat="server" visible="False">
|
||||
<td colspan="2">
|
||||
<asp:Label ID="locEnableReplicaError" runat="server" meta:resourcekey="locEnableReplicaError" ForeColor="Red"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="IsReplicaServerRow" runat="server">
|
||||
<td class="SubHead" style="padding-left: 20px;" colspan="2">
|
||||
<table cellpadding="2" cellspacing="0" style="margin: 10px;">
|
||||
<tr>
|
||||
<td style="width: 200px">
|
||||
<asp:Localize ID="locCertThumbnail" runat="server" meta:resourcekey="locCertThumbnail" Text="SSL Certificate Thumbnail:"></asp:Localize>
|
||||
</td>
|
||||
<td>
|
||||
<asp:DropDownList ID="ddlCertThumbnail" runat="server" Width="500px"></asp:DropDownList>
|
||||
<asp:TextBox Width="400px" CssClass="NormalTextBox" runat="server" ID="txtCertThumbnail"></asp:TextBox>
|
||||
|
||||
<asp:Button ID="btnSetReplicaServer" runat="server" meta:resourcekey="btnSetReplicaServer"
|
||||
CssClass="Button1" Text="Set" CausesValidation="false"
|
||||
OnClick="btnSetReplicaServer_Click" />
|
||||
|
||||
<asp:RequiredFieldValidator ID="CertificateThumbnailValidator" runat="server" ControlToValidate="txtCertThumbnail"
|
||||
Text="*" meta:resourcekey="CertificateThumbnailValidator" Display="Dynamic" SetFocusOnError="true" />
|
||||
<asp:RequiredFieldValidator ID="CertificateDdlThumbnailValidator" runat="server" ControlToValidate="ddlCertThumbnail"
|
||||
Text="*" meta:resourcekey="CertificateThumbnailValidator" Display="Dynamic" SetFocusOnError="true" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="ReplicaPathErrorTr" runat="server" Visible="False">
|
||||
<td colspan="2">
|
||||
<asp:Label ID="locErrorPathReplica" runat="server"
|
||||
meta:resourcekey="locErrorPathReplica" ForeColor="Red"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="ReplicaErrorTr" runat="server" Visible="False">
|
||||
<td colspan="2">
|
||||
<asp:Label ID="locErrorSetReplica" runat="server"
|
||||
meta:resourcekey="locErrorSetReplica" ForeColor="Red"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
</fieldset>
|
||||
<br />
|
||||
|
|
|
@ -26,21 +26,15 @@
|
|||
// (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;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers.Virtualization;
|
||||
|
||||
namespace WebsitePanel.Portal.ProviderControls
|
||||
{
|
||||
|
@ -50,6 +44,13 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
{
|
||||
}
|
||||
|
||||
public bool IsRemoteServer { get { return radioServer.SelectedIndex > 0; } }
|
||||
public string RemoteServerName { get { return IsRemoteServer ? txtServerName.Text.Trim() : ""; } }
|
||||
public string CertificateThumbprint { get { return IsRemoteServer ? txtCertThumbnail.Text.Trim() : ddlCertThumbnail.SelectedValue; } }
|
||||
public bool IsReplicaServer { get { return ReplicationModeList.SelectedValue == "IsReplicaServer"; } }
|
||||
public bool EnabledReplica { get { return ReplicationModeList.SelectedValue == "Enable"; } }
|
||||
public string ReplicaServerId { get; set; }
|
||||
|
||||
void IHostingServiceProviderSettings.BindSettings(StringDictionary settings)
|
||||
{
|
||||
txtServerName.Text = settings["ServerName"];
|
||||
|
@ -104,7 +105,24 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
// stop
|
||||
radioStopAction.SelectedValue = settings["StopAction"];
|
||||
|
||||
// replica
|
||||
ReplicationModeList.SelectedValue = settings["ReplicaMode"] ?? "Disabled";
|
||||
txtReplicaPath.Text = settings["ReplicaServerPath"];
|
||||
ReplicaServerId = settings["ReplicaServerId"];
|
||||
|
||||
ToggleControls();
|
||||
|
||||
// replica
|
||||
txtCertThumbnail.Text = settings["ReplicaServerThumbprint"];
|
||||
ddlCertThumbnail.SelectedValue = settings["ReplicaServerThumbprint"];
|
||||
|
||||
if (IsReplicaServer)
|
||||
{
|
||||
var serverIsRealReplica = ES.Services.VPS2012.IsReplicaServer(PanelRequest.ServiceId, RemoteServerName);
|
||||
|
||||
if (!serverIsRealReplica)
|
||||
ReplicaErrorTr.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
void IHostingServiceProviderSettings.SaveSettings(StringDictionary settings)
|
||||
|
@ -156,6 +174,14 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
|
||||
// stop
|
||||
settings["StopAction"] = radioStopAction.SelectedValue;
|
||||
|
||||
// replication
|
||||
settings["ReplicaMode"] = ReplicationModeList.SelectedValue;
|
||||
settings["ReplicaServerId"] = ddlReplicaServer.SelectedValue;
|
||||
settings["ReplicaServerPath"] = txtReplicaPath.Text;
|
||||
settings["ReplicaServerThumbprint"] = CertificateThumbprint;
|
||||
|
||||
SetReplication();
|
||||
}
|
||||
|
||||
private void BindNetworksList()
|
||||
|
@ -181,6 +207,75 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
}
|
||||
}
|
||||
|
||||
private void BindCertificates()
|
||||
{
|
||||
CertificateInfo[] certificates = ES.Services.VPS2012.GetCertificates(PanelRequest.ServiceId, RemoteServerName);
|
||||
|
||||
if (certificates != null)
|
||||
{
|
||||
ddlCertThumbnail.Items.Clear();
|
||||
certificates.ToList().ForEach(c => ddlCertThumbnail.Items.Add(new ListItem(c.Title, c.Thumbprint)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void BindReplicaServices()
|
||||
{
|
||||
ddlReplicaServer.Items.Clear();
|
||||
|
||||
ServiceInfo serviceInfo = ES.Services.Servers.GetServiceInfo(PanelRequest.ServiceId);
|
||||
DataView dvServices = ES.Services.Servers.GetRawServicesByGroupName(ResourceGroups.VPS2012).Tables[0].DefaultView;
|
||||
|
||||
List<ServiceInfo> services = GetServices(ReplicaServerId);
|
||||
|
||||
foreach (DataRowView dr in dvServices)
|
||||
{
|
||||
int serviceId = (int)dr["ServiceID"];
|
||||
|
||||
ServiceInfo currentServiceInfo = ES.Services.Servers.GetServiceInfo(serviceId);
|
||||
if (currentServiceInfo == null || currentServiceInfo.ProviderId != serviceInfo.ProviderId)
|
||||
continue;
|
||||
|
||||
var currentServiceSettings = ConvertArrayToDictionary(ES.Services.Servers.GetServiceSettings(serviceId));
|
||||
if (currentServiceSettings["ReplicaMode"] == ReplicaMode.IsReplicaServer.ToString())
|
||||
continue;
|
||||
|
||||
var exists = false;
|
||||
if (services != null)
|
||||
exists = services.Any(current => current != null && current.ServiceId == serviceId);
|
||||
|
||||
var listItem = new ListItem(dr["FullServiceName"].ToString(), serviceId.ToString()) {Selected = exists};
|
||||
ddlReplicaServer.Items.Add(listItem);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ServiceInfo> GetServices(string data)
|
||||
{
|
||||
if (string.IsNullOrEmpty(data))
|
||||
return null;
|
||||
List<ServiceInfo> list = new List<ServiceInfo>();
|
||||
string[] servicesIds = data.Split(',');
|
||||
foreach (string current in servicesIds)
|
||||
{
|
||||
ServiceInfo serviceInfo = ES.Services.Servers.GetServiceInfo(Utils.ParseInt(current));
|
||||
list.Add(serviceInfo);
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private StringDictionary ConvertArrayToDictionary(string[] settings)
|
||||
{
|
||||
StringDictionary r = new StringDictionary();
|
||||
foreach (string setting in settings)
|
||||
{
|
||||
int idx = setting.IndexOf('=');
|
||||
r.Add(setting.Substring(0, idx), setting.Substring(idx + 1));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
private void ToggleControls()
|
||||
{
|
||||
ServerNameRow.Visible = (radioServer.SelectedIndex == 1);
|
||||
|
@ -197,6 +292,16 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
ManageNicConfigRow.Visible = (ddlManagementNetworks.SelectedIndex > 0);
|
||||
ManageAlternateNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0);
|
||||
ManagePreferredNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0);
|
||||
|
||||
// Replica
|
||||
IsReplicaServerRow.Visible = IsReplicaServer;
|
||||
EnableReplicaRow.Visible = EnabledReplica;
|
||||
ddlCertThumbnail.Visible = !IsRemoteServer;
|
||||
txtCertThumbnail.Visible = CertificateThumbnailValidator.Visible = IsRemoteServer;
|
||||
IsReplicaServerRow.Visible = IsReplicaServer;
|
||||
ReplicaPathErrorTr.Visible = ReplicaErrorTr.Visible = false;
|
||||
if (IsReplicaServer) BindCertificates();
|
||||
if (EnabledReplica) BindReplicaServices();
|
||||
}
|
||||
|
||||
protected void radioServer_SelectedIndexChanged(object sender, EventArgs e)
|
||||
|
@ -223,5 +328,29 @@ namespace WebsitePanel.Portal.ProviderControls
|
|||
{
|
||||
ToggleControls();
|
||||
}
|
||||
|
||||
protected void btnSetReplicaServer_Click(object sender, EventArgs e)
|
||||
{
|
||||
ToggleControls();
|
||||
SetReplication();
|
||||
}
|
||||
|
||||
private void SetReplication()
|
||||
{
|
||||
if (!IsReplicaServer)
|
||||
return;
|
||||
|
||||
if (txtReplicaPath.Text == "")
|
||||
{
|
||||
ReplicaPathErrorTr.Visible = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var thumbprint = IsRemoteServer ? txtCertThumbnail.Text : ddlCertThumbnail.SelectedValue;
|
||||
ResultObject result = ES.Services.VPS2012.SetReplicaServer(PanelRequest.ServiceId, RemoteServerName, thumbprint, txtReplicaPath.Text);
|
||||
|
||||
if (!result.IsSuccess)
|
||||
ReplicaErrorTr.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,6 +201,60 @@ namespace WebsitePanel.Portal.ProviderControls {
|
|||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator ExportedVpsPathValidator;
|
||||
|
||||
/// <summary>
|
||||
/// locDvdIsoPath 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 locDvdIsoPath;
|
||||
|
||||
/// <summary>
|
||||
/// txtDvdLibraryPath 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.TextBox txtDvdLibraryPath;
|
||||
|
||||
/// <summary>
|
||||
/// DvdLibraryPathValidator 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.RequiredFieldValidator DvdLibraryPathValidator;
|
||||
|
||||
/// <summary>
|
||||
/// locReplicaPath 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 locReplicaPath;
|
||||
|
||||
/// <summary>
|
||||
/// txtReplicaPath 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.TextBox txtReplicaPath;
|
||||
|
||||
/// <summary>
|
||||
/// ReplicaPathValidator 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.RequiredFieldValidator ReplicaPathValidator;
|
||||
|
||||
/// <summary>
|
||||
/// locProcessorSettings control.
|
||||
/// </summary>
|
||||
|
@ -292,40 +346,175 @@ namespace WebsitePanel.Portal.ProviderControls {
|
|||
protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuWeightValidator;
|
||||
|
||||
/// <summary>
|
||||
/// locMediaLibrary control.
|
||||
/// locReplication 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 locMediaLibrary;
|
||||
protected global::System.Web.UI.WebControls.Localize locReplication;
|
||||
|
||||
/// <summary>
|
||||
/// locDvdIsoPath control.
|
||||
/// ReplicationModeList 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 locDvdIsoPath;
|
||||
protected global::System.Web.UI.WebControls.RadioButtonList ReplicationModeList;
|
||||
|
||||
/// <summary>
|
||||
/// txtDvdLibraryPath control.
|
||||
/// EnableReplicaRow 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.TextBox txtDvdLibraryPath;
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTableRow EnableReplicaRow;
|
||||
|
||||
/// <summary>
|
||||
/// DvdLibraryPathValidator control.
|
||||
/// locReplicaServer 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.RequiredFieldValidator DvdLibraryPathValidator;
|
||||
protected global::System.Web.UI.WebControls.Localize locReplicaServer;
|
||||
|
||||
/// <summary>
|
||||
/// ddlReplicaServer 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.DropDownList ddlReplicaServer;
|
||||
|
||||
/// <summary>
|
||||
/// ReplicaServerValidator 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.RequiredFieldValidator ReplicaServerValidator;
|
||||
|
||||
/// <summary>
|
||||
/// EnableReplicaErrorTr control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTableRow EnableReplicaErrorTr;
|
||||
|
||||
/// <summary>
|
||||
/// locEnableReplicaError 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.Label locEnableReplicaError;
|
||||
|
||||
/// <summary>
|
||||
/// IsReplicaServerRow control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTableRow IsReplicaServerRow;
|
||||
|
||||
/// <summary>
|
||||
/// locCertThumbnail 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 locCertThumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// ddlCertThumbnail 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.DropDownList ddlCertThumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// txtCertThumbnail 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.TextBox txtCertThumbnail;
|
||||
|
||||
/// <summary>
|
||||
/// btnSetReplicaServer 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.Button btnSetReplicaServer;
|
||||
|
||||
/// <summary>
|
||||
/// CertificateThumbnailValidator 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.RequiredFieldValidator CertificateThumbnailValidator;
|
||||
|
||||
/// <summary>
|
||||
/// CertificateDdlThumbnailValidator 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.RequiredFieldValidator CertificateDdlThumbnailValidator;
|
||||
|
||||
/// <summary>
|
||||
/// ReplicaPathErrorTr control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTableRow ReplicaPathErrorTr;
|
||||
|
||||
/// <summary>
|
||||
/// locErrorPathReplica 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.Label locErrorPathReplica;
|
||||
|
||||
/// <summary>
|
||||
/// ReplicaErrorTr control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlTableRow ReplicaErrorTr;
|
||||
|
||||
/// <summary>
|
||||
/// locErrorSetReplica 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.Label locErrorSetReplica;
|
||||
|
||||
/// <summary>
|
||||
/// locVhd control.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue