wsp-10323 Сonvert the VSP provider into one utilizing PowerShell - Step 1.
This commit is contained in:
parent
e717a15781
commit
d9d41827f6
24 changed files with 3677 additions and 39 deletions
|
@ -1,4 +1,4 @@
|
||||||
USE [${install.database}]
|
USE [${install.database}]
|
||||||
GO
|
GO
|
||||||
-- update database version
|
-- update database version
|
||||||
DECLARE @build_version nvarchar(10), @build_date datetime
|
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))
|
AND ((@GroupName IS NULL) OR (@GroupName IS NOT NULL AND RG.GroupName = @GroupName))
|
||||||
RETURN
|
RETURN
|
||||||
GO
|
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
|
|
@ -97,9 +97,9 @@
|
||||||
<Exec Command="$(RestoreCommand)"
|
<Exec Command="$(RestoreCommand)"
|
||||||
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
||||||
|
|
||||||
<Exec Command="$(RestoreCommand)"
|
<!--<Exec Command="$(RestoreCommand)"
|
||||||
LogStandardErrorAsError="true"
|
LogStandardErrorAsError="true"
|
||||||
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />-->
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
||||||
|
|
|
@ -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);
|
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)
|
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);
|
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))
|
if (!cntx.Quotas.ContainsKey(quotaName))
|
||||||
return;
|
return;
|
||||||
|
@ -1111,7 +1115,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
errors.Add(messageKey);
|
errors.Add(messageKey);
|
||||||
else if (quota.QuotaTypeId == 2)
|
else if (quota.QuotaTypeId == 2)
|
||||||
{
|
{
|
||||||
int maxValue = quota.QuotaAllocatedValue - quota.QuotaUsedValue + currentVal;
|
long maxValue = quota.QuotaAllocatedValue - quota.QuotaUsedValue + currentVal;
|
||||||
if(val > maxValue)
|
if(val > maxValue)
|
||||||
errors.Add(messageKey + ":" + maxValue);
|
errors.Add(messageKey + ":" + maxValue);
|
||||||
}
|
}
|
||||||
|
@ -1795,7 +1799,8 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
else if (state == VirtualMachineRequestedState.Reboot)
|
else if (state == VirtualMachineRequestedState.Reboot)
|
||||||
{
|
{
|
||||||
// shutdown first
|
// shutdown first
|
||||||
ResultObject shutdownResult = ChangeVirtualMachineState(itemId, VirtualMachineRequestedState.ShutDown);
|
ResultObject shutdownResult = ChangeVirtualMachineState(itemId,
|
||||||
|
VirtualMachineRequestedState.ShutDown);
|
||||||
if (!shutdownResult.IsSuccess)
|
if (!shutdownResult.IsSuccess)
|
||||||
{
|
{
|
||||||
TaskManager.CompleteResultTask(res);
|
TaskManager.CompleteResultTask(res);
|
||||||
|
@ -1817,6 +1822,14 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
JobResult result = vps.ChangeVirtualMachineState(machine.VirtualMachineId, state);
|
JobResult result = vps.ChangeVirtualMachineState(machine.VirtualMachineId, state);
|
||||||
|
|
||||||
|
if (result.Job.JobState == ConcreteJobState.Completed)
|
||||||
|
{
|
||||||
|
LogReturnValueResult(res, result);
|
||||||
|
TaskManager.CompleteTask();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// check return
|
// check return
|
||||||
if (result.ReturnValue != ReturnCode.JobStarted)
|
if (result.ReturnValue != ReturnCode.JobStarted)
|
||||||
{
|
{
|
||||||
|
@ -1834,6 +1847,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
res.IsSuccess = false;
|
res.IsSuccess = false;
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright (c) 2014, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (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.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WebsitePanel.Providers.Virtualization
|
||||||
|
{
|
||||||
|
public class BiosInfo
|
||||||
|
{
|
||||||
|
public bool NumLockEnabled { get; set; }
|
||||||
|
public string[] StartupOrder { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -42,6 +42,9 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
Completed = 7,
|
Completed = 7,
|
||||||
Terminated = 8,
|
Terminated = 8,
|
||||||
Killed = 9,
|
Killed = 9,
|
||||||
Exception = 10
|
Exception = 10,
|
||||||
|
|
||||||
|
NotStarted = 11,
|
||||||
|
Failed = 12,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright (c) 2014, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (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.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WebsitePanel.Providers.Virtualization
|
||||||
|
{
|
||||||
|
public enum ControllerType
|
||||||
|
{
|
||||||
|
IDE = 0,
|
||||||
|
SCSI = 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
// Copyright (c) 2014, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (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.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WebsitePanel.Providers.Virtualization
|
||||||
|
{
|
||||||
|
public class MemoryInfo
|
||||||
|
{
|
||||||
|
public bool DynamicMemoryEnabled { get; set; }
|
||||||
|
public Int64 Startup { get; set; }
|
||||||
|
public Int64 Minimum { get; set; }
|
||||||
|
public Int64 Maximum { get; set; }
|
||||||
|
public int Buffer { get; set; }
|
||||||
|
public int Priority { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,9 +35,10 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
public enum OperationalStatus
|
public enum OperationalStatus
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
OK = 2,
|
Ok = 2,
|
||||||
Error = 6,
|
Error = 6,
|
||||||
NoContact = 12,
|
NoContact = 12,
|
||||||
LostCommunication = 13
|
LostCommunication = 13,
|
||||||
|
Paused = 15
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright (c) 2014, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (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.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WebsitePanel.Providers.Virtualization
|
||||||
|
{
|
||||||
|
public enum VirtualHardDiskFormat
|
||||||
|
{
|
||||||
|
VHD = 1,
|
||||||
|
VHDX = 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -40,5 +40,15 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
public long MaxInternalSize { get; set; }
|
public long MaxInternalSize { get; set; }
|
||||||
public string ParentPath { get; set; }
|
public string ParentPath { get; set; }
|
||||||
public VirtualHardDiskType DiskType { get; set; }
|
public VirtualHardDiskType DiskType { get; set; }
|
||||||
|
public bool SupportPersistentReservations { get; set; }
|
||||||
|
public ulong MaximumIOPS { get; set; }
|
||||||
|
public ulong MinimumIOPS { get; set; }
|
||||||
|
public ControllerType VHDControllerType { get; set; }
|
||||||
|
public int ControllerNumber { get; set; }
|
||||||
|
public int ControllerLocation { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Path { get; set; }
|
||||||
|
public VirtualHardDiskFormat DiskFormat { get; set; }
|
||||||
|
public bool Attached { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
public int CpuUsage { get; set; }
|
public int CpuUsage { get; set; }
|
||||||
|
|
||||||
[Persistent]
|
[Persistent]
|
||||||
public int RamSize { get; set; }
|
public long RamSize { get; set; }
|
||||||
public int RamUsage { get; set; }
|
public long RamUsage { get; set; }
|
||||||
[Persistent]
|
[Persistent]
|
||||||
public int HddSize { get; set; }
|
public int HddSize { get; set; }
|
||||||
public LogicalDisk[] HddLogicalDisks { get; set; }
|
public LogicalDisk[] HddLogicalDisks { get; set; }
|
||||||
|
@ -123,5 +123,18 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
|
|
||||||
// for GetVirtualMachineEx used in import method
|
// for GetVirtualMachineEx used in import method
|
||||||
public VirtualMachineNetworkAdapter[] Adapters { get; set; }
|
public VirtualMachineNetworkAdapter[] Adapters { get; set; }
|
||||||
|
|
||||||
|
[Persistent]
|
||||||
|
public VirtualHardDiskInfo[] Disks { get; set; }
|
||||||
|
|
||||||
|
[Persistent]
|
||||||
|
public string Status { get; set; }
|
||||||
|
|
||||||
|
[Persistent]
|
||||||
|
public string ReplicationState { get; set; }
|
||||||
|
|
||||||
|
[Persistent]
|
||||||
|
public int Generation { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,9 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
{
|
{
|
||||||
public enum VirtualMachineState
|
public enum VirtualMachineState
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Started = 2, // start
|
Running = 2, // start
|
||||||
Off = 3, // turn off
|
Off = 3, // turn off
|
||||||
Reset = 10, // reset
|
Reset = 10, // reset
|
||||||
Paused = 32768, // pause
|
Paused = 32768, // pause
|
||||||
|
@ -47,5 +48,33 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
Stopping = 32774,
|
Stopping = 32774,
|
||||||
Deleted = 32775,
|
Deleted = 32775,
|
||||||
Pausing = 32776
|
Pausing = 32776
|
||||||
|
*/
|
||||||
|
|
||||||
|
Unknown = 0,
|
||||||
|
Other = 1,
|
||||||
|
Running = 2,
|
||||||
|
Off = 3,
|
||||||
|
Stopping = 4,
|
||||||
|
Saved = 6,
|
||||||
|
Paused = 9,
|
||||||
|
Starting = 10,
|
||||||
|
Reset = 11,
|
||||||
|
Saving = 32773,
|
||||||
|
Pausing = 32776,
|
||||||
|
Resuming = 32777,
|
||||||
|
FastSaved = 32779,
|
||||||
|
FastSaving = 32780,
|
||||||
|
RunningCritical = 32781,
|
||||||
|
OffCritical = 32782,
|
||||||
|
StoppingCritical = 32783,
|
||||||
|
SavedCritical = 32784,
|
||||||
|
PausedCritical = 32785,
|
||||||
|
StartingCritical = 32786,
|
||||||
|
ResetCritical = 32787,
|
||||||
|
SavingCritical = 32788,
|
||||||
|
PausingCritical = 32789,
|
||||||
|
ResumingCritical = 32790,
|
||||||
|
FastSavedCritical = 32791,
|
||||||
|
FastSavingCritical = 32792
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,6 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
{
|
{
|
||||||
[Persistent]
|
[Persistent]
|
||||||
public string SwitchId { get; set; }
|
public string SwitchId { get; set; }
|
||||||
|
public string SwitchType { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,6 +287,7 @@
|
||||||
<Compile Include="Statistics\StatsServer.cs" />
|
<Compile Include="Statistics\StatsServer.cs" />
|
||||||
<Compile Include="Statistics\StatsSite.cs" />
|
<Compile Include="Statistics\StatsSite.cs" />
|
||||||
<Compile Include="Statistics\StatsUser.cs" />
|
<Compile Include="Statistics\StatsUser.cs" />
|
||||||
|
<Compile Include="Virtualization\BiosInfo.cs" />
|
||||||
<Compile Include="Virtualization\ChangeJobStateReturnCode.cs" />
|
<Compile Include="Virtualization\ChangeJobStateReturnCode.cs" />
|
||||||
<Compile Include="Virtualization\ConcreteJob.cs">
|
<Compile Include="Virtualization\ConcreteJob.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
|
@ -297,6 +298,7 @@
|
||||||
<Compile Include="Virtualization\ConcreteJobState.cs">
|
<Compile Include="Virtualization\ConcreteJobState.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Virtualization\ControllerType.cs" />
|
||||||
<Compile Include="Virtualization\IVirtualizationServer.cs">
|
<Compile Include="Virtualization\IVirtualizationServer.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -307,6 +309,7 @@
|
||||||
<Compile Include="Virtualization\KvpExchangeDataItem.cs" />
|
<Compile Include="Virtualization\KvpExchangeDataItem.cs" />
|
||||||
<Compile Include="Virtualization\LibraryItem.cs" />
|
<Compile Include="Virtualization\LibraryItem.cs" />
|
||||||
<Compile Include="Virtualization\LogicalDisk.cs" />
|
<Compile Include="Virtualization\LogicalDisk.cs" />
|
||||||
|
<Compile Include="Virtualization\MemoryInfo.cs" />
|
||||||
<Compile Include="Virtualization\MonitoredObjectAlert.cs" />
|
<Compile Include="Virtualization\MonitoredObjectAlert.cs" />
|
||||||
<Compile Include="Virtualization\MonitoredObjectEvent.cs" />
|
<Compile Include="Virtualization\MonitoredObjectEvent.cs" />
|
||||||
<Compile Include="Virtualization\MountedDiskInfo.cs" />
|
<Compile Include="Virtualization\MountedDiskInfo.cs" />
|
||||||
|
@ -321,6 +324,7 @@
|
||||||
<Compile Include="Virtualization\ThumbnailSize.cs">
|
<Compile Include="Virtualization\ThumbnailSize.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Virtualization\VirtualHardDiskFormat.cs" />
|
||||||
<Compile Include="Virtualization\VirtualHardDiskInfo.cs" />
|
<Compile Include="Virtualization\VirtualHardDiskInfo.cs" />
|
||||||
<Compile Include="Virtualization\VirtualHardDiskType.cs" />
|
<Compile Include="Virtualization\VirtualHardDiskType.cs" />
|
||||||
<Compile Include="Virtualization\VirtualMachine.cs">
|
<Compile Include="Virtualization\VirtualMachine.cs">
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,21 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("WebsitePanel.Providers.Virtualization.HyperV2012R2")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyProduct("WebsitePanel.Providers.Virtualization.HyperV2012R2")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("959c2614-2d69-4e4f-9e77-bd868e5afd4b")]
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>WebsitePanel.Providers.Virtualization.HyperV2012R2</RootNamespace>
|
||||||
|
<AssemblyName>WebsitePanel.Providers.Virtualization.HyperV2012R2</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\WebsitePanel.Server\bin\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.Storage.Vds">
|
||||||
|
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Storage.Vds.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\Lib\References\Microsoft\Windows2012\System.Management.Automation.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\VersionInfo.cs">
|
||||||
|
<Link>VersionInfo.cs</Link>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="HyperV2012R2.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Wmi.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\WebsitePanel.Providers.Base\WebsitePanel.Providers.Base.csproj">
|
||||||
|
<Project>{684c932a-6c75-46ac-a327-f3689d89eb42}</Project>
|
||||||
|
<Name>WebsitePanel.Providers.Base</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\WebsitePanel.Providers.HostedSolution\WebsitePanel.Providers.HostedSolution.csproj">
|
||||||
|
<Project>{a06de5e4-4331-47e1-8f46-7b846146b559}</Project>
|
||||||
|
<Name>WebsitePanel.Providers.HostedSolution</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\WebsitePanel.Server.Utils\WebsitePanel.Server.Utils.csproj">
|
||||||
|
<Project>{e91e52f3-9555-4d00-b577-2b1dbdd87ca7}</Project>
|
||||||
|
<Name>WebsitePanel.Server.Utils</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
|
@ -0,0 +1,295 @@
|
||||||
|
// Copyright (c) 2014, Outercurve Foundation.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
// are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
// list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from this
|
||||||
|
// software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (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.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Management;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace WebsitePanel.Providers.Virtualization
|
||||||
|
{
|
||||||
|
internal class Wmi
|
||||||
|
{
|
||||||
|
string nameSpace = null;
|
||||||
|
string computerName = null;
|
||||||
|
ManagementScope scope = null;
|
||||||
|
|
||||||
|
public Wmi(string nameSpace) : this(nameSpace, null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wmi(string computerName, string nameSpace)
|
||||||
|
{
|
||||||
|
this.nameSpace = nameSpace;
|
||||||
|
this.computerName = computerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementObjectCollection ExecuteWmiQuery(string query, params object[] args)
|
||||||
|
{
|
||||||
|
if (args != null && args.Length > 0)
|
||||||
|
query = String.Format(query, args);
|
||||||
|
|
||||||
|
ManagementObjectSearcher searcher = new ManagementObjectSearcher(GetScope(),
|
||||||
|
new ObjectQuery(query));
|
||||||
|
return searcher.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementObject GetWmiObject(string className, string filter, params object[] args)
|
||||||
|
{
|
||||||
|
ManagementObjectCollection col = GetWmiObjects(className, filter, args);
|
||||||
|
ManagementObjectCollection.ManagementObjectEnumerator enumerator = col.GetEnumerator();
|
||||||
|
return enumerator.MoveNext() ? (ManagementObject)enumerator.Current : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementObject GetWmiObject(string className)
|
||||||
|
{
|
||||||
|
return GetWmiObject(className, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementObjectCollection GetWmiObjects(string className, string filter, params object[] args)
|
||||||
|
{
|
||||||
|
string query = "select * from " + className;
|
||||||
|
if (!String.IsNullOrEmpty(filter))
|
||||||
|
query += " where " + filter;
|
||||||
|
return ExecuteWmiQuery(query, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementObjectCollection GetWmiObjects(string className)
|
||||||
|
{
|
||||||
|
return GetWmiObjects(className, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementObject GetWmiObjectByPath(string path)
|
||||||
|
{
|
||||||
|
return new ManagementObject(GetScope(), new ManagementPath(path), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementClass GetWmiClass(string className)
|
||||||
|
{
|
||||||
|
return new ManagementClass(GetScope(), new ManagementPath(className), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ManagementObject GetRelatedWmiObject(ManagementObject obj, string className)
|
||||||
|
{
|
||||||
|
ManagementObjectCollection col = obj.GetRelated(className);
|
||||||
|
ManagementObjectCollection.ManagementObjectEnumerator enumerator = col.GetEnumerator();
|
||||||
|
enumerator.MoveNext();
|
||||||
|
return (ManagementObject)enumerator.Current;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Dump(ManagementBaseObject obj)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
foreach (PropertyData prop in obj.Properties)
|
||||||
|
{
|
||||||
|
string typeName = prop.Value == null ? "null" : prop.Value.GetType().ToString();
|
||||||
|
Debug.WriteLine(prop.Name + ": " + prop.Value + " (" + typeName + ")");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Converts a given datetime in DMTF format to System.DateTime object.
|
||||||
|
internal System.DateTime ToDateTime(string dmtfDate)
|
||||||
|
{
|
||||||
|
System.DateTime initializer = System.DateTime.MinValue;
|
||||||
|
int year = initializer.Year;
|
||||||
|
int month = initializer.Month;
|
||||||
|
int day = initializer.Day;
|
||||||
|
int hour = initializer.Hour;
|
||||||
|
int minute = initializer.Minute;
|
||||||
|
int second = initializer.Second;
|
||||||
|
long ticks = 0;
|
||||||
|
string dmtf = dmtfDate;
|
||||||
|
System.DateTime datetime = System.DateTime.MinValue;
|
||||||
|
string tempString = string.Empty;
|
||||||
|
if (String.IsNullOrEmpty(dmtf))
|
||||||
|
{
|
||||||
|
return DateTime.MinValue;
|
||||||
|
}
|
||||||
|
else if ((dmtf.Length != 25))
|
||||||
|
{
|
||||||
|
throw new System.ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tempString = dmtf.Substring(0, 4);
|
||||||
|
if (("****" != tempString))
|
||||||
|
{
|
||||||
|
year = int.Parse(tempString);
|
||||||
|
}
|
||||||
|
tempString = dmtf.Substring(4, 2);
|
||||||
|
if (("**" != tempString))
|
||||||
|
{
|
||||||
|
month = int.Parse(tempString);
|
||||||
|
}
|
||||||
|
tempString = dmtf.Substring(6, 2);
|
||||||
|
if (("**" != tempString))
|
||||||
|
{
|
||||||
|
day = int.Parse(tempString);
|
||||||
|
}
|
||||||
|
tempString = dmtf.Substring(8, 2);
|
||||||
|
if (("**" != tempString))
|
||||||
|
{
|
||||||
|
hour = int.Parse(tempString);
|
||||||
|
}
|
||||||
|
tempString = dmtf.Substring(10, 2);
|
||||||
|
if (("**" != tempString))
|
||||||
|
{
|
||||||
|
minute = int.Parse(tempString);
|
||||||
|
}
|
||||||
|
tempString = dmtf.Substring(12, 2);
|
||||||
|
if (("**" != tempString))
|
||||||
|
{
|
||||||
|
second = int.Parse(tempString);
|
||||||
|
}
|
||||||
|
tempString = dmtf.Substring(15, 6);
|
||||||
|
if (("******" != tempString))
|
||||||
|
{
|
||||||
|
ticks = (long.Parse(tempString) * ((long)((System.TimeSpan.TicksPerMillisecond / 1000))));
|
||||||
|
}
|
||||||
|
if (((((((((year < 0)
|
||||||
|
|| (month < 0))
|
||||||
|
|| (day < 0))
|
||||||
|
|| (hour < 0))
|
||||||
|
|| (minute < 0))
|
||||||
|
|| (minute < 0))
|
||||||
|
|| (second < 0))
|
||||||
|
|| (ticks < 0)))
|
||||||
|
{
|
||||||
|
throw new System.ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
throw new System.ArgumentOutOfRangeException(null, e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (year == 0
|
||||||
|
&& month == 0
|
||||||
|
&& day == 0
|
||||||
|
&& hour == 0
|
||||||
|
&& minute == 0
|
||||||
|
&& second == 0
|
||||||
|
&& ticks == 0)
|
||||||
|
return DateTime.MinValue;
|
||||||
|
|
||||||
|
datetime = new System.DateTime(year, month, day, hour, minute, second, 0);
|
||||||
|
datetime = datetime.AddTicks(ticks);
|
||||||
|
System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(datetime);
|
||||||
|
int UTCOffset = 0;
|
||||||
|
int OffsetToBeAdjusted = 0;
|
||||||
|
long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
|
||||||
|
tempString = dmtf.Substring(22, 3);
|
||||||
|
if ((tempString != "******"))
|
||||||
|
{
|
||||||
|
tempString = dmtf.Substring(21, 4);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
UTCOffset = int.Parse(tempString);
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
throw new System.ArgumentOutOfRangeException(null, e.Message);
|
||||||
|
}
|
||||||
|
OffsetToBeAdjusted = ((int)((OffsetMins - UTCOffset)));
|
||||||
|
datetime = datetime.AddMinutes(((double)(OffsetToBeAdjusted)));
|
||||||
|
}
|
||||||
|
return datetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Converts a given System.DateTime object to DMTF datetime format.
|
||||||
|
internal string ToDmtfDateTime(System.DateTime date)
|
||||||
|
{
|
||||||
|
string utcString = string.Empty;
|
||||||
|
System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(date);
|
||||||
|
long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute)));
|
||||||
|
if ((System.Math.Abs(OffsetMins) > 999))
|
||||||
|
{
|
||||||
|
date = date.ToUniversalTime();
|
||||||
|
utcString = "+000";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((tickOffset.Ticks >= 0))
|
||||||
|
{
|
||||||
|
utcString = string.Concat("+", ((System.Int64)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))).ToString().PadLeft(3, '0'));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string strTemp = ((System.Int64)(OffsetMins)).ToString();
|
||||||
|
utcString = string.Concat("-", strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3, '0'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string dmtfDateTime = ((System.Int32)(date.Year)).ToString().PadLeft(4, '0');
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Month)).ToString().PadLeft(2, '0'));
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Day)).ToString().PadLeft(2, '0'));
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Hour)).ToString().PadLeft(2, '0'));
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Minute)).ToString().PadLeft(2, '0'));
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Second)).ToString().PadLeft(2, '0'));
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, ".");
|
||||||
|
System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0);
|
||||||
|
long microsec = ((long)((((date.Ticks - dtTemp.Ticks)
|
||||||
|
* 1000)
|
||||||
|
/ System.TimeSpan.TicksPerMillisecond)));
|
||||||
|
string strMicrosec = ((System.Int64)(microsec)).ToString();
|
||||||
|
if ((strMicrosec.Length > 6))
|
||||||
|
{
|
||||||
|
strMicrosec = strMicrosec.Substring(0, 6);
|
||||||
|
}
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, strMicrosec.PadLeft(6, '0'));
|
||||||
|
dmtfDateTime = string.Concat(dmtfDateTime, utcString);
|
||||||
|
return dmtfDateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ManagementScope GetScope()
|
||||||
|
{
|
||||||
|
if (scope != null)
|
||||||
|
return scope;
|
||||||
|
|
||||||
|
// create new scope
|
||||||
|
if (String.IsNullOrEmpty(computerName))
|
||||||
|
{
|
||||||
|
// local
|
||||||
|
scope = new ManagementScope(nameSpace);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// remote
|
||||||
|
ConnectionOptions options = new ConnectionOptions();
|
||||||
|
|
||||||
|
string path = String.Format(@"\\{0}\{1}", computerName, nameSpace);
|
||||||
|
scope = new ManagementScope(path, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
// connect
|
||||||
|
scope.Connect();
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -488,7 +488,7 @@ namespace WebsitePanel.Providers.Virtualization
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateVirtualMachineGeneralSettings(string vmId, ManagementObject objVM, int cpuCores, int ramMB, bool bootFromCD, bool numLockEnabled)
|
private void UpdateVirtualMachineGeneralSettings(string vmId, ManagementObject objVM, int cpuCores, long ramMB, bool bootFromCD, bool numLockEnabled)
|
||||||
{
|
{
|
||||||
// request management service
|
// request management service
|
||||||
ManagementObject objVmsvc = GetVirtualSystemManagementService();
|
ManagementObject objVmsvc = GetVirtualSystemManagementService();
|
||||||
|
@ -1989,10 +1989,10 @@ exit", Convert.ToInt32(objDisk["Index"])));
|
||||||
|
|
||||||
#region Stop
|
#region Stop
|
||||||
else if (!started &&
|
else if (!started &&
|
||||||
(vps.State == VirtualMachineState.Started
|
(vps.State == VirtualMachineState.Running
|
||||||
|| vps.State == VirtualMachineState.Paused))
|
|| vps.State == VirtualMachineState.Paused))
|
||||||
{
|
{
|
||||||
if (vps.State == VirtualMachineState.Started)
|
if (vps.State == VirtualMachineState.Running)
|
||||||
{
|
{
|
||||||
// try to shutdown the system
|
// try to shutdown the system
|
||||||
ReturnCode code = ShutDownVirtualMachine(vm.VirtualMachineId, true, "Virtual Machine has been suspended from WebsitePanel");
|
ReturnCode code = ShutDownVirtualMachine(vm.VirtualMachineId, true, "Virtual Machine has been suspended from WebsitePanel");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2013
|
# Visual Studio 2013
|
||||||
VisualStudioVersion = 12.0.30723.0
|
VisualStudioVersion = 12.0.21005.1
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
@ -154,6 +154,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Host
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Mail.IceWarp", "WebsitePanel.Providers.Mail.IceWarp\WebsitePanel.Providers.Mail.IceWarp.csproj", "{95EA2D6E-278C-4A74-97DB-946362C4DEEA}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Mail.IceWarp", "WebsitePanel.Providers.Mail.IceWarp\WebsitePanel.Providers.Mail.IceWarp.csproj", "{95EA2D6E-278C-4A74-97DB-946362C4DEEA}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Virtualization.HyperV2012R2", "WebsitePanel.Providers.Virtualization.HyperV-2012R2\WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj", "{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -774,6 +776,16 @@ Global
|
||||||
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|x86.ActiveCfg = Release|Any CPU
|
{95EA2D6E-278C-4A74-97DB-946362C4DEEA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{EE40516B-93DF-4CAB-80C4-64DCE0B751CC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -56,15 +56,15 @@ namespace WebsitePanel.Portal
|
||||||
set { ViewState["DisplayText"] = value; }
|
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; }
|
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; }
|
set { ViewState["Total"] = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ namespace WebsitePanel.Portal
|
||||||
string bkgSrc = Page.ResolveUrl(PortalUtils.GetThemedImage("gauge_bkg.gif"));
|
string bkgSrc = Page.ResolveUrl(PortalUtils.GetThemedImage("gauge_bkg.gif"));
|
||||||
|
|
||||||
// calculate the width of the gauge
|
// 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;
|
int percent = (fTotal > 0) ? Convert.ToInt32(Math.Round((double)Progress / (double)fTotal * 100)) : 0;
|
||||||
|
|
||||||
double fFilledWidth = (fTotal > 0) ? ((double)Progress / (double)fTotal * Width) : 0;
|
double fFilledWidth = (fTotal > 0) ? ((double)Progress / (double)fTotal * Width) : 0;
|
||||||
|
|
|
@ -92,7 +92,7 @@ namespace WebsitePanel.Portal
|
||||||
|
|
||||||
private void UpdateControl()
|
private void UpdateControl()
|
||||||
{
|
{
|
||||||
int total = gauge.Total;
|
long total = gauge.Total;
|
||||||
if (QuotaTypeId == 1)
|
if (QuotaTypeId == 1)
|
||||||
{
|
{
|
||||||
litValue.Text = (total == 0) ? GetLocalizedString("Text.Disabled") : GetLocalizedString("Text.Enabled");
|
litValue.Text = (total == 0) ? GetLocalizedString("Text.Disabled") : GetLocalizedString("Text.Enabled");
|
||||||
|
|
|
@ -213,6 +213,9 @@
|
||||||
<data name="Heartbeat.OK" xml:space="preserve">
|
<data name="Heartbeat.OK" xml:space="preserve">
|
||||||
<value>OK</value>
|
<value>OK</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Heartbeat.Paused" xml:space="preserve">
|
||||||
|
<value>Paused</value>
|
||||||
|
</data>
|
||||||
<data name="locChangeHostname.Text" xml:space="preserve">
|
<data name="locChangeHostname.Text" xml:space="preserve">
|
||||||
<value>Change VPS Host Name</value>
|
<value>Change VPS Host Name</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -273,6 +276,9 @@
|
||||||
<data name="State.Starting" xml:space="preserve">
|
<data name="State.Starting" xml:space="preserve">
|
||||||
<value>Starting</value>
|
<value>Starting</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="State.Running" xml:space="preserve">
|
||||||
|
<value>Running</value>
|
||||||
|
</data>
|
||||||
<data name="State.Stopping" xml:space="preserve">
|
<data name="State.Stopping" xml:space="preserve">
|
||||||
<value>Stopping</value>
|
<value>Stopping</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
|
@ -98,9 +98,9 @@ namespace WebsitePanel.Portal.VPS
|
||||||
TimeSpan uptime = TimeSpan.FromMilliseconds(vm.Uptime);
|
TimeSpan uptime = TimeSpan.FromMilliseconds(vm.Uptime);
|
||||||
uptime = uptime.Subtract(TimeSpan.FromMilliseconds(uptime.Milliseconds));
|
uptime = uptime.Subtract(TimeSpan.FromMilliseconds(uptime.Milliseconds));
|
||||||
litUptime.Text = uptime.ToString();
|
litUptime.Text = uptime.ToString();
|
||||||
litStatus.Text = GetLocalizedString("State." + vm.State.ToString());
|
litStatus.Text = GetLocalizedString("State." + vm.State);
|
||||||
litCreated.Text = vm.CreatedDate.ToString();
|
litCreated.Text = vm.CreatedDate.ToString();
|
||||||
litHeartbeat.Text = GetLocalizedString("Heartbeat." + vm.Heartbeat.ToString());
|
litHeartbeat.Text = GetLocalizedString("Heartbeat." + vm.Heartbeat);
|
||||||
|
|
||||||
// CPU
|
// CPU
|
||||||
cpuGauge.Progress = vm.CpuUsage;
|
cpuGauge.Progress = vm.CpuUsage;
|
||||||
|
@ -155,7 +155,7 @@ namespace WebsitePanel.Portal.VPS
|
||||||
|| vm.State == VirtualMachineState.Saved))
|
|| vm.State == VirtualMachineState.Saved))
|
||||||
buttons.Add(CreateActionButton("Start", "start.png"));
|
buttons.Add(CreateActionButton("Start", "start.png"));
|
||||||
|
|
||||||
if (vm.State == VirtualMachineState.Started)
|
if (vm.State == VirtualMachineState.Running)
|
||||||
{
|
{
|
||||||
if(vmi.RebootAllowed)
|
if(vmi.RebootAllowed)
|
||||||
buttons.Add(CreateActionButton("Reboot", "reboot.png"));
|
buttons.Add(CreateActionButton("Reboot", "reboot.png"));
|
||||||
|
@ -165,12 +165,12 @@ namespace WebsitePanel.Portal.VPS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vmi.StartTurnOffAllowed
|
if (vmi.StartTurnOffAllowed
|
||||||
&& (vm.State == VirtualMachineState.Started
|
&& (vm.State == VirtualMachineState.Running
|
||||||
|| vm.State == VirtualMachineState.Paused))
|
|| vm.State == VirtualMachineState.Paused))
|
||||||
buttons.Add(CreateActionButton("TurnOff", "turnoff.png"));
|
buttons.Add(CreateActionButton("TurnOff", "turnoff.png"));
|
||||||
|
|
||||||
if (vmi.PauseResumeAllowed
|
if (vmi.PauseResumeAllowed
|
||||||
&& vm.State == VirtualMachineState.Started)
|
&& vm.State == VirtualMachineState.Running)
|
||||||
buttons.Add(CreateActionButton("Pause", "pause.png"));
|
buttons.Add(CreateActionButton("Pause", "pause.png"));
|
||||||
|
|
||||||
if (vmi.PauseResumeAllowed
|
if (vmi.PauseResumeAllowed
|
||||||
|
@ -178,7 +178,7 @@ namespace WebsitePanel.Portal.VPS
|
||||||
buttons.Add(CreateActionButton("Resume", "start2.png"));
|
buttons.Add(CreateActionButton("Resume", "start2.png"));
|
||||||
|
|
||||||
if (vmi.ResetAllowed
|
if (vmi.ResetAllowed
|
||||||
&& (vm.State == VirtualMachineState.Started
|
&& (vm.State == VirtualMachineState.Running
|
||||||
|| vm.State == VirtualMachineState.Paused))
|
|| vm.State == VirtualMachineState.Paused))
|
||||||
buttons.Add(CreateActionButton("Reset", "reset2.png"));
|
buttons.Add(CreateActionButton("Reset", "reset2.png"));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue