mirror of https://github.com/apache/cloudstack.git
Internal LB:
1)Added InternalLoadBalancerManager and corresponding Impl 2)Add InternalLbVm as a default CS provider. DB upgrade is covered as well
This commit is contained in:
parent
e344cf250a
commit
f0018b4512
|
|
@ -125,7 +125,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
|
|||
public static final Provider None = new Provider("None", false);
|
||||
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
|
||||
public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
|
||||
public static final Provider InternalLoadBalancerVm = new Provider("InternalLoadBalancerVm", false);
|
||||
public static final Provider InternalLbVm = new Provider("InternalLbVm", false);
|
||||
|
||||
private String name;
|
||||
private boolean isExternal;
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
SecondaryStorageVm,
|
||||
ElasticIpVm,
|
||||
ElasticLoadBalancerVm,
|
||||
InternalLoadBalancerVm,
|
||||
|
||||
/*
|
||||
* UserBareMetal is only used for selecting VirtualMachineGuru, there is no
|
||||
|
|
@ -196,7 +197,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
|
|||
public static boolean isSystemVM(VirtualMachine.Type vmtype) {
|
||||
if (DomainRouter.equals(vmtype)
|
||||
|| ConsoleProxy.equals(vmtype)
|
||||
|| SecondaryStorageVm.equals(vmtype)) {
|
||||
|| SecondaryStorageVm.equals(vmtype) || InternalLoadBalancerVm.equals(vmtype)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@
|
|||
<artifactId>cloud-plugin-network-midonet</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-internallb</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-hypervisor-xen</artifactId>
|
||||
|
|
|
|||
|
|
@ -409,10 +409,12 @@
|
|||
<bean id="VpcVirtualRouter" class="com.cloud.network.element.VpcVirtualRouterElement">
|
||||
<property name="name" value="VpcVirtualRouter"/>
|
||||
</bean>
|
||||
|
||||
<bean id="elasticLoadBalancerElement" class="com.cloud.network.element.ElasticLoadBalancerElement">
|
||||
<property name="name" value="ElasticLoadBalancerElement"/>
|
||||
</bean>
|
||||
<bean id="InternalLbVm" class="org.apache.cloudstack.network.element.InternalLoadBalancerElement">
|
||||
<property name="name" value="InternalLbVm"/>
|
||||
</bean>
|
||||
|
||||
<!--
|
||||
General allocators
|
||||
|
|
@ -788,7 +790,7 @@
|
|||
<bean id="volumeManagerImpl" class="com.cloud.storage.VolumeManagerImpl" />
|
||||
<bean id="ClassicalPrimaryDataStoreProvider" class="org.apache.cloudstack.storage.datastore.provider.CloudStackPrimaryDataStoreProviderImpl" />
|
||||
<bean id="ApplicationLoadBalancerService" class="org.apache.cloudstack.network.lb.ApplicationLoadBalancerManagerImpl" />
|
||||
|
||||
<bean id="InternalLoadBalancerManager" class="org.apache.cloudstack.network.lb.InternalLoadBalancerManagerImpl" />
|
||||
|
||||
|
||||
<!--=======================================================================================================-->
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@
|
|||
<ref bean="VpcVirtualRouter"/>
|
||||
<ref bean="NiciraNvp" />
|
||||
<ref bean="MidoNetElement"/>
|
||||
<ref bean="InternalLbVm"/>
|
||||
<!--
|
||||
<ref bean="BareMetalDhcp"/>
|
||||
<ref bean="BareMetalPxe"/>
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ package com.cloud.network.lb;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LoadBalancer;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.cloudstack.element;
|
||||
package org.apache.cloudstack.network.element;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -100,7 +100,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
|
||||
@Override
|
||||
public Provider getProvider() {
|
||||
return Provider.InternalLoadBalancerVm;
|
||||
return Provider.InternalLbVm;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -124,30 +124,30 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO Shutdown all the internal lb elements
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO Shutdown all the internal lb elements
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady(PhysicalNetworkServiceProvider provider) {
|
||||
// TODO Shutdown all the internal lb elements
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO Shutdown all the internal lb elements
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEnableIndividualServices() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -163,7 +163,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
@Override
|
||||
public boolean applyLBRules(Network network, List<LoadBalancingRule> rules) throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.network.lb;
|
||||
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
public interface InternalLoadBalancerManager extends Manager{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.network.lb;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.api.StopAnswer;
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineGuru;
|
||||
import com.cloud.vm.VirtualMachineManager;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
@Component
|
||||
@Local(value = { InternalLoadBalancerManager.class })
|
||||
public class InternalLoadBalancerManagerImpl extends ManagerBase implements
|
||||
InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
||||
private static final Logger s_logger = Logger
|
||||
.getLogger(InternalLoadBalancerManagerImpl.class);
|
||||
|
||||
@Inject VirtualMachineManager _itMgr;
|
||||
|
||||
@Override
|
||||
public DomainRouterVO findByName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainRouterVO findById(long id) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DomainRouterVO persist(DomainRouterVO vm) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeStart(VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeStop(VirtualMachineProfile<DomainRouterVO> profile, StopAnswer answer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeExpunge(DomainRouterVO vm) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long convertToId(String vmName) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plugNic(Network network, NicTO nic, VirtualMachineTO vm, ReservationContext context, DeployDestination dest) throws ConcurrentOperationException, ResourceUnavailableException,
|
||||
InsufficientCapacityException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm, ReservationContext context, DeployDestination dest) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
_itMgr.registerGuru(VirtualMachine.Type.InternalLoadBalancerVm, this);
|
||||
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info(getName() + " has been configured");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3077,6 +3077,22 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
|
||||
return nsp;
|
||||
}
|
||||
|
||||
|
||||
protected PhysicalNetworkServiceProvider addDefaultInternalLbProviderToPhysicalNetwork(long physicalNetworkId) {
|
||||
|
||||
PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId, Network.Provider.InternalLbVm.getName(), null, null);
|
||||
// add instance of the provider
|
||||
NetworkElement networkElement = _networkModel.getElementImplementingProvider(Network.Provider.InternalLbVm.getName());
|
||||
if (networkElement == null) {
|
||||
throw new CloudRuntimeException("Unable to find the Network Element implementing the " + Network.Provider.InternalLbVm.getName() + " Provider");
|
||||
}
|
||||
|
||||
VirtualRouterElement element = (VirtualRouterElement)networkElement;
|
||||
element.addElement(nsp.getId(), VirtualRouterProviderType.VirtualRouter);
|
||||
|
||||
return nsp;
|
||||
}
|
||||
|
||||
protected PhysicalNetworkServiceProvider addDefaultSecurityGroupProviderToPhysicalNetwork(long physicalNetworkId) {
|
||||
|
||||
|
|
@ -3085,6 +3101,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
|
||||
return nsp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private PhysicalNetworkServiceProvider addDefaultBaremetalProvidersToPhysicalNetwork(long physicalNetworkId) {
|
||||
PhysicalNetworkVO pvo = _physicalNetworkDao.findById(physicalNetworkId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue