This commit is contained in:
AlexanderTr 2015-03-04 19:18:37 +03:00
commit a96931786c
6 changed files with 54 additions and 27 deletions

View file

@ -1,4 +1,4 @@
USE [${install.database}]
USE [${install.database}]
GO
-- update database version
DECLARE @build_version nvarchar(10), @build_date datetime
@ -8745,3 +8745,10 @@ AND SI.ItemName = @ItemName
AND ((@GroupName IS NULL) OR (@GroupName IS NOT NULL AND RG.GroupName = @GroupName))
RETURN
GO
-- Hyper-V 2012 R2
IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'HyperV2012R2')
BEGIN
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1)
END
GO

View file

@ -1074,10 +1074,14 @@ namespace WebsitePanel.EnterpriseServer
}
}
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, int currentVal, int val, string messageKey)
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, long currentVal, long val, string messageKey)
{
CheckQuotaValue(cntx, errors, quotaName, currentVal, val, messageKey);
}
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, int currentVal, int val, string messageKey)
{
CheckQuotaValue(cntx, errors, quotaName, Convert.ToInt64(currentVal), Convert.ToInt64(val), messageKey);
}
private static void CheckNumericQuota(PackageContext cntx, List<string> errors, string quotaName, int val, string messageKey)
{
@ -1094,7 +1098,7 @@ namespace WebsitePanel.EnterpriseServer
CheckQuotaValue(cntx, errors, quotaName, 0, -1, messageKey);
}
private static void CheckQuotaValue(PackageContext cntx, List<string> errors, string quotaName, int currentVal, int val, string messageKey)
private static void CheckQuotaValue(PackageContext cntx, List<string> errors, string quotaName, long currentVal, long val, string messageKey)
{
if (!cntx.Quotas.ContainsKey(quotaName))
return;
@ -1111,7 +1115,7 @@ namespace WebsitePanel.EnterpriseServer
errors.Add(messageKey);
else if (quota.QuotaTypeId == 2)
{
int maxValue = quota.QuotaAllocatedValue - quota.QuotaUsedValue + currentVal;
long maxValue = quota.QuotaAllocatedValue - quota.QuotaUsedValue + currentVal;
if(val > maxValue)
errors.Add(messageKey + ":" + maxValue);
}
@ -1795,8 +1799,9 @@ namespace WebsitePanel.EnterpriseServer
else if (state == VirtualMachineRequestedState.Reboot)
{
// shutdown first
ResultObject shutdownResult = ChangeVirtualMachineState(itemId, VirtualMachineRequestedState.ShutDown);
if(!shutdownResult.IsSuccess)
ResultObject shutdownResult = ChangeVirtualMachineState(itemId,
VirtualMachineRequestedState.ShutDown);
if (!shutdownResult.IsSuccess)
{
TaskManager.CompleteResultTask(res);
return shutdownResult;
@ -1817,20 +1822,29 @@ namespace WebsitePanel.EnterpriseServer
JobResult result = vps.ChangeVirtualMachineState(machine.VirtualMachineId, state);
// check return
if (result.ReturnValue != ReturnCode.JobStarted)
if (result.Job.JobState == ConcreteJobState.Completed)
{
LogReturnValueResult(res, result);
TaskManager.CompleteResultTask(res);
TaskManager.CompleteTask();
return res;
}
// wait for completion
if (!JobCompleted(vps, result.Job))
else
{
LogJobResult(res, result.Job);
TaskManager.CompleteResultTask(res);
return res;
// check return
if (result.ReturnValue != ReturnCode.JobStarted)
{
LogReturnValueResult(res, result);
TaskManager.CompleteResultTask(res);
return res;
}
// wait for completion
if (!JobCompleted(vps, result.Job))
{
LogJobResult(res, result.Job);
TaskManager.CompleteResultTask(res);
return res;
}
}
}
}

View file

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

View file

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

View file

@ -213,6 +213,9 @@
<data name="Heartbeat.OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="Heartbeat.Paused" xml:space="preserve">
<value>Paused</value>
</data>
<data name="locChangeHostname.Text" xml:space="preserve">
<value>Change VPS Host Name</value>
</data>
@ -273,6 +276,9 @@
<data name="State.Starting" xml:space="preserve">
<value>Starting</value>
</data>
<data name="State.Running" xml:space="preserve">
<value>Running</value>
</data>
<data name="State.Stopping" xml:space="preserve">
<value>Stopping</value>
</data>

View file

@ -98,9 +98,9 @@ namespace WebsitePanel.Portal.VPS
TimeSpan uptime = TimeSpan.FromMilliseconds(vm.Uptime);
uptime = uptime.Subtract(TimeSpan.FromMilliseconds(uptime.Milliseconds));
litUptime.Text = uptime.ToString();
litStatus.Text = GetLocalizedString("State." + vm.State.ToString());
litStatus.Text = GetLocalizedString("State." + vm.State);
litCreated.Text = vm.CreatedDate.ToString();
litHeartbeat.Text = GetLocalizedString("Heartbeat." + vm.Heartbeat.ToString());
litHeartbeat.Text = GetLocalizedString("Heartbeat." + vm.Heartbeat);
// CPU
cpuGauge.Progress = vm.CpuUsage;
@ -155,7 +155,7 @@ namespace WebsitePanel.Portal.VPS
|| vm.State == VirtualMachineState.Saved))
buttons.Add(CreateActionButton("Start", "start.png"));
if (vm.State == VirtualMachineState.Started)
if (vm.State == VirtualMachineState.Running)
{
if(vmi.RebootAllowed)
buttons.Add(CreateActionButton("Reboot", "reboot.png"));
@ -165,12 +165,12 @@ namespace WebsitePanel.Portal.VPS
}
if (vmi.StartTurnOffAllowed
&& (vm.State == VirtualMachineState.Started
&& (vm.State == VirtualMachineState.Running
|| vm.State == VirtualMachineState.Paused))
buttons.Add(CreateActionButton("TurnOff", "turnoff.png"));
if (vmi.PauseResumeAllowed
&& vm.State == VirtualMachineState.Started)
&& vm.State == VirtualMachineState.Running)
buttons.Add(CreateActionButton("Pause", "pause.png"));
if (vmi.PauseResumeAllowed
@ -178,7 +178,7 @@ namespace WebsitePanel.Portal.VPS
buttons.Add(CreateActionButton("Resume", "start2.png"));
if (vmi.ResetAllowed
&& (vm.State == VirtualMachineState.Started
&& (vm.State == VirtualMachineState.Running
|| vm.State == VirtualMachineState.Paused))
buttons.Add(CreateActionButton("Reset", "reset2.png"));