wsp-10327 Add Dynamic Memory to VPS - Isolate VPS2012.

This commit is contained in:
Alexander Trofimov 2015-04-06 10:31:41 +03:00
parent 054908269c
commit 03a675cf03
176 changed files with 31069 additions and 1612 deletions

View file

@ -3456,6 +3456,21 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@Recursive", recursive));
return reader;
}
public static IDataReader GetVirtualMachinesPaged2012(int actorId, int packageId, string filterColumn, string filterValue,
string sortColumn, int startRow, int maximumRows, bool recursive)
{
IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure,
"GetVirtualMachinesPaged2012",
new SqlParameter("@ActorID", actorId),
new SqlParameter("@PackageID", packageId),
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
new SqlParameter("@StartRow", startRow),
new SqlParameter("@MaximumRows", maximumRows),
new SqlParameter("@Recursive", recursive));
return reader;
}
#endregion
public static IDataReader GetVirtualMachinesForPCPaged(int actorId, int packageId, string filterColumn, string filterValue,

View file

@ -488,6 +488,7 @@ namespace WebsitePanel.EnterpriseServer
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MySql5, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Statistics, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPS, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPS2012, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, "");
}
}
@ -711,6 +712,11 @@ namespace WebsitePanel.EnterpriseServer
if (Utils.ParseBool(vpsSettings["AutoAssignExternalIP"], true))
ServerController.AllocateMaximumPackageIPAddresses(packageId, ResourceGroups.VPS, IPAddressPool.VpsExternalNetwork);
// allocate "VPS" IP addresses
int vps2012ServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.VPS2012);
StringDictionary vps2012Settings = ServerController.GetServiceSettings(vps2012ServiceId);
if (Utils.ParseBool(vps2012Settings["AutoAssignExternalIP"], true))
ServerController.AllocateMaximumPackageIPAddresses(packageId, ResourceGroups.VPS2012, IPAddressPool.VpsExternalNetwork);
// allocate "VPSForPC" IP addresses
int vpsfcpServiceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.VPSForPC);
@ -1681,6 +1687,18 @@ namespace WebsitePanel.EnterpriseServer
}
}
// VPS2012
else if (String.Compare(PackageSettings.VIRTUAL_PRIVATE_SERVERS_2012, settingsName, true) == 0)
{
// load Exchange service settings
int vpsServiceId = GetPackageServiceId(packageId, ResourceGroups.VPS2012);
if (vpsServiceId > 0)
{
StringDictionary vpsSettings = ServerController.GetServiceSettings(vpsServiceId);
settings["HostnamePattern"] = vpsSettings["HostnamePattern"];
}
}
//vpforCP
else if (String.Compare(PackageSettings.VIRTUAL_PRIVATE_SERVERS_FOR_PRIVATE_CLOUD, settingsName, true) == 0)
{

View file

@ -1481,6 +1481,10 @@ namespace WebsitePanel.EnterpriseServer
{
return Quotas.VPS_EXTERNAL_IP_ADDRESSES_NUMBER;
}
else if (String.Compare(groupName, ResourceGroups.VPS2012, true) == 0)
{
return Quotas.VPS2012_EXTERNAL_IP_ADDRESSES_NUMBER;
}
else if (String.Compare(groupName, ResourceGroups.VPSForPC, true) == 0)
{
return Quotas.VPSForPC_EXTERNAL_IP_ADDRESSES_NUMBER;
@ -1840,6 +1844,7 @@ namespace WebsitePanel.EnterpriseServer
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.MySql5, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.Statistics, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPS, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPS2012, domain, "");
ServerController.AddServiceDNSRecords(packageId, ResourceGroups.VPSForPC, domain, "");
}
@ -2403,6 +2408,7 @@ namespace WebsitePanel.EnterpriseServer
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.MySql5, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Statistics, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.VPS, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.VPS2012, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.VPSForPC, domain, "");
ServerController.AddServiceDNSRecords(domain.PackageId, ResourceGroups.Dns, domain, "");
break;

View file

@ -0,0 +1,85 @@
// Copyright (c) 2015, 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.Web;
using System.Threading;
using WebsitePanel.Providers.Virtualization;
namespace WebsitePanel.EnterpriseServer
{
public class CreateServerAsyncWorker2012
{
#region Properties
public int ThreadUserId { get; set; }
public string TaskId { get; set; }
public VirtualMachine Item { get; set; }
public LibraryItem OsTemplate { get; set; }
public int ExternalAddressesNumber { get; set; }
public bool RandomExternalAddresses { get; set; }
public int[] ExternalAddresses { get; set; }
public int PrivateAddressesNumber { get; set; }
public bool RandomPrivateAddresses { get; set; }
public string[] PrivateAddresses { get; set; }
public string SummaryLetterEmail { get; set; }
#endregion
public CreateServerAsyncWorker2012()
{
ThreadUserId = -1; // admin
}
#region Create
public void CreateAsync()
{
// start asynchronously
Thread t = new Thread(new ThreadStart(Create));
t.Start();
}
private void Create()
{
// impersonate thread
if (ThreadUserId != -1)
SecurityContext.SetThreadPrincipal(ThreadUserId);
// perform backup
VirtualizationServerController2012.CreateVirtualMachineInternal(TaskId, Item, OsTemplate,
ExternalAddressesNumber, RandomExternalAddresses, ExternalAddresses,
PrivateAddressesNumber, RandomPrivateAddresses, PrivateAddresses,
SummaryLetterEmail);
}
#endregion
}
}

View file

@ -173,6 +173,8 @@
<Compile Include="Tasks\TaskManager.cs" />
<Compile Include="Users\UserAsyncWorker.cs" />
<Compile Include="Users\UserController.cs" />
<Compile Include="Virtualization2012\CreateServerAsyncWorker2012.cs" />
<Compile Include="Virtualization2012\VirtualizationServerController2012.cs" />
<Compile Include="VirtualizationForPrivateCloud\CreateAsyncVMfromVM.cs" />
<Compile Include="VirtualizationForPrivateCloud\CreateServerAsyncWorkerForPrivateCloud.cs" />
<Compile Include="VirtualizationForPrivateCloud\VirtualizationServerControllerForPrivateCloud.cs" />