From 61fd6a79c8ce56c5a2894d8de39aa83bf1101acb Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Thu, 4 Aug 2011 17:02:27 -0700 Subject: [PATCH] ensure elb vm is managed by elb manager --- core/src/com/cloud/vm/DomainRouterVO.java | 15 +++++++++++++++ .../debian/config/etc/init.d/cloud-early-config | 7 ++++++- .../lb/ElasticLoadBalancerManagerImpl.java | 9 ++------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/core/src/com/cloud/vm/DomainRouterVO.java b/core/src/com/cloud/vm/DomainRouterVO.java index 02ab3a5c18f..6cd95d38271 100755 --- a/core/src/com/cloud/vm/DomainRouterVO.java +++ b/core/src/com/cloud/vm/DomainRouterVO.java @@ -68,6 +68,21 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter { super(id, serviceOfferingId, name, name, Type.DomainRouter, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled); this.networkId = networkId; } + + public DomainRouterVO(long id, + long serviceOfferingId, + String name, + long templateId, + HypervisorType hypervisorType, + long guestOSId, + long domainId, + long accountId, + long networkId, + boolean haEnabled, + VirtualMachine.Type vmType) { + super(id, serviceOfferingId, name, name, vmType, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled); + this.networkId = networkId; + } public void setPublicIpAddress(String publicIpAddress) { this.publicIpAddress = publicIpAddress; diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index 3479c067aee..08804544952 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -432,7 +432,12 @@ setup_elbvm() { [ "$ETH2_IP" == "0.0.0.0" ] && public_ip=$ETH0_IP echo "$public_ip $NAME" >> /etc/hosts - setup_sshd $ETH0_IP + if [ "$SSHONGUEST" == "true" ] + then + setup_sshd $ETH0_IP + else + setup_sshd $ETH1_IP + fi enable_fwding 0 enable_svc haproxy 0 diff --git a/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java index d09d45dac56..e84fd757941 100644 --- a/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java +++ b/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java @@ -481,7 +481,7 @@ public class ElasticLoadBalancerManagerImpl implements elbVm = new DomainRouterVO(id, _elasticLbVmOffering.getId(), VirtualMachineName.getSystemVmName(id, _instance, _elbVmNamePrefix), template.getId(), template.getHypervisorType(), template.getGuestOSId(), - owner.getDomainId(), owner.getId(), guestNetwork.getId(), _elasticLbVmOffering.getOfferHA()); + owner.getDomainId(), owner.getId(), guestNetwork.getId(), _elasticLbVmOffering.getOfferHA(), VirtualMachine.Type.ElasticLoadBalancerVm); elbVm.setRole(Role.LB); elbVm = _itMgr.allocate(elbVm, template, _elasticLbVmOffering, networks, plan, null, owner); //TODO: create usage stats @@ -745,12 +745,7 @@ public class ElasticLoadBalancerManagerImpl implements releaseIp(lb.getSourceIpAddressId(), userId, caller); } - @Override - public DomainRouterVO findByName(String name) { - // TODO Auto-generated method stub - return null; - } - + @Override public DomainRouterVO findByName(String name) { if (!VirtualMachineName.isValidSystemVmName(name, _instance, _elbVmNamePrefix)) {