Add Quota for Hyper-V replication

This commit is contained in:
Alexander Trofimov 2015-05-03 22:17:35 +03:00
parent bf3ec75c08
commit 054241f84e
13 changed files with 321 additions and 161 deletions

View file

@ -4121,6 +4121,9 @@
<data name="Error.VPS_REQUIRED" xml:space="preserve">
<value>Please fill required fields</value>
</data>
<data name="Error.VPS_QUOTA_REPLICATION_ENABLED" xml:space="preserve">
<value>Replications is not allowed in the hosting plan</value>
</data>
<data name="VPS.VPS_JOB_FAILED_ERROR" xml:space="preserve">
<value>Job execution failed with the following code: {1}</value>
@ -5244,6 +5247,9 @@
<data name="Quota.VPS2012.StartShutdownAllowed" xml:space="preserve">
<value>Allow user to Start, Turn off VPS</value>
</data>
<data name="Quota.VPS2012.ReplicationEnabled" xml:space="preserve">
<value>Allow user to Replication</value>
</data>
<data name="Error.CreateCheckPointError" xml:space="preserve">
<value>Error creating CheckPoint</value>
</data>

View file

@ -134,7 +134,12 @@ namespace WebsitePanel.Portal.VPS2012.UserControls
tabsList.Add(CreateTab("vps_network", "Tab.Network"));
if (VirtualMachines2012Helper.IsReplicationEnabled(PanelSecurity.PackageId) && !createError)
tabsList.Add(CreateTab("vps_replication", "Tab.Replication"));
{
if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS2012_REPLICATION_ENABLED))
{
tabsList.Add(CreateTab("vps_replication", "Tab.Replication"));
}
}
//tabsList.Add(CreateTab("vps_permissions", "Tab.Permissions"));
//tabsList.Add(CreateTab("vps_tools", "Tab.Tools"));

View file

@ -52,7 +52,9 @@ namespace WebsitePanel.Portal.VPS2012
gvServers.Columns[4].Visible = !isUserSelected;
// replication
gvServers.Columns[5].Visible = VirtualMachines2012Helper.IsReplicationEnabled(PanelSecurity.PackageId);
gvServers.Columns[5].Visible =
PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS2012_REPLICATION_ENABLED) &&
VirtualMachines2012Helper.IsReplicationEnabled(PanelSecurity.PackageId);
// check package quotas
bool manageAllowed = VirtualMachines2012Helper.IsVirtualMachineManagementAllowed(PanelSecurity.PackageId);

View file

@ -33,7 +33,8 @@ using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsitePanel.Providers.Common;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.Virtualization;
namespace WebsitePanel.Portal.VPS2012
@ -46,6 +47,13 @@ namespace WebsitePanel.Portal.VPS2012
protected void Page_Load(object sender, EventArgs e)
{
if (!PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS2012_REPLICATION_ENABLED))
{
ShowErrorMessage("VPS_QUOTA_REPLICATION_ENABLED");
ReplicationPanel.Visible = false;
return;
}
if (!IsPostBack)
{
Bind();