mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
merge changes from parent branch
This commit is contained in:
commit
e936a52f10
@ -33,6 +33,7 @@ public class ApiConstants {
|
||||
public static final String CERTIFICATE = "certificate";
|
||||
public static final String PRIVATE_KEY = "privatekey";
|
||||
public static final String DOMAIN_SUFFIX = "domainsuffix";
|
||||
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
|
||||
public static final String CIDR = "cidr";
|
||||
public static final String CIDR_LIST = "cidrlist";
|
||||
public static final String CLEANUP = "cleanup";
|
||||
|
||||
@ -99,6 +99,10 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd {
|
||||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
return _lbService.findById(id).getNetworkId();
|
||||
LoadBalancer lb = _lbService.findById(id);
|
||||
if (lb == null) {
|
||||
return null;
|
||||
}
|
||||
return lb.getNetworkId();
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,6 +120,7 @@ public class ListLoadBalancerRulesCmd extends BaseListCmd {
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
/*
|
||||
public ListLoadBalancerRulesCmd(String accountName, Long domainId, Long id, String loadBalancerRuleName, Long publicIpId, Long virtualMachineId, Long zoneId) {
|
||||
super();
|
||||
this.accountName = accountName;
|
||||
@ -130,4 +131,5 @@ public class ListLoadBalancerRulesCmd extends BaseListCmd {
|
||||
this.virtualMachineId = virtualMachineId;
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -80,6 +81,9 @@ public class UpdateZoneCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Network domain name for the networks in the zone")
|
||||
private String domain;
|
||||
|
||||
@Parameter(name=ApiConstants.DNS_SEARCH_ORDER, type=CommandType.LIST, collectionType = CommandType.STRING, description="the dns search order list")
|
||||
private List<String> dnsSearchOrder;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -135,7 +139,10 @@ public class UpdateZoneCmd extends BaseCmd {
|
||||
public String getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getDnsSearchOrder() {
|
||||
return dnsSearchOrder;
|
||||
}
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -42,8 +42,6 @@ force.remove.host.warning=Warning: Choosing this option will cause CloudStack to
|
||||
force.stop=Force Stop
|
||||
force.stop.instance.warning=Warning: Forcing a stop on this instance should be your last option. It can lead to data loss as well as inconsistent behavior of the virtual machine's state. Please consult with the Administrator Guide or Cloud.com Support before executing this command.
|
||||
|
||||
label.add.load.balancer.and.ip=Add Load Balancer and IP
|
||||
|
||||
label.PreSetup=PreSetup
|
||||
label.SR.name = SR Name-Label
|
||||
label.SharedMountPoint=SharedMountPoint
|
||||
|
||||
@ -42,8 +42,6 @@ force.remove.host.warning=Advertencia: Si elige esta opción, CloudStack para de
|
||||
force.stop=Grupo de Alto
|
||||
force.stop.instance.warning=Advertencia: Obligar a una parada en este caso debería ser su última opción. Puede conducir a la pérdida de datos, así como un comportamiento incoherente del estado de la máquina virtual. Por favor, consulte con la Guía del administrador o al Cloud.com antes de ejecutar este comando.
|
||||
|
||||
label.add.load.balancer.and.ip=Añadir el equilibrador de carga y de propiedad intelectual
|
||||
|
||||
label.PreSetup=PreSetup
|
||||
label.SR.name = SR Nombre de etiqueta
|
||||
label.SharedMountPoint = SharedMountPoint
|
||||
|
||||
@ -42,8 +42,6 @@ force.remove.host.warning=警告:このオプションを選択すると、実
|
||||
force.stop=強制停止
|
||||
force.stop.instance.warning=警告:このオプションは他に選択肢が無い場合に選択してください。インスタンスの強制停止はデータの損失だけでなく、仮想マシンの状態の一貫性を失う事があります。この操作を行う前に、管理者ガイドを参照されるか、またはCloud.comサポートにご連絡ください。
|
||||
|
||||
label.add.load.balancer.and.ip=ロードバランサとIPを追加します。
|
||||
|
||||
label.PreSetup=PreSetup
|
||||
label.SR.name=SR名-ラベル
|
||||
label.SharedMountPoint = SharedMountPoint
|
||||
|
||||
@ -42,8 +42,6 @@ force.remove.host.warning=警告:选择此选项将导致CloudStack强行删
|
||||
force.stop=强制停止
|
||||
force.stop.instance.warning=警告:强制停止在这种情况下应该是你最后的选择。它可以导致数据丢失,以及虚拟机的状态不一致的行为。请与系统管理员指南或Cloud.com支援与顾问在执行此命令。
|
||||
|
||||
label.add.load.balancer.and.ip=添加负载平衡器和IP
|
||||
|
||||
label.PreSetup=PreSetup
|
||||
label.SR.name=简名称标签
|
||||
label.SharedMountPoint = SharedMountPoint
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
<components.xml>
|
||||
<system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
|
||||
<checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
|
||||
<checker name="DatabaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker"/>
|
||||
<checker name="DatabaseUpgradeChecker" class="com.cloud.upgrade.DatabaseUpgradeChecker"/>
|
||||
</system-integrity-checker>
|
||||
|
||||
|
||||
@ -256,6 +256,33 @@ setup_dnsmasq() {
|
||||
sed -i -e "s/^dhcp-range=.*$/dhcp-range=$DHCP_RANGE,static/" /etc/dnsmasq.conf
|
||||
sed -i -e "s/^[#]*listen-address=.*$/listen-address=$ETH0_IP/" /etc/dnsmasq.conf
|
||||
|
||||
if [ "$RROUTER" == "1" ]
|
||||
then
|
||||
sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf
|
||||
echo "dhcp-option=option:router,$GUEST_GW" >> /etc/dnsmasq.conf
|
||||
sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
|
||||
echo "dhcp-option=6,$GUEST_GW" >> /etc/dnsmasq.conf
|
||||
fi
|
||||
|
||||
if [ -n "$DNS_SEARCH_ORDER" ]
|
||||
then
|
||||
sed -i -e "/^[#]*dhcp-option=119.*$/d" /etc/dnsmasq.conf
|
||||
echo "dhcp-option=119,$DNS_SEARCH_ORDER" >> /etc/dnsmasq.conf
|
||||
fi
|
||||
|
||||
if [ "$USE_EXTERNAL_DNS" == "true" ]
|
||||
then
|
||||
sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf
|
||||
if [ -n "$NS1" ]
|
||||
then
|
||||
if [ -n "$NS2" ]
|
||||
then
|
||||
echo "dhcp-option=6,$NS1,$NS2" >> /etc/dnsmasq.conf
|
||||
else
|
||||
echo "dhcp-option=6,$NS1" >> /etc/dnsmasq.conf
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
setup_sshd(){
|
||||
@ -512,6 +539,12 @@ for i in $CMDLINE
|
||||
domain)
|
||||
DOMAIN=$VALUE
|
||||
;;
|
||||
dnssearchorder)
|
||||
DNS_SEARCH_ORDER=$VALUE
|
||||
;;
|
||||
useextdns)
|
||||
USE_EXTERNAL_DNS=$VALUE
|
||||
;;
|
||||
mgmtcidr)
|
||||
MGMTNET=$VALUE
|
||||
;;
|
||||
|
||||
@ -173,6 +173,10 @@ public enum Config {
|
||||
EndpointeUrl("Advanced", ManagementServer.class, String.class, "endpointe.url", "http://localhost:8080/client/api", "Endpointe Url", "The endpoint callback URL"),
|
||||
ElasticLoadBalancerEnabled("Advanced", ManagementServer.class, String.class, "network.loadbalancer.basiczone.elb.enabled", "true", "Whether the load balancing service is enabled for basic zones", "true,false"),
|
||||
ElasticLoadBalancerNetwork("Advanced", ManagementServer.class, String.class, "network.loadbalancer.basiczone.elb.network", "guest", "Whether the elastic load balancing service public ips are taken from the public or guest network", "guest,public"),
|
||||
ElasticLoadBalancerVmMemory("Advanced", ManagementServer.class, Integer.class, "network.loadbalancer.basiczone.elb.vm.ram.size", "128", "Memory in MB for the elastic load balancer vm", null),
|
||||
ElasticLoadBalancerVmCpuMhz("Advanced", ManagementServer.class, Integer.class, "network.loadbalancer.basiczone.elb.vm.cpu.mhz", "128", "CPU speed for the elastic load balancer vm", null),
|
||||
ElasticLoadBalancerVmNumVcpu("Advanced", ManagementServer.class, Integer.class, "network.loadbalancer.basiczone.elb.vm.vcpu.num", "1", "Number of VCPU for the elastic load balancer vm", null),
|
||||
ElasticLoadBalancerVmGcInterval("Advanced", ManagementServer.class, Integer.class, "network.loadbalancer.basiczone.elb.gc.interval.minutes", "30", "Garbage collection interval to destroy unused ELB vms in minutes. Minimum of 5", null),
|
||||
|
||||
|
||||
|
||||
@ -241,6 +245,7 @@ public enum Config {
|
||||
|
||||
AgentLbEnable("Advanced", ClusterManager.class, Boolean.class, "agent.lb.enabled", "true", "If agent load balancing enabled in cluster setup", null),
|
||||
SubDomainNetworkAccess("Advanced", NetworkManager.class, Boolean.class, "allow.subdomain.network.access", "true", "Allow subdomains to use networks dedicated to their parent domain(s)", null),
|
||||
UseExternalDnsServers("Advanced", NetworkManager.class, Boolean.class, "use.external.dns", "false", "Bypass internal dns, use exetrnal dns1 and dns2", null),
|
||||
EncodeApiResponse("Advanced", ManagementServer.class, Boolean.class, "encode.api.response", "false", "Do UTF-8 encoding for the api response, false by default", null),
|
||||
|
||||
ClusterMessageTimeOutSeconds("Advanced", ManagementServer.class, Integer.class, "cluster.message.timeout.seconds", "300", "Time (in seconds) to wait before a inter-management server message post times out.", null);
|
||||
|
||||
@ -121,6 +121,7 @@ import com.cloud.user.UserContext;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
import com.cloud.user.dao.UserDao;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.component.Adapters;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.Inject;
|
||||
@ -1155,6 +1156,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
String internalDns2 = cmd.getInternalDns2();
|
||||
String vnetRange = cmd.getVlan();
|
||||
String guestCidr = cmd.getGuestCidrAddress();
|
||||
List<String> dnsSearchOrder = cmd.getDnsSearchOrder();
|
||||
Long userId = UserContext.current().getCallerUserId();
|
||||
int startVnetRange = 0;
|
||||
int stopVnetRange = 0;
|
||||
@ -1181,7 +1183,19 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
}*/
|
||||
newDetails.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add the domain prefix list to details if not null
|
||||
if (dnsSearchOrder != null){
|
||||
for(String dom : dnsSearchOrder){
|
||||
if (!NetUtils.verifyDomainName(dom)) {
|
||||
throw new InvalidParameterValueException(
|
||||
"Invalid network domain suffixes. Total length shouldn't exceed 190 chars. Each domain label must be between 1 and 63 characters long, can contain ASCII letters 'a' through 'z', the digits '0' through '9', "
|
||||
+ "and the hyphen ('-'); can't start or end with \"-\"");
|
||||
}
|
||||
}
|
||||
newDetails.put(ZoneConfig.DnsSearchOrder.getName(), StringUtils.join(dnsSearchOrder, ","));
|
||||
}
|
||||
|
||||
if (userId == null) {
|
||||
userId = Long.valueOf(User.UID_SYSTEM);
|
||||
|
||||
@ -28,7 +28,8 @@ public enum ZoneConfig {
|
||||
MaxVirtualMachines( Long.class, "max.vms", null, "Maximum number of VMs the Zone can have", null),
|
||||
ZoneMode( String.class, "zone.mode", null, "Mode of the Zone", "Free,Basic,Advanced"),
|
||||
HasNoPublicIp(Boolean.class, "has.no.public.ip", "false", "True if Zone has no public IP", null),
|
||||
DhcpStrategy(String.class, "zone.dhcp.strategy", "cloudstack-systemvm", "Who controls DHCP", "cloudstack-systemvm,cloudstack-external,external");
|
||||
DhcpStrategy(String.class, "zone.dhcp.strategy", "cloudstack-systemvm", "Who controls DHCP", "cloudstack-systemvm,cloudstack-external,external"),
|
||||
DnsSearchOrder(String.class, "network.guestnetwork.dns.search.order", null, "Domains list to be used for domain search order", null);
|
||||
|
||||
|
||||
private final Class<?> _type;
|
||||
|
||||
@ -37,5 +37,6 @@ public interface ElasticLoadBalancerManager {
|
||||
throws ResourceUnavailableException;
|
||||
|
||||
public LoadBalancer handleCreateLoadBalancerRule(CreateLoadBalancerRuleCmd lb, Account caller) throws InsufficientAddressCapacityException, NetworkRuleConflictException;
|
||||
|
||||
|
||||
public void handleDeleteLoadBalancerRule(LoadBalancer lb, long callerUserId, Account caller);
|
||||
}
|
||||
|
||||
@ -18,9 +18,13 @@
|
||||
package com.cloud.network.lb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -190,8 +194,11 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
String _mgmtCidr;
|
||||
String _mgmtHost;
|
||||
|
||||
Set<Long> _gcCandidateElbVmIds = Collections.newSetFromMap(new ConcurrentHashMap<Long,Boolean>());
|
||||
|
||||
int _elasticLbVmRamSize;
|
||||
int _elasticLbvmCpuMHz;
|
||||
int _elasticLbvmNumCpu;
|
||||
|
||||
private Long getPodIdForDirectIp(IPAddressVO ipAddr) {
|
||||
List<PodVlanMapVO> podVlanMaps = _podVlanMapDao.listPodVlanMapsByVlan(ipAddr.getVlanId());
|
||||
@ -213,20 +220,19 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
params.put(VirtualMachineProfile.Param.RestartNetwork, true);
|
||||
Account owner = _accountService.getActiveAccount("system", new Long(1));
|
||||
DeployDestination dest = new DeployDestination(dc, pod, null, null);
|
||||
s_logger.debug("About to deploy elastic LB vm ");
|
||||
s_logger.debug("About to deploy ELB vm ");
|
||||
|
||||
try {
|
||||
DomainRouterVO elbVm = deployELBVm(network, dest, owner, params);
|
||||
|
||||
s_logger.debug("ELB vm = " + elbVm);
|
||||
if (elbVm == null) {
|
||||
throw new InvalidParameterValueException("Could not deploy or find existing ELB VM");
|
||||
}
|
||||
s_logger.debug("Deployed ELB vm = " + elbVm);
|
||||
|
||||
return elbVm;
|
||||
|
||||
} catch (Throwable t) {
|
||||
String errorMsg = "Error while deploying Loadbalancer VM: " + t;
|
||||
s_logger.warn(errorMsg);
|
||||
s_logger.warn("Error while deploying ELB VM: " + t);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -368,9 +374,12 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
|
||||
boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
|
||||
|
||||
_elasticLbVmRamSize = NumbersUtil.parseInt(configs.get("elastic.lb.vm.ram.size"), DEFAULT_ELB_VM_RAMSIZE);
|
||||
_elasticLbvmCpuMHz = NumbersUtil.parseInt(configs.get("elastic.lb.vm.cpu.mhz"), DEFAULT_ELB_VM_CPU_MHZ);
|
||||
_elasticLbVmOffering = new ServiceOfferingVO("System Offering For Elastic LB VM", 1, _elasticLbVmRamSize, _elasticLbvmCpuMHz, 0, 0, true, null, useLocalStorage, true, null, true, VirtualMachine.Type.ElasticLoadBalancerVm, true);
|
||||
_elasticLbVmRamSize = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmMemory.key()), DEFAULT_ELB_VM_RAMSIZE);
|
||||
_elasticLbvmCpuMHz = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmCpuMhz.key()), DEFAULT_ELB_VM_CPU_MHZ);
|
||||
_elasticLbvmNumCpu = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmNumVcpu.key()), 1);
|
||||
_elasticLbVmOffering = new ServiceOfferingVO("System Offering For Elastic LB VM", _elasticLbvmNumCpu,
|
||||
_elasticLbVmRamSize, _elasticLbvmCpuMHz, 0, 0, true, null, useLocalStorage,
|
||||
true, null, true, VirtualMachine.Type.ElasticLoadBalancerVm, true);
|
||||
_elasticLbVmOffering.setUniqueName("Cloud.Com-ElasticLBVm");
|
||||
_elasticLbVmOffering = _serviceOfferingDao.persistSystemServiceOffering(_elasticLbVmOffering);
|
||||
|
||||
@ -378,6 +387,7 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
|
||||
String enabled = _configDao.getValue(Config.ElasticLoadBalancerEnabled.key());
|
||||
_enabled = (enabled == null) ? false: Boolean.parseBoolean(enabled);
|
||||
s_logger.info("Elastic Load balancer enabled: " + _enabled);
|
||||
if (_enabled) {
|
||||
String traffType = _configDao.getValue(Config.ElasticLoadBalancerNetwork.key());
|
||||
if ("guest".equalsIgnoreCase(traffType)) {
|
||||
@ -386,6 +396,11 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
_frontendTrafficType = TrafficType.Public;
|
||||
} else
|
||||
throw new ConfigurationException("Traffic type for front end of load balancer has to be guest or public; found : " + traffType);
|
||||
s_logger.info("Elastic Load Balancer: will balance on " + traffType );
|
||||
int gcIntervalMinutes = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmGcInterval.key()), 5);
|
||||
if (gcIntervalMinutes < 5)
|
||||
gcIntervalMinutes = 5;
|
||||
s_logger.info("Elastic Load Balancer: scheduling GC to run every " + gcIntervalMinutes + " minutes" );
|
||||
_gcThreadPool = Executors.newScheduledThreadPool(1, new NamedThreadFactory("ELBVM-GC"));
|
||||
_gcThreadPool.scheduleAtFixedRate(new CleanupThread(), gcIntervalMinutes, gcIntervalMinutes, TimeUnit.MINUTES);
|
||||
_itMgr.registerGuru(VirtualMachine.Type.ElasticLoadBalancerVm, this);
|
||||
@ -568,7 +583,11 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
|
||||
public void releaseIp(long ipId, long userId, Account caller) {
|
||||
s_logger.info("Release public IP for loadbalancing " + ipId);
|
||||
IPAddressVO ipvo = _ipAddressDao.findById(ipId);
|
||||
ipvo.setAssociatedWithNetworkId(null);
|
||||
_ipAddressDao.update(ipvo.getId(), ipvo);
|
||||
_networkMgr.releasePublicIpAddress(ipId, userId, caller);
|
||||
_ipAddressDao.unassignIpAddress(ipId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -670,27 +689,42 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
List<DomainRouterVO> unusedElbVms = _elbVmMapDao.listUnusedElbVms();
|
||||
if (unusedElbVms != null && unusedElbVms.size() > 0)
|
||||
s_logger.info("Found " + unusedElbVms.size() + " unused ELB vms");
|
||||
else
|
||||
return;
|
||||
Set<Long> currentGcCandidates = new HashSet<Long>();
|
||||
for (DomainRouterVO elbVm: unusedElbVms) {
|
||||
currentGcCandidates.add(elbVm.getId());
|
||||
}
|
||||
_gcCandidateElbVmIds.retainAll(currentGcCandidates);
|
||||
currentGcCandidates.removeAll(_gcCandidateElbVmIds);
|
||||
User user = _accountService.getSystemUser();
|
||||
for (DomainRouterVO elbVm : unusedElbVms) {
|
||||
for (Long elbVmId : _gcCandidateElbVmIds) {
|
||||
DomainRouterVO elbVm = _routerDao.findById(elbVmId);
|
||||
boolean gceed = false;
|
||||
|
||||
try {
|
||||
s_logger.info("Attempting to stop ELB VM: " + elbVm);
|
||||
stop(elbVm, true, user, _systemAcct);
|
||||
gceed = true;
|
||||
} catch (ConcurrentOperationException e) {
|
||||
s_logger.warn("Unable to stop unused elb vm " + elbVm + " due to ", e);
|
||||
continue;
|
||||
} catch (ResourceUnavailableException e) {
|
||||
s_logger.warn("Unable to stop unused elb vm " + elbVm + " due to ", e);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
s_logger.info("Attempting to destroy ELB VM: " + elbVm);
|
||||
_itMgr.expunge(elbVm, user, _systemAcct);
|
||||
} catch (ResourceUnavailableException e) {
|
||||
s_logger.warn("Unable to destroy unused elb vm " + elbVm + " due to ", e);
|
||||
if (gceed) {
|
||||
try {
|
||||
s_logger.info("Attempting to destroy ELB VM: " + elbVm);
|
||||
_itMgr.expunge(elbVm, user, _systemAcct);
|
||||
} catch (ResourceUnavailableException e) {
|
||||
s_logger.warn("Unable to destroy unused elb vm " + elbVm + " due to ", e);
|
||||
gceed = false;
|
||||
}
|
||||
}
|
||||
if (!gceed) {
|
||||
currentGcCandidates.add(elbVm.getId());
|
||||
}
|
||||
|
||||
}
|
||||
_gcCandidateElbVmIds = currentGcCandidates;
|
||||
}
|
||||
|
||||
public class CleanupThread implements Runnable {
|
||||
@ -705,6 +739,12 @@ public class ElasticLoadBalancerManagerImpl implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleDeleteLoadBalancerRule(LoadBalancer lb, long userId, Account caller) {
|
||||
s_logger.debug("ELB mgr: releasing ip " + lb.getSourceIpAddressId() + " since the LB rule is deleted");
|
||||
releaseIp(lb.getSourceIpAddressId(), userId, caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainRouterVO findByName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@ -345,6 +345,7 @@ public class LoadBalancingRulesManagerImpl implements LoadBalancingRulesManager,
|
||||
}
|
||||
|
||||
_rulesDao.remove(lb.getId());
|
||||
_elbMgr.handleDeleteLoadBalancerRule(lb, callerUserId, caller);
|
||||
s_logger.debug("Load balancer with id " + lb.getId() + " is removed successfully");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import com.cloud.network.LoadBalancerVO;
|
||||
import com.cloud.network.dao.LoadBalancerDao;
|
||||
import com.cloud.network.dao.LoadBalancerDaoImpl;
|
||||
import com.cloud.network.router.VirtualRouter.Role;
|
||||
import com.cloud.network.router.VirtualRouter.Role;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.JoinBuilder.JoinType;
|
||||
@ -121,6 +122,7 @@ public class ElasticLbVmMapDaoImpl extends GenericDaoBase<ElasticLbVmMapVO, Long
|
||||
|
||||
public List<DomainRouterVO> listUnusedElbVms() {
|
||||
SearchCriteria<DomainRouterVO> sc = ElbVmSearch.create();
|
||||
sc.setParameters("role", Role.LB);
|
||||
return _routerDao.search(sc, null);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,138 @@
|
||||
/**
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.cloud.network.lb.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.cloud.network.ElasticLbVmMapVO;
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.network.LoadBalancerVO;
|
||||
import com.cloud.network.dao.LoadBalancerDao;
|
||||
import com.cloud.network.dao.LoadBalancerDaoImpl;
|
||||
=======
|
||||
>>>>>>> 2.2.8.nectarine
|
||||
import com.cloud.network.router.VirtualRouter.Role;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.JoinBuilder.JoinType;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.DomainRouterDaoImpl;
|
||||
|
||||
@Local(value={ElasticLbVmMapDao.class})
|
||||
public class ElasticLbVmMapDaoImpl extends GenericDaoBase<ElasticLbVmMapVO, Long> implements ElasticLbVmMapDao {
|
||||
protected final DomainRouterDao _routerDao = ComponentLocator.inject(DomainRouterDaoImpl.class);
|
||||
protected final LoadBalancerDao _loadbalancerDao = ComponentLocator.inject(LoadBalancerDaoImpl.class);
|
||||
|
||||
|
||||
protected final SearchBuilder<ElasticLbVmMapVO> AllFieldsSearch;
|
||||
protected final SearchBuilder<ElasticLbVmMapVO> UnusedVmSearch;
|
||||
protected final SearchBuilder<ElasticLbVmMapVO> LoadBalancersForElbVmSearch;
|
||||
|
||||
|
||||
protected final SearchBuilder<DomainRouterVO> ElbVmSearch;
|
||||
|
||||
protected final SearchBuilder<LoadBalancerVO> LoadBalancerSearch;
|
||||
|
||||
protected ElasticLbVmMapDaoImpl() {
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("ipId", AllFieldsSearch.entity().getIpAddressId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("lbId", AllFieldsSearch.entity().getLbId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("elbVmId", AllFieldsSearch.entity().getElbVmId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
|
||||
ElbVmSearch = _routerDao.createSearchBuilder();
|
||||
ElbVmSearch.and("role", ElbVmSearch.entity().getRole(), SearchCriteria.Op.EQ);
|
||||
UnusedVmSearch = createSearchBuilder();
|
||||
UnusedVmSearch.and("elbVmId", UnusedVmSearch.entity().getElbVmId(), SearchCriteria.Op.NULL);
|
||||
ElbVmSearch.join("UnusedVmSearch", UnusedVmSearch, ElbVmSearch.entity().getId(), UnusedVmSearch.entity().getElbVmId(), JoinType.LEFTOUTER);
|
||||
ElbVmSearch.done();
|
||||
UnusedVmSearch.done();
|
||||
|
||||
LoadBalancerSearch = _loadbalancerDao.createSearchBuilder();
|
||||
LoadBalancersForElbVmSearch = createSearchBuilder();
|
||||
LoadBalancersForElbVmSearch.and("elbVmId", LoadBalancersForElbVmSearch.entity().getElbVmId(), SearchCriteria.Op.EQ);
|
||||
LoadBalancerSearch.join("LoadBalancersForElbVm", LoadBalancersForElbVmSearch, LoadBalancerSearch.entity().getSourceIpAddressId(), LoadBalancersForElbVmSearch.entity().getIpAddressId(), JoinType.INNER);
|
||||
LoadBalancersForElbVmSearch.done();
|
||||
LoadBalancerSearch.done();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElasticLbVmMapVO findOneByLbIdAndElbVmId(long lbId, long elbVmId) {
|
||||
SearchCriteria<ElasticLbVmMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("lbId", lbId);
|
||||
sc.setParameters("elbVmId", elbVmId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ElasticLbVmMapVO> listByLbId(long lbId) {
|
||||
SearchCriteria<ElasticLbVmMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("lbId", lbId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ElasticLbVmMapVO> listByElbVmId(long elbVmId) {
|
||||
SearchCriteria<ElasticLbVmMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("elbVmId", elbVmId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteLB(long lbId) {
|
||||
SearchCriteria<ElasticLbVmMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("lbId", lbId);
|
||||
return super.expunge(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElasticLbVmMapVO findOneByIpIdAndElbVmId(long ipId, long elbVmId) {
|
||||
SearchCriteria<ElasticLbVmMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("ipId", ipId);
|
||||
sc.setParameters("elbVmId", elbVmId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ElasticLbVmMapVO findOneByIp(long ipId) {
|
||||
SearchCriteria<ElasticLbVmMapVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("ipId", ipId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
public List<DomainRouterVO> listUnusedElbVms() {
|
||||
SearchCriteria<DomainRouterVO> sc = ElbVmSearch.create();
|
||||
sc.setParameters("role", Role.LB);
|
||||
return _routerDao.search(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoadBalancerVO> listLbsForElbVm(long elbVmId) {
|
||||
SearchCriteria<LoadBalancerVO> sc = LoadBalancerSearch.create();
|
||||
sc.setJoinParameters("LoadBalancersForElbVm", "elbVmId", elbVmId);
|
||||
return _loadbalancerDao.search(sc, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,6 +62,7 @@ import com.cloud.async.AsyncJobManager;
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.ZoneConfig;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.configuration.dao.ResourceLimitDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
@ -70,6 +71,7 @@ import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.dao.AccountVlanMapDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.DcDetailsDaoImpl;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
import com.cloud.deploy.DataCenterDeployment;
|
||||
@ -612,8 +614,14 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
cmd.addVmData("metadata", "availability-zone", StringUtils.unicodeEscape(zoneName));
|
||||
cmd.addVmData("metadata", "local-ipv4", guestIpAddress);
|
||||
cmd.addVmData("metadata", "local-hostname", StringUtils.unicodeEscape(vmName));
|
||||
cmd.addVmData("metadata", "public-ipv4", router.getPublicIpAddress());
|
||||
cmd.addVmData("metadata", "public-hostname", router.getPublicIpAddress());
|
||||
if (dcVo.getNetworkType() == NetworkType.Basic) {
|
||||
cmd.addVmData("metadata", "public-ipv4", guestIpAddress);
|
||||
cmd.addVmData("metadata", "public-hostname", StringUtils.unicodeEscape(vmName));
|
||||
}else
|
||||
{
|
||||
cmd.addVmData("metadata", "public-ipv4", router.getPublicIpAddress());
|
||||
cmd.addVmData("metadata", "public-hostname", router.getPublicIpAddress());
|
||||
}
|
||||
cmd.addVmData("metadata", "instance-id", vmInstanceName);
|
||||
cmd.addVmData("metadata", "vm-id", String.valueOf(vmId));
|
||||
cmd.addVmData("metadata", "public-keys", publicKey);
|
||||
@ -924,6 +932,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
String dhcpRange = null;
|
||||
|
||||
DataCenter dc = dest.getDataCenter();
|
||||
DataCenterVO dcVO = _dcDao.findById(dc.getId());
|
||||
_dcDao.loadDetails(dcVO);
|
||||
|
||||
if (dc.getNetworkType() == NetworkType.Advanced) {
|
||||
String cidr = network.getCidr();
|
||||
@ -1002,7 +1012,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
String domain = network.getNetworkDomain();
|
||||
if (domain != null) {
|
||||
buf.append(" domain=" + domain);
|
||||
}
|
||||
String domain_suffix = dcVO.getDetail(ZoneConfig.DnsSearchOrder.getName());
|
||||
if (domain_suffix != null) {
|
||||
buf.append(" dnssearchorder=").append(domain_suffix);
|
||||
}
|
||||
|
||||
|
||||
if (!network.isDefault() && network.getGuestType() == GuestIpType.Direct) {
|
||||
buf.append(" defaultroute=false");
|
||||
@ -1021,7 +1036,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
if (defaultDns2 != null) {
|
||||
buf.append(" dns2=").append(defaultDns2);
|
||||
}
|
||||
|
||||
|
||||
String use_external_dns = _configDao.getValue("use.external.dns");
|
||||
if (use_external_dns!=null && use_external_dns.equals("true")){
|
||||
buf.append(" useextdns=").append(use_external_dns);
|
||||
}
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Boot Args for " + profile + ": " + buf.toString());
|
||||
}
|
||||
|
||||
@ -2513,6 +2513,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
if (forLoadBalancing != null && (Boolean)forLoadBalancing) {
|
||||
SearchBuilder<LoadBalancerVO> lbSearch = _loadbalancerDao.createSearchBuilder();
|
||||
sb.join("lbSearch", lbSearch, sb.entity().getId(), lbSearch.entity().getSourceIpAddressId(), JoinType.INNER);
|
||||
sb.groupBy(sb.entity().getId());
|
||||
}
|
||||
|
||||
if (keyword != null && address == null) {
|
||||
|
||||
@ -43,8 +43,6 @@ public class CloudStartupServlet extends HttpServlet implements ServletContextLi
|
||||
|
||||
@Override
|
||||
public void init() throws ServletException {
|
||||
/* System Integrity checker will run before all components really loaded */
|
||||
ComponentLocator.getComponent(SystemIntegrityChecker.Name);
|
||||
// Save Configuration Values
|
||||
//ComponentLocator loc = ComponentLocator.getLocator(ConfigurationServer.Name);
|
||||
ConfigurationServer c = (ConfigurationServer)ComponentLocator.getComponent(ConfigurationServer.Name);
|
||||
|
||||
229
server/src/com/cloud/upgrade/DatabaseIntegrityChecker.java
Executable file
229
server/src/com/cloud/upgrade/DatabaseIntegrityChecker.java
Executable file
@ -0,0 +1,229 @@
|
||||
package com.cloud.upgrade;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.maint.Version;
|
||||
import com.cloud.upgrade.dao.VersionDao;
|
||||
import com.cloud.upgrade.dao.VersionDaoImpl;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.SystemIntegrityChecker;
|
||||
import com.cloud.utils.db.GlobalLock;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Local(value = {SystemIntegrityChecker.class})
|
||||
public class DatabaseIntegrityChecker implements SystemIntegrityChecker {
|
||||
private final Logger s_logger = Logger.getLogger(DatabaseIntegrityChecker.class);
|
||||
|
||||
VersionDao _dao;
|
||||
|
||||
public DatabaseIntegrityChecker() {
|
||||
_dao = ComponentLocator.inject(VersionDaoImpl.class);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if there were multiple hosts connect to the same local storage. This is from a 2.1.x bug,
|
||||
* we didn't prevent adding host with the same IP.
|
||||
*/
|
||||
private String formatDuplicateHostToReadText(Long poolId, ResultSet rs) throws SQLException {
|
||||
boolean has = false;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
String fmt = "|%1$-8s|%2$-16s|%3$-16s|%4$-24s|%5$-8s|\n";
|
||||
String head = String.format(fmt, "id", "status", "removed", "private_ip_address", "pool_id");
|
||||
buf.append(head);
|
||||
while (rs.next()) {
|
||||
String h = String.format(fmt, rs.getLong(1), rs.getString(2), rs.getString(3), rs.getString(4), poolId);
|
||||
buf.append(h);
|
||||
has = true;
|
||||
}
|
||||
|
||||
if (!has) {
|
||||
throw new CloudRuntimeException("Local storage with Id " + poolId + " shows there are multiple hosts connect to it, but 'select id, status, removed, private_ip_address from host where id in (select host_id from storage_pool_host_ref where pool_id=?)' returns nothing");
|
||||
} else {
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean checkDuplicateHostWithTheSameLocalStorage() {
|
||||
Transaction txn = Transaction.open("Integrity");
|
||||
txn.start();
|
||||
try {
|
||||
Connection conn;
|
||||
try {
|
||||
conn = txn.getConnection();
|
||||
PreparedStatement pstmt = conn.prepareStatement("SELECT pool_id FROM host INNER JOIN storage_pool_host_ref INNER JOIN storage_pool WHERE storage_pool.id = storage_pool_host_ref.pool_id and storage_pool.pool_type='LVM' AND host.id=storage_pool_host_ref.host_id AND host.removed IS NULL group by pool_id having count(*) > 1");
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
boolean noDuplicate = true;
|
||||
StringBuffer helpInfo = new StringBuffer();
|
||||
String note = "DATABASE INTEGRITY ERROR\nManagement server detected there are some hosts connect to the same loacal storage, please contact Cloud.com support team for solution. Below are detialed info, please attach all of them to Cloud.com support. Thank you\n";
|
||||
helpInfo.append(note);
|
||||
while (rs.next()) {
|
||||
long poolId = rs.getLong(1);
|
||||
pstmt = conn.prepareStatement("select id, status, removed, private_ip_address from host where id in (select host_id from storage_pool_host_ref where pool_id=?)");
|
||||
pstmt.setLong(1, poolId);
|
||||
ResultSet dhrs = pstmt.executeQuery();
|
||||
String help = formatDuplicateHostToReadText(poolId, dhrs);
|
||||
helpInfo.append(help);
|
||||
helpInfo.append("\n");
|
||||
noDuplicate = false;
|
||||
}
|
||||
|
||||
if (noDuplicate) {
|
||||
s_logger.debug("No duplicate hosts with the same local storage found in database");
|
||||
} else {
|
||||
s_logger.error(helpInfo.toString());
|
||||
}
|
||||
|
||||
return noDuplicate;
|
||||
} catch (SQLException e) {
|
||||
s_logger.error("Unable to check duplicate hosts with the same local storage in database", e);
|
||||
throw new CloudRuntimeException("Unable to check duplicate hosts with the same local storage in database", e);
|
||||
}
|
||||
} finally {
|
||||
txn.commit();
|
||||
txn.close();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean check21to22PremiumUprage(Connection conn) throws SQLException {
|
||||
PreparedStatement pstmt = conn.prepareStatement("show tables in cloud_usage");
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
int num = 0;
|
||||
|
||||
while (rs.next()) {
|
||||
String tableName = rs.getString(1);
|
||||
if (tableName.equalsIgnoreCase("usage_event") || tableName.equalsIgnoreCase("usage_port_forwarding") || tableName.equalsIgnoreCase("usage_network_offering")) {
|
||||
num ++;
|
||||
s_logger.debug("Checking 21to22PremiumUprage table " + tableName + " found");
|
||||
}
|
||||
if (num == 3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isColumnExisted(Connection conn, String dbName, String tableName, String column) throws SQLException {
|
||||
PreparedStatement pstmt = conn.prepareStatement(String.format("describe %1$s.%2$s", dbName, tableName));
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
boolean found = false;
|
||||
while (rs.next()) {
|
||||
if (column.equalsIgnoreCase(rs.getString(1))) {
|
||||
s_logger.debug(String.format("Column %1$s.%2$s.%3$s found", dbName, tableName, column));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
private boolean check221to222PremiumUprage(Connection conn) throws SQLException {
|
||||
if (!isColumnExisted(conn, "cloud_usage", "cloud_usage", "network_id")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isColumnExisted(conn, "cloud_usage", "usage_network", "network_id")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isColumnExisted(conn, "cloud_usage", "user_statistics", "network_id");
|
||||
}
|
||||
|
||||
private boolean check222to224PremiumUpgrade(Connection conn) throws SQLException {
|
||||
if (!isColumnExisted(conn, "cloud_usage", "usage_vm_instance", "hypervisor_type")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isColumnExisted(conn, "cloud_usage", "usage_event", "resource_type");
|
||||
}
|
||||
|
||||
private boolean checkMissedPremiumUpgradeFor228() {
|
||||
Transaction txn = Transaction.open("Integrity");
|
||||
txn.start();
|
||||
try {
|
||||
String dbVersion = _dao.getCurrentVersion();
|
||||
if (Version.compare(Version.trimToPatch(dbVersion), Version.trimToPatch("2.2.8")) != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Connection conn;
|
||||
try {
|
||||
conn = txn.getConnection();
|
||||
PreparedStatement pstmt = conn.prepareStatement("show databases");
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
boolean hasUsage = false;
|
||||
while (rs.next()) {
|
||||
String dbName = rs.getString(1);
|
||||
if (dbName.equalsIgnoreCase("cloud_usage")) {
|
||||
hasUsage = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasUsage) {
|
||||
s_logger.debug("No cloud_usage found in database, no need to check missed premium upgrade");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!check21to22PremiumUprage(conn)) {
|
||||
s_logger.error("21to22 premium upgrade missed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!check221to222PremiumUprage(conn)) {
|
||||
s_logger.error("221to222 premium upgrade missed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!check222to224PremiumUpgrade(conn)) {
|
||||
s_logger.error("222to224 premium upgrade missed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
s_logger.error("Unable to check missed premiumg upgrade");
|
||||
throw new CloudRuntimeException("Unable to check missed premiumg upgrade");
|
||||
}
|
||||
} finally {
|
||||
txn.commit();
|
||||
txn.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void check() {
|
||||
GlobalLock lock = GlobalLock.getInternLock("DatabaseIntegrity");
|
||||
try {
|
||||
s_logger.info("Grabbing lock to check for database integrity.");
|
||||
if (!lock.lock(20 * 60)) {
|
||||
throw new CloudRuntimeException("Unable to acquire lock to check for database integrity.");
|
||||
}
|
||||
|
||||
try {
|
||||
s_logger.info("Performing database integrity check");
|
||||
if (!checkDuplicateHostWithTheSameLocalStorage()) {
|
||||
throw new CloudRuntimeException("checkDuplicateHostWithTheSameLocalStorage detected error");
|
||||
}
|
||||
|
||||
if (!checkMissedPremiumUpgradeFor228()) {
|
||||
s_logger.error("Your current database version is 2.2.8, management server detected some missed premium upgrade, please contact Cloud.com support and attach log file. Thank you!");
|
||||
throw new CloudRuntimeException("Detected missed premium upgrade");
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
} finally {
|
||||
lock.releaseRef();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
|
||||
public void check() {
|
||||
GlobalLock lock = GlobalLock.getInternLock("DatabaseUpgrade");
|
||||
try {
|
||||
s_logger.info("Grabbing lock to check for database integrity.");
|
||||
s_logger.info("Grabbing lock to check for database upgrade.");
|
||||
if (!lock.lock(20 * 60)) {
|
||||
throw new CloudRuntimeException("Unable to acquire lock to check for database integrity.");
|
||||
}
|
||||
|
||||
@ -7,3 +7,18 @@ ALTER TABLE `cloud`.`domain` ADD COLUMN `network_domain` varchar(255);
|
||||
|
||||
ALTER TABLE `cloud`.`cluster` ADD CONSTRAINT `fk_cluster__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `cloud`.`data_center`(`id`) ON DELETE CASCADE;
|
||||
|
||||
INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'network.dns.basiczone.updates', 'all', 'This parameter can take 2 values: all (default) and pod. It defines if DHCP/DNS requests have to be send to all dhcp servers in cloudstack, or only to the one in the same pod');
|
||||
|
||||
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__pod_id`;
|
||||
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__data_center_id`;
|
||||
ALTER TABLE `cloud`.`op_host_capacity` DROP FOREIGN KEY `fk_op_host_capacity__cluster_id`;
|
||||
|
||||
ALTER TABLE `cloud`.`firewall_rules_cidrs` ADD UNIQUE INDEX `unique_rule_cidrs` (`firewall_rule_id`, `source_cidr`);
|
||||
|
||||
INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'agent.load.threshold', '0.70', 'Percentage (as a value between 0 and 1) of connected agents after which agent load balancing will start happening');
|
||||
INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.visibility', 'global', 'Load Balancer(haproxy) stats visibilty, it can be global,guest-network,disabled');
|
||||
INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.uri','/admin?stats','Load Balancer(haproxy) uri.');
|
||||
INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.auth','admin1:AdMiN123','Load Balancer(haproxy) authetication string in the format username:password');
|
||||
INSERT IGNORE INTO configuration VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.stats.port','8081','Load Balancer(haproxy) stats port number.');
|
||||
|
||||
INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'use.external.dns', 'false', 'Bypass internal dns, use exetrnal dns1 and dns2');
|
||||
|
||||
@ -32,7 +32,7 @@ dictionary = {
|
||||
</p>
|
||||
</div>
|
||||
<div class="tabbox" style="margin-top: 15px;">
|
||||
<div class="content_tabs on" id="tab_details">
|
||||
<div class="content_tabs on" id="tab_details" style="display: none">
|
||||
<fmt:message key="label.details"/></div>
|
||||
<div class="content_tabs off" id="tab_port_range" style="display: none">
|
||||
<fmt:message key="label.port.range"/></div>
|
||||
@ -43,7 +43,7 @@ dictionary = {
|
||||
<!-- <div class="content_tabs off" id="tab_vpn" style="display: none">
|
||||
<fmt:message key="label.vpn"/></div> -->
|
||||
</div>
|
||||
<div id="tab_content_details">
|
||||
<div id="tab_content_details" style="display: none">
|
||||
<div id="tab_spinning_wheel" class="rightpanel_mainloader_panel" style="display: none;">
|
||||
<div class="rightpanel_mainloaderbox">
|
||||
<div class="rightpanel_mainloader_animatedicon">
|
||||
@ -416,7 +416,10 @@ dictionary = {
|
||||
<div id="private_port_errormsg" class="errormsg" style="display: none;">Error msg will appear here</div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 15%;">
|
||||
<select id="algorithm_select" class="select" style="width: 70%;">
|
||||
<select id="algorithm_select" class="select" style="width: 70%;">
|
||||
<option value='roundrobin'>roundrobin</option>
|
||||
<option value='leastconn'>leastconn</option>
|
||||
<option value='source'>source</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 10%;">
|
||||
@ -492,7 +495,7 @@ dictionary = {
|
||||
<div class="actionpanel_button_icons">
|
||||
<img src="images/addvm_actionicon.png" /></div>
|
||||
<div class="actionpanel_button_links">
|
||||
<fmt:message key="label.add.load.balancer.and.ip"/>
|
||||
<fmt:message key="label.add.load.balancer"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -548,7 +551,10 @@ dictionary = {
|
||||
<div class="row_celltitles" id="private_port"></div>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 15%; ">
|
||||
<select id="algorithm_select" class="select" style="width: 70%;">
|
||||
<select id="algorithm_select" class="select" style="width: 70%;">
|
||||
<option value='roundrobin'>roundrobin</option>
|
||||
<option value='leastconn'>leastconn</option>
|
||||
<option value='source'>source</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="grid_row_cell" style="width: 10%; ">
|
||||
@ -781,7 +787,7 @@ dictionary = {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dialog_add_load_balancer_and_ip" title='<fmt:message key="label.add.load.balancer.and.ip"/>' style="display: none">
|
||||
<div id="dialog_add_load_balancer_and_ip" title='<fmt:message key="label.add.load.balancer"/>' style="display: none">
|
||||
<div class="dialog_formcontent">
|
||||
<form action="#" method="post" id="form1">
|
||||
<ol>
|
||||
|
||||
@ -210,9 +210,9 @@ $(document).ready(function() {
|
||||
bindAndListMidMenuItems($("#leftmenu_snapshot"), "listSnapshots", snapshotGetSearchParams, "listsnapshotsresponse", "snapshot", "jsp/snapshot.jsp", afterLoadSnapshotJSP, snapshotToMidmenu, snapshotToRightPanel, getMidmenuId, false);
|
||||
|
||||
if(g_supportELB == "guest") //ips are allocated on guest network
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses&forvirtualnetwork=false", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses&forvirtualnetwork=false&forloadbalancing=true", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
else if(g_supportELB == "public") //ips are allocated on public network
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses&forvirtualnetwork=true", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses&forvirtualnetwork=true&forloadbalancing=true", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
else
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false); //remove "&forvirtualnetwork=true" for advanced zone whose security group is enabled
|
||||
|
||||
@ -800,7 +800,10 @@ $(document).ready(function() {
|
||||
g_timezone = g_loginResponse.timezone;
|
||||
g_timezoneoffset = g_loginResponse.timezoneoffset;
|
||||
}
|
||||
|
||||
|
||||
if(g_supportELB == null)
|
||||
g_supportELB = $.cookie("supportELB");
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listCapabilities"),
|
||||
dataType: "json",
|
||||
|
||||
@ -75,7 +75,9 @@ function afterLoadIpJSP() {
|
||||
|
||||
if(g_supportELB == "guest" || g_supportELB == "public") {
|
||||
$("#tab_details,#tab_port_range,#tab_port_forwarding,#tab_load_balancer,#tab_vpn").hide();
|
||||
|
||||
$("#tab_content_details").hide();
|
||||
|
||||
$("#acquire_new_ip_button").hide();
|
||||
$("#add_load_balancer_and_ip_button").show();
|
||||
|
||||
@ -147,13 +149,29 @@ function afterLoadIpJSP() {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) {
|
||||
// Succeeded
|
||||
var publicipid = result.jobresult.loadbalancer.publicipid;
|
||||
var publicipid = result.jobresult.loadbalancer.publicipid;
|
||||
|
||||
var cmd;
|
||||
if(g_supportELB == "guest") {
|
||||
cmd = "command=listPublicIpAddresses&forvirtualnetwork=false&id="+publicipid;
|
||||
}
|
||||
else if(g_supportELB == "public") {
|
||||
cmd = "command=listPublicIpAddresses&forvirtualnetwork=true&id="+publicipid;
|
||||
}
|
||||
else {
|
||||
if(g_supportELB == null)
|
||||
alert("supportELB should be either guest or public. It should not be null.");
|
||||
else
|
||||
alert("supportELB should be either guest or public. It should not be " + g_supportELB);
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listPublicIpAddresses&id="+publicipid),
|
||||
data: createURL(cmd),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var items = json.listpublicipaddressesresponse.publicipaddress;
|
||||
var items = json.listpublicipaddressesresponse.publicipaddress;
|
||||
if(items != null && items.length > 0) {
|
||||
ipToMidmenu(items[0], $midmenuItem1);
|
||||
bindClickToMidMenu($midmenuItem1, ipToRightPanel, ipGetMidmenuId);
|
||||
@ -189,7 +207,9 @@ function afterLoadIpJSP() {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
else {
|
||||
else {
|
||||
$("#tab_details,#tab_content_details").show();
|
||||
|
||||
//dialogs
|
||||
initDialog("dialog_acquire_public_ip", 325);
|
||||
initDialog("dialog_enable_vpn");
|
||||
@ -543,26 +563,63 @@ function afterLoadIpJSP() {
|
||||
array1.push("&publicport="+publicPort);
|
||||
array1.push("&privateport="+privatePort);
|
||||
array1.push("&algorithm="+algorithm);
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createLoadBalancerRule"+array1.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var item = json.createloadbalancerruleresponse.loadbalancer;
|
||||
loadBalancerJsonToTemplate(item, $template);
|
||||
$spinningWheel.hide();
|
||||
refreshCreateLoadBalancerRow();
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
$template.slideUp("slow", function() {
|
||||
$(this).remove();
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createLoadBalancerRule"+array1.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var jobId = json.createloadbalancerruleresponse.jobid;
|
||||
var timerKey = "addLbJob_"+jobId;
|
||||
|
||||
$("body").everyTime(2000, timerKey, function() {
|
||||
$.ajax({
|
||||
data: createURL("command=queryAsyncJobResult&jobId="+jobId),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var result = json.queryasyncjobresultresponse;
|
||||
if (result.jobstatus == 0) {
|
||||
return; //Job has not completed
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
if (result.jobstatus == 1) {
|
||||
// Succeeded
|
||||
var item = result.jobresult.loadbalancer;
|
||||
loadBalancerJsonToTemplate(item, $template);
|
||||
$spinningWheel.hide();
|
||||
refreshCreateLoadBalancerRow();
|
||||
} else if (result.jobstatus == 2) {
|
||||
$template.slideUp("slow", function() {
|
||||
$(this).remove();
|
||||
});
|
||||
var errorMsg = fromdb(result.jobresult.errortext);
|
||||
$("#dialog_error").text(fromdb(errorMsg)).dialog("open");
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
$("body").stopTime(timerKey);
|
||||
handleError(XMLHttpResponse, function() {
|
||||
$template.slideUp("slow", function() {
|
||||
$(this).remove();
|
||||
});
|
||||
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
|
||||
$("#dialog_error").text(fromdb(errorMsg)).dialog("open");
|
||||
});
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
$template.slideUp("slow", function() {
|
||||
$(this).remove();
|
||||
});
|
||||
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
|
||||
$("#dialog_error").text(fromdb(errorMsg)).dialog("open");
|
||||
});
|
||||
}
|
||||
});
|
||||
$("#dialog_error").text(fromdb(errorMsg)).dialog("open");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
//*** Load Balancer tab (end) ***
|
||||
@ -625,7 +682,11 @@ function ipToRightPanel($midmenuItem1) {
|
||||
copyActionInfoFromMidMenuToRightPanel($midmenuItem1);
|
||||
|
||||
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
|
||||
$("#tab_details").click();
|
||||
|
||||
if(g_supportELB == "guest" || g_supportELB == "public")
|
||||
$("#tab_load_balancer").click();
|
||||
else
|
||||
$("#tab_details").click();
|
||||
|
||||
if(ipObj.isstaticnat == true) {
|
||||
$("#tab_port_range").show();
|
||||
@ -832,7 +893,7 @@ function ipJsonToLoadBalancerTab() {
|
||||
var $thisTab = $("#right_panel_content #tab_content_load_balancer");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
|
||||
var networkObj = $midmenuItem1.data("networkObj");
|
||||
if(networkObj != null) {
|
||||
var lbServiceObj = ipFindNetworkServiceByName("Lb", networkObj);
|
||||
@ -1293,14 +1354,30 @@ function ipJsonToDetailsTab() {
|
||||
|
||||
var networkObj = $midmenuItem1.data("networkObj");
|
||||
|
||||
var id = ipObj.id;
|
||||
var publicipid = ipObj.id;
|
||||
|
||||
var $thisTab = $("#right_panel_content").find("#tab_content_details");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
|
||||
|
||||
var cmd;
|
||||
if(g_supportELB == "guest") {
|
||||
cmd = "command=listPublicIpAddresses&forvirtualnetwork=false&id="+publicipid;
|
||||
}
|
||||
else if(g_supportELB == "public") {
|
||||
cmd = "command=listPublicIpAddresses&forvirtualnetwork=true&id="+publicipid;
|
||||
}
|
||||
else {
|
||||
if(g_supportELB == null)
|
||||
alert("supportELB should be either guest or public. It should not be null.");
|
||||
else
|
||||
alert("supportELB should be either guest or public. It should not be " + g_supportELB);
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listPublicIpAddresses&id="+id),
|
||||
data: createURL(cmd),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
@ -1849,10 +1926,23 @@ function loadBalancerJsonToTemplate(jsonObj, $template) {
|
||||
} else {
|
||||
$("body").stopTime(timerKey);
|
||||
$spinningWheel.hide();
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
var total_lbrules = $("#tab_content_load_balancer").find("#grid_content").find(".grid_rows").length;
|
||||
$template.slideUp("slow", function() {
|
||||
$(this).remove();
|
||||
});
|
||||
$(this).remove();
|
||||
|
||||
if(g_supportELB == "guest" || g_supportELB == "public") {
|
||||
var count_lb = $("div[id*='loadBalancer_']").length;
|
||||
if(count_lb == 0) {
|
||||
var params = $("#middle_menu_pagination").data("params");
|
||||
if(params == null)
|
||||
return;
|
||||
listMidMenuItems2(params.commandString, params.getSearchParamsFn, params.jsonResponse1, params.jsonResponse2, params.toMidmenuFn, params.toRightPanelFn, params.getMidmenuIdFn, params.isMultipleSelectionInMidMenu, 1);
|
||||
if($("div[id*='midmenuItem_']").length == 0)
|
||||
$("#tab_content_load_balancer").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
var errorMsg = g_dictionary["label.deleting.failed"] + " - " + fromdb(result.jobresult.errortext);
|
||||
$("#dialog_error").text(errorMsg).dialog("open");
|
||||
|
||||
@ -1301,7 +1301,7 @@ function listMidMenuItems(commandString, getSearchParamsFn, jsonResponse1, jsonR
|
||||
}
|
||||
|
||||
function bindAndListMidMenuItems($leftmenu, commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu) {
|
||||
$leftmenu.bind("click", function(event) {
|
||||
$leftmenu.unbind().bind("click", function(event) {
|
||||
selectLeftSubMenu($(this));
|
||||
listMidMenuItems(commandString, getSearchParamsFn, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSPFn, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, $(this).attr("id"), null);
|
||||
return false;
|
||||
|
||||
@ -1441,6 +1441,27 @@ function addZoneWizardSubmit($thisWizard) {
|
||||
listZonesUpdate();
|
||||
g_directAttachSecurityGroupsEnabled = true;
|
||||
$("#leftmenu_security_group_container").show();
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listCapabilities"),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
/* g_supportELB: guest — ips are allocated on guest network (so use 'forvirtualnetwork' = false)
|
||||
* g_supportELB: public - ips are allocated on public network (so use 'forvirtualnetwork' = true)
|
||||
* g_supportELB: false – no ELB support
|
||||
*/
|
||||
g_supportELB = json.listcapabilitiesresponse.capability.supportELB;
|
||||
$.cookie('supportELB', g_supportELB, { expires: 1});
|
||||
|
||||
if(g_supportELB == "guest") //ips are allocated on guest network
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses&forvirtualnetwork=false&forloadbalancing=true", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
else if(g_supportELB == "public") //ips are allocated on public network
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses&forvirtualnetwork=true&forloadbalancing=true", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false);
|
||||
else
|
||||
bindAndListMidMenuItems($("#leftmenu_ip"), "listPublicIpAddresses", ipGetSearchParams, "listpublicipaddressesresponse", "publicipaddress", "jsp/ipaddress.jsp", afterLoadIpJSP, ipToMidmenu, ipToRightPanel, ipGetMidmenuId, false); //remove "&forvirtualnetwork=true" for advanced zone whose security group is enabled
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse, function() {
|
||||
|
||||
@ -87,6 +87,7 @@ public class ComponentLocator implements ComponentLocatorMBean {
|
||||
protected static final HashMap<String, ComponentLocator> s_locators = new HashMap<String, ComponentLocator>();
|
||||
protected static final HashMap<Class<?>, InjectInfo> s_factories = new HashMap<Class<?>, InjectInfo>();
|
||||
protected static Boolean s_once = false;
|
||||
protected static Boolean _hasCheckerRun = false;
|
||||
protected static Callback[] s_callbacks = new Callback[] { NoOp.INSTANCE, new DatabaseCallback()};
|
||||
protected static CallbackFilter s_callbackFilter = new DatabaseCallbackFilter();
|
||||
protected static final List<AnnotationInterceptor<?>> s_interceptors = new ArrayList<AnnotationInterceptor<?>>();
|
||||
@ -362,6 +363,14 @@ public class ComponentLocator implements ComponentLocatorMBean {
|
||||
}
|
||||
|
||||
public static synchronized Object getComponent(String componentName) {
|
||||
synchronized(_hasCheckerRun) {
|
||||
/* System Integrity checker will run before all components really loaded */
|
||||
if (!_hasCheckerRun && !componentName.equalsIgnoreCase(SystemIntegrityChecker.Name)) {
|
||||
ComponentLocator.getComponent(SystemIntegrityChecker.Name);
|
||||
_hasCheckerRun = true;
|
||||
}
|
||||
}
|
||||
|
||||
ComponentLocator locator = s_locators.get(componentName);
|
||||
if (locator == null) {
|
||||
locator = ComponentLocator.getLocator(componentName);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user