diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 27d8a6f9..8ae258b7 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -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 \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs index 75ea31ef..fb69ef50 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs @@ -1074,10 +1074,14 @@ namespace WebsitePanel.EnterpriseServer } } - private static void CheckNumericQuota(PackageContext cntx, List errors, string quotaName, int currentVal, int val, string messageKey) + private static void CheckNumericQuota(PackageContext cntx, List errors, string quotaName, long currentVal, long val, string messageKey) { CheckQuotaValue(cntx, errors, quotaName, currentVal, val, messageKey); } + private static void CheckNumericQuota(PackageContext cntx, List 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 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 errors, string quotaName, int currentVal, int val, string messageKey) + private static void CheckQuotaValue(PackageContext cntx, List 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; + } } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs index 6d80d876..9a7d4440 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs @@ -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; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs index 2ee49ac3..83bdf399 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs @@ -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"); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/App_LocalResources/VpsDetailsGeneral.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/App_LocalResources/VpsDetailsGeneral.ascx.resx index aa3c2195..5d662ca5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/App_LocalResources/VpsDetailsGeneral.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/App_LocalResources/VpsDetailsGeneral.ascx.resx @@ -213,6 +213,9 @@ OK + + Paused + Change VPS Host Name @@ -273,6 +276,9 @@ Starting + + Running + Stopping diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs index 5345cc52..5366c59d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VpsDetailsGeneral.ascx.cs @@ -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"));