wsp-10329 Adding hyper-v replica to HyperV Provider. Enterprise Part 2.

This commit is contained in:
Alexander Trofimov 2015-04-16 22:21:20 +03:00
parent 9685e61e7e
commit 27155ddc5e
8 changed files with 508 additions and 29 deletions

View file

@ -113,6 +113,9 @@
public const string INSERT_DVD_DISK_ERROR = "VPS_INSERT_DVD_DISK_ERROR"; public const string INSERT_DVD_DISK_ERROR = "VPS_INSERT_DVD_DISK_ERROR";
public const string EJECT_DVD_DISK_ERROR = "VPS_EJECT_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 HOST_NAMER_IS_ALREADY_USED = "HOST_NAMER_IS_ALREADY_USED";
public const string CANNOT_CHECK_HOST_EXISTS = "CANNOT_CHECK_HOST_EXISTS"; public const string CANNOT_CHECK_HOST_EXISTS = "CANNOT_CHECK_HOST_EXISTS";

View file

@ -146,6 +146,10 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback GetCertificatesOperationCompleted; private System.Threading.SendOrPostCallback GetCertificatesOperationCompleted;
private System.Threading.SendOrPostCallback SetReplicaServerOperationCompleted;
private System.Threading.SendOrPostCallback IsReplicaServerOperationCompleted;
/// <remarks/> /// <remarks/>
public esVirtualizationServer2012() { public esVirtualizationServer2012() {
this.Url = "http://127.0.0.1:9012/esVirtualizationServer2012.asmx"; this.Url = "http://127.0.0.1:9012/esVirtualizationServer2012.asmx";
@ -319,6 +323,12 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/> /// <remarks/>
public event GetCertificatesCompletedEventHandler GetCertificatesCompleted; public event GetCertificatesCompletedEventHandler GetCertificatesCompleted;
/// <remarks/>
public event SetReplicaServerCompletedEventHandler SetReplicaServerCompleted;
/// <remarks/>
public event IsReplicaServerCompletedEventHandler IsReplicaServerCompleted;
/// <remarks/> /// <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)] [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) { 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/> /// <remarks/>
public new void CancelAsync(object userState) { public new void CancelAsync(object userState) {
base.CancelAsync(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]));
}
}
}
} }

View file

@ -3726,6 +3726,30 @@ namespace WebsitePanel.EnterpriseServer
return vs.GetCertificates(remoteServer); 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);
}
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 #endregion
} }
} }

View file

@ -481,6 +481,19 @@ namespace WebsitePanel.EnterpriseServer
return VirtualizationServerController2012.GetCertificates(serviceId, remoteServer); 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 #endregion
} }
} }

View file

@ -401,4 +401,43 @@ The following substitution variables can be used in the pattern:&lt;br/&gt;
<data name="locHyperVCloud.Text" xml:space="preserve"> <data name="locHyperVCloud.Text" xml:space="preserve">
<value>Hyper-V Cloud</value> <value>Hyper-V Cloud</value>
</data> </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 Thumbnail:</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="locReplicaServer.Text" xml:space="preserve">
<value>Replica Server:</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 name</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="locErrorPathReplica.Text" xml:space="preserve">
<value>Please enter replication path</value>
</data>
</root> </root>

View file

@ -82,6 +82,26 @@
Text="*" meta:resourcekey="ExportedVpsPathValidator" Display="Dynamic" SetFocusOnError="true" /> Text="*" meta:resourcekey="ExportedVpsPathValidator" Display="Dynamic" SetFocusOnError="true" />
</td> </td>
</tr> </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> </table>
</fieldset> </fieldset>
<br /> <br />
@ -129,19 +149,55 @@
<fieldset> <fieldset>
<legend> <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> </legend>
<table cellpadding="2" cellspacing="0" width="100%" style="margin: 10px;"> <table cellpadding="2" cellspacing="0" width="100%" style="margin: 10px;">
<table cellpadding="2" cellspacing="0" style="margin: 10px;">
<tr> <tr>
<td class="SubHead" style="width:200px;"> <td colspan="2">
<asp:Localize ID="locDvdIsoPath" runat="server" meta:resourcekey="locDvdIsoPath" Text="Path to DVD ISO files:"></asp:Localize> <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> </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>
<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" />
</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>
</table>
</table> </table>
</fieldset> </fieldset>
<br /> <br />

View file

@ -26,21 +26,12 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System; 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 System.Collections.Specialized;
using System.Linq;
using System.Web.UI.WebControls;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.Virtualization; using WebsitePanel.Providers.Virtualization;
using WebsitePanel.EnterpriseServer;
using System.Web.UI.MobileControls;
using System.Collections.Generic;
namespace WebsitePanel.Portal.ProviderControls namespace WebsitePanel.Portal.ProviderControls
{ {
@ -50,6 +41,11 @@ 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"; } }
void IHostingServiceProviderSettings.BindSettings(StringDictionary settings) void IHostingServiceProviderSettings.BindSettings(StringDictionary settings)
{ {
txtServerName.Text = settings["ServerName"]; txtServerName.Text = settings["ServerName"];
@ -104,7 +100,23 @@ namespace WebsitePanel.Portal.ProviderControls
// stop // stop
radioStopAction.SelectedValue = settings["StopAction"]; radioStopAction.SelectedValue = settings["StopAction"];
// replica
ReplicationModeList.SelectedValue = settings["ReplicaMode"] ?? "Disabled";
txtReplicaPath.Text = settings["ReplicaServerPath"];
ToggleControls(); 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) void IHostingServiceProviderSettings.SaveSettings(StringDictionary settings)
@ -156,6 +168,13 @@ namespace WebsitePanel.Portal.ProviderControls
// stop // stop
settings["StopAction"] = radioStopAction.SelectedValue; settings["StopAction"] = radioStopAction.SelectedValue;
// replication
settings["ReplicaMode"] = ReplicationModeList.SelectedValue;
settings["ReplicaServerPath"] = txtReplicaPath.Text;
settings["ReplicaServerThumbprint"] = CertificateThumbprint;
SetReplication();
} }
private void BindNetworksList() private void BindNetworksList()
@ -181,6 +200,17 @@ 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 ToggleControls() private void ToggleControls()
{ {
ServerNameRow.Visible = (radioServer.SelectedIndex == 1); ServerNameRow.Visible = (radioServer.SelectedIndex == 1);
@ -197,6 +227,14 @@ namespace WebsitePanel.Portal.ProviderControls
ManageNicConfigRow.Visible = (ddlManagementNetworks.SelectedIndex > 0); ManageNicConfigRow.Visible = (ddlManagementNetworks.SelectedIndex > 0);
ManageAlternateNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0); ManageAlternateNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0);
ManagePreferredNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0); ManagePreferredNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0);
// Replica
IsReplicaServerRow.Visible = IsReplicaServer;
ddlCertThumbnail.Visible = !IsRemoteServer;
txtCertThumbnail.Visible = CertificateThumbnailValidator.Visible = IsRemoteServer;
IsReplicaServerRow.Visible = IsReplicaServer;
ReplicaPathErrorTr.Visible = ReplicaErrorTr.Visible = false;
if (IsReplicaServer) BindCertificates();
} }
protected void radioServer_SelectedIndexChanged(object sender, EventArgs e) protected void radioServer_SelectedIndexChanged(object sender, EventArgs e)
@ -223,5 +261,29 @@ namespace WebsitePanel.Portal.ProviderControls
{ {
ToggleControls(); 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;
}
} }
} }

View file

@ -201,6 +201,60 @@ namespace WebsitePanel.Portal.ProviderControls {
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator ExportedVpsPathValidator; 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> /// <summary>
/// locProcessorSettings control. /// locProcessorSettings control.
/// </summary> /// </summary>
@ -292,40 +346,112 @@ namespace WebsitePanel.Portal.ProviderControls {
protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuWeightValidator; protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuWeightValidator;
/// <summary> /// <summary>
/// locMediaLibrary control. /// locReplication control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// 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.Localize locMediaLibrary; protected global::System.Web.UI.WebControls.Localize locReplication;
/// <summary> /// <summary>
/// locDvdIsoPath control. /// ReplicationModeList control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// 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.Localize locDvdIsoPath; protected global::System.Web.UI.WebControls.RadioButtonList ReplicationModeList;
/// <summary> /// <summary>
/// txtDvdLibraryPath control. /// IsReplicaServerRow control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// 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.TextBox txtDvdLibraryPath; protected global::System.Web.UI.HtmlControls.HtmlTableRow IsReplicaServerRow;
/// <summary> /// <summary>
/// DvdLibraryPathValidator control. /// locCertThumbnail control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// 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.RequiredFieldValidator DvdLibraryPathValidator; 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>
/// 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> /// <summary>
/// locVhd control. /// locVhd control.