mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
TK-3135 fixes for VPC restart
* removed the "is redundant" flag form the addVpcRouterToGuestNetwork() method * removed the "is redundant" flag from the removeVpcRouterFromGuestNetwork() method * changed the path of the master.py file in the keepalived.conf.temp file * the call to routerDao.addRouterToGuestNetwork() in the VpcRouterDeploymentDefinition is not needed. That step will be performed once a VM is created - In addition, when restarting a VPC the routers will have the guest net configured, if any exists. * Pushing the POM.xml as well, to use the old Jetty for now. Could not fix the logging problem. Will replace the POM with master version after VPC is done.
This commit is contained in:
parent
35151961be
commit
40eb579115
@ -36,7 +36,7 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
|
|||||||
* @throws ResourceUnavailableException
|
* @throws ResourceUnavailableException
|
||||||
* @throws InsufficientCapacityException
|
* @throws InsufficientCapacityException
|
||||||
*/
|
*/
|
||||||
boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant, Map<VirtualMachineProfile.Param, Object> params)
|
boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, Map<VirtualMachineProfile.Param, Object> params)
|
||||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,6 +47,6 @@ public interface VpcVirtualNetworkApplianceService extends VirtualNetworkApplian
|
|||||||
* @throws ConcurrentOperationException
|
* @throws ConcurrentOperationException
|
||||||
* @throws ResourceUnavailableException
|
* @throws ResourceUnavailableException
|
||||||
*/
|
*/
|
||||||
boolean removeVpcRouterFromGuestNetwork(VirtualRouter router, Network network, boolean isRedundant) throws ConcurrentOperationException, ResourceUnavailableException;
|
boolean removeVpcRouterFromGuestNetwork(VirtualRouter router, Network network) throws ConcurrentOperationException, ResourceUnavailableException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -419,23 +419,23 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
<artifactId>maven-jetty-plugin</artifactId>
|
||||||
<version>9.2.6.v20141205</version>
|
<version>6.1.26</version>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- specify the dependent jdbc driver here -->
|
<!-- specify the dependent jdbc driver here -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>${cs.mysql.version}</version>
|
<version>${cs.mysql.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<configuration>
|
<configuration>
|
||||||
<scanIntervalSeconds>0</scanIntervalSeconds>
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
<stopPort>9966</stopPort>
|
<stopPort>9966</stopPort>
|
||||||
<stopKey>stop-jetty</stopKey>
|
<stopKey>stop-jetty</stopKey>
|
||||||
<connectors>
|
<connectors>
|
||||||
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
|
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
|
||||||
<port>8080</port>
|
<port>8080</port>
|
||||||
<maxIdleTime>60000</maxIdleTime>
|
<maxIdleTime>60000</maxIdleTime>
|
||||||
</connector>
|
</connector>
|
||||||
@ -446,6 +446,13 @@
|
|||||||
<contextPath>/client</contextPath>
|
<contextPath>/client</contextPath>
|
||||||
<extraClasspath>${project.build.directory}/utilities/scripts/db/;${project.build.directory}/utilities/scripts/db/db/</extraClasspath>
|
<extraClasspath>${project.build.directory}/utilities/scripts/db/;${project.build.directory}/utilities/scripts/db/db/</extraClasspath>
|
||||||
</webAppConfig>
|
</webAppConfig>
|
||||||
|
|
||||||
|
<systemProperties>
|
||||||
|
<systemProperty>
|
||||||
|
<name>log4j.configuration</name>
|
||||||
|
<value>log4j-cloud.xml</value>
|
||||||
|
</systemProperty>
|
||||||
|
</systemProperties>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
@ -943,7 +943,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||||||
if (planChangedByVolume) {
|
if (planChangedByVolume) {
|
||||||
plan = originalPlan;
|
plan = originalPlan;
|
||||||
planChangedByVolume = false;
|
planChangedByVolume = false;
|
||||||
//do not enter volume reuse for next retry, since we want to look for resorces outside the volume's cluster
|
//do not enter volume reuse for next retry, since we want to look for resources outside the volume's cluster
|
||||||
reuseVolume = false;
|
reuseVolume = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -188,11 +188,6 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
throw new ResourceUnavailableException("Can't find at least one running router!", DataCenter.class, network.getDataCenterId());
|
throw new ResourceUnavailableException("Can't find at least one running router!", DataCenter.class, network.getDataCenterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// [FIXME] Comment added by Wilder Rodrigues - This exception has to be removed once we are able to test multiple routers.
|
|
||||||
// if (routers.size() > 1) {
|
|
||||||
// throw new CloudRuntimeException("Found more than one router in vpc " + vpc);
|
|
||||||
// }
|
|
||||||
|
|
||||||
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
||||||
|
|
||||||
for (final DomainRouterVO domainRouterVO : routers) {
|
for (final DomainRouterVO domainRouterVO : routers) {
|
||||||
@ -201,7 +196,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
if (network.getState() == State.Setup) {
|
if (network.getState() == State.Setup) {
|
||||||
paramsForRouter.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
|
paramsForRouter.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
|
||||||
}
|
}
|
||||||
if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(domainRouterVO, network, false, paramsForRouter)) {
|
if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(domainRouterVO, network, paramsForRouter)) {
|
||||||
s_logger.error("Failed to add VPC router " + domainRouterVO + " to guest network " + network);
|
s_logger.error("Failed to add VPC router " + domainRouterVO + " to guest network " + network);
|
||||||
} else {
|
} else {
|
||||||
s_logger.debug("Successfully added VPC router " + domainRouterVO + " to guest network " + network);
|
s_logger.debug("Successfully added VPC router " + domainRouterVO + " to guest network " + network);
|
||||||
@ -240,11 +235,6 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
throw new ResourceUnavailableException("Can't find at least one running router!", DataCenter.class, network.getDataCenterId());
|
throw new ResourceUnavailableException("Can't find at least one running router!", DataCenter.class, network.getDataCenterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// [FIXME] Comment added by Wilder Rodrigues - This exception has to be removed once we are able to test multiple routers.
|
|
||||||
// if (routers.size() > 1) {
|
|
||||||
// throw new CloudRuntimeException("Found more than one router in vpc " + vpc);
|
|
||||||
// }
|
|
||||||
|
|
||||||
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
||||||
|
|
||||||
for (final DomainRouterVO domainRouterVO : routers) {
|
for (final DomainRouterVO domainRouterVO : routers) {
|
||||||
@ -255,7 +245,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
if (network.getState() == State.Setup) {
|
if (network.getState() == State.Setup) {
|
||||||
paramsForRouter.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
|
paramsForRouter.put(VirtualMachineProfile.Param.ReProgramGuestNetworks, true);
|
||||||
}
|
}
|
||||||
if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(domainRouterVO, network, false, paramsForRouter)) {
|
if (!_vpcRouterMgr.addVpcRouterToGuestNetwork(domainRouterVO, network, paramsForRouter)) {
|
||||||
s_logger.error("Failed to add VPC router " + domainRouterVO + " to guest network " + network);
|
s_logger.error("Failed to add VPC router " + domainRouterVO + " to guest network " + network);
|
||||||
} else {
|
} else {
|
||||||
s_logger.debug("Successfully added VPC router " + domainRouterVO + " to guest network " + network);
|
s_logger.debug("Successfully added VPC router " + domainRouterVO + " to guest network " + network);
|
||||||
@ -284,7 +274,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 2) Call unplugNics in the network service
|
// 2) Call unplugNics in the network service
|
||||||
success = success && _vpcRouterMgr.removeVpcRouterFromGuestNetwork(router, network, false);
|
success = success && _vpcRouterMgr.removeVpcRouterFromGuestNetwork(router, network);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
s_logger.warn("Failed to unplug nic in network " + network + " for virtual router " + router);
|
s_logger.warn("Failed to unplug nic in network " + network + " for virtual router " + router);
|
||||||
} else {
|
} else {
|
||||||
@ -312,7 +302,7 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 2) Call unplugNics in the network service
|
// 2) Call unplugNics in the network service
|
||||||
success = success && _vpcRouterMgr.removeVpcRouterFromGuestNetwork(router, config, false);
|
success = success && _vpcRouterMgr.removeVpcRouterFromGuestNetwork(router, config);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
s_logger.warn("Failed to unplug nic in network " + config + " for virtual router " + router);
|
s_logger.warn("Failed to unplug nic in network " + config + " for virtual router " + router);
|
||||||
} else {
|
} else {
|
||||||
@ -372,11 +362,6 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [FIXME] Comment added by Wilder Rodrigues - This exception has to be removed once we are able to test multiple routers.
|
|
||||||
// if (routers.size() > 1) {
|
|
||||||
// throw new CloudRuntimeException("Found more than one router in vpc " + vpc);
|
|
||||||
// }
|
|
||||||
|
|
||||||
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
||||||
|
|
||||||
final DataCenterVO dcVO = _dcDao.findById(gateway.getZoneId());
|
final DataCenterVO dcVO = _dcDao.findById(gateway.getZoneId());
|
||||||
@ -416,11 +401,6 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements Vpc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [FIXME] Comment added by Wilder Rodrigues - This exception has to be removed once we are able to test multiple routers.
|
|
||||||
// if (routers.size() > 1) {
|
|
||||||
// throw new CloudRuntimeException("Found more than one router in vpc " + vpc);
|
|
||||||
// }
|
|
||||||
|
|
||||||
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
s_logger.info("Adding VPC routers to Guest Network: " + routers.size() + " to be added!");
|
||||||
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.router;
|
package com.cloud.network.router;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -30,9 +31,11 @@ import com.cloud.exception.InsufficientCapacityException;
|
|||||||
import com.cloud.exception.InsufficientServerCapacityException;
|
import com.cloud.exception.InsufficientServerCapacityException;
|
||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.exception.StorageUnavailableException;
|
import com.cloud.exception.StorageUnavailableException;
|
||||||
|
import com.cloud.network.Network;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.User;
|
import com.cloud.user.User;
|
||||||
import com.cloud.vm.DomainRouterVO;
|
import com.cloud.vm.DomainRouterVO;
|
||||||
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.VirtualMachineProfile.Param;
|
import com.cloud.vm.VirtualMachineProfile.Param;
|
||||||
|
|
||||||
public interface NetworkHelper {
|
public interface NetworkHelper {
|
||||||
@ -73,9 +76,11 @@ public interface NetworkHelper {
|
|||||||
ConcurrentOperationException, ResourceUnavailableException;
|
ConcurrentOperationException, ResourceUnavailableException;
|
||||||
|
|
||||||
public abstract DomainRouterVO deployRouter(
|
public abstract DomainRouterVO deployRouter(
|
||||||
RouterDeploymentDefinition routerDeploymentDefinition,
|
RouterDeploymentDefinition routerDeploymentDefinition, boolean startRouter)
|
||||||
boolean startRouter)
|
|
||||||
throws InsufficientAddressCapacityException,
|
throws InsufficientAddressCapacityException,
|
||||||
InsufficientServerCapacityException, InsufficientCapacityException,
|
InsufficientServerCapacityException, InsufficientCapacityException,
|
||||||
StorageUnavailableException, ResourceUnavailableException;
|
StorageUnavailableException, ResourceUnavailableException;
|
||||||
|
|
||||||
|
public abstract LinkedHashMap<Network, List<? extends NicProfile>> createRouterNetworks(RouterDeploymentDefinition routerDeploymentDefinition)
|
||||||
|
throws ConcurrentOperationException, InsufficientAddressCapacityException;
|
||||||
}
|
}
|
||||||
@ -474,8 +474,8 @@ public class NetworkHelperImpl implements NetworkHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploymentDefinition, final boolean startRouter) throws InsufficientAddressCapacityException,
|
public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploymentDefinition, final boolean startRouter)
|
||||||
InsufficientServerCapacityException, InsufficientCapacityException, StorageUnavailableException, ResourceUnavailableException {
|
throws InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException, StorageUnavailableException, ResourceUnavailableException {
|
||||||
|
|
||||||
final ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(routerDeploymentDefinition.getServiceOfferingId());
|
final ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(routerDeploymentDefinition.getServiceOfferingId());
|
||||||
final Account owner = routerDeploymentDefinition.getOwner();
|
final Account owner = routerDeploymentDefinition.getOwner();
|
||||||
@ -530,7 +530,9 @@ public class NetworkHelperImpl implements NetworkHelper {
|
|||||||
router.setDynamicallyScalable(template.isDynamicallyScalable());
|
router.setDynamicallyScalable(template.isDynamicallyScalable());
|
||||||
router.setRole(Role.VIRTUAL_ROUTER);
|
router.setRole(Role.VIRTUAL_ROUTER);
|
||||||
router = _routerDao.persist(router);
|
router = _routerDao.persist(router);
|
||||||
|
|
||||||
final LinkedHashMap<Network, List<? extends NicProfile>> networks = createRouterNetworks(routerDeploymentDefinition);
|
final LinkedHashMap<Network, List<? extends NicProfile>> networks = createRouterNetworks(routerDeploymentDefinition);
|
||||||
|
|
||||||
_itMgr.allocate(router.getInstanceName(), template, routerOffering, networks, routerDeploymentDefinition.getPlan(), null);
|
_itMgr.allocate(router.getInstanceName(), template, routerOffering, networks, routerDeploymentDefinition.getPlan(), null);
|
||||||
router = _routerDao.findById(router.getId());
|
router = _routerDao.findById(router.getId());
|
||||||
} catch (final InsufficientCapacityException ex) {
|
} catch (final InsufficientCapacityException ex) {
|
||||||
@ -642,6 +644,7 @@ public class NetworkHelperImpl implements NetworkHelper {
|
|||||||
throw new CloudRuntimeException(errMsg);
|
throw new CloudRuntimeException(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LinkedHashMap<Network, List<? extends NicProfile>> createRouterNetworks(final RouterDeploymentDefinition routerDeploymentDefinition)
|
public LinkedHashMap<Network, List<? extends NicProfile>> createRouterNetworks(final RouterDeploymentDefinition routerDeploymentDefinition)
|
||||||
throws ConcurrentOperationException, InsufficientAddressCapacityException {
|
throws ConcurrentOperationException, InsufficientAddressCapacityException {
|
||||||
|
|
||||||
|
|||||||
@ -127,7 +127,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addVpcRouterToGuestNetwork(final VirtualRouter router, final Network network, final boolean isRedundant, final Map<VirtualMachineProfile.Param, Object> params)
|
public boolean addVpcRouterToGuestNetwork(final VirtualRouter router, final Network network, final Map<VirtualMachineProfile.Param, Object> params)
|
||||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||||
if (network.getTrafficType() != TrafficType.Guest) {
|
if (network.getTrafficType() != TrafficType.Guest) {
|
||||||
s_logger.warn("Network " + network + " is not of type " + TrafficType.Guest);
|
s_logger.warn("Network " + network + " is not of type " + TrafficType.Guest);
|
||||||
@ -159,7 +159,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||||||
} finally {
|
} finally {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
s_logger.debug("Removing the router " + router + " from network " + network + " as a part of cleanup");
|
s_logger.debug("Removing the router " + router + " from network " + network + " as a part of cleanup");
|
||||||
if (removeVpcRouterFromGuestNetwork(router, network, isRedundant)) {
|
if (removeVpcRouterFromGuestNetwork(router, network)) {
|
||||||
s_logger.debug("Removed the router " + router + " from network " + network + " as a part of cleanup");
|
s_logger.debug("Removed the router " + router + " from network " + network + " as a part of cleanup");
|
||||||
} else {
|
} else {
|
||||||
s_logger.warn("Failed to remove the router " + router + " from network " + network + " as a part of cleanup");
|
s_logger.warn("Failed to remove the router " + router + " from network " + network + " as a part of cleanup");
|
||||||
@ -173,7 +173,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeVpcRouterFromGuestNetwork(final VirtualRouter router, final Network network, final boolean isRedundant) throws ConcurrentOperationException,
|
public boolean removeVpcRouterFromGuestNetwork(final VirtualRouter router, final Network network) throws ConcurrentOperationException,
|
||||||
ResourceUnavailableException {
|
ResourceUnavailableException {
|
||||||
if (network.getTrafficType() != TrafficType.Guest) {
|
if (network.getTrafficType() != TrafficType.Guest) {
|
||||||
s_logger.warn("Network " + network + " is not of type " + TrafficType.Guest);
|
s_logger.warn("Network " + network + " is not of type " + TrafficType.Guest);
|
||||||
|
|||||||
@ -16,6 +16,16 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.cloud.network.router.deployment;
|
package org.cloud.network.router.deployment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
|
||||||
import com.cloud.dc.dao.HostPodDao;
|
import com.cloud.dc.dao.HostPodDao;
|
||||||
import com.cloud.dc.dao.VlanDao;
|
import com.cloud.dc.dao.VlanDao;
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
@ -42,14 +52,6 @@ import com.cloud.vm.VirtualMachineProfile.Param;
|
|||||||
import com.cloud.vm.dao.DomainRouterDao;
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
import com.cloud.vm.dao.NicDao;
|
import com.cloud.vm.dao.NicDao;
|
||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class RouterDeploymentDefinitionBuilder {
|
public class RouterDeploymentDefinitionBuilder {
|
||||||
|
|
||||||
@ -170,7 +172,7 @@ public class RouterDeploymentDefinitionBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IntermediateStateBuilder setGuestNetwork(final Network nw) {
|
public IntermediateStateBuilder setGuestNetwork(final Network nw) {
|
||||||
this.guestNetwork = nw;
|
guestNetwork = nw;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -186,7 +186,6 @@ public class VpcRouterDeploymentDefinition extends RouterDeploymentDefinition {
|
|||||||
final DomainRouterVO router = nwHelper.deployRouter(this, false);
|
final DomainRouterVO router = nwHelper.deployRouter(this, false);
|
||||||
|
|
||||||
if (router != null) {
|
if (router != null) {
|
||||||
// TODO this.routerDao.addRouterToGuestNetwork(router, this.guestNetwork);
|
|
||||||
routers.add(router);
|
routers.add(router);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,7 +191,7 @@ public class MockVpcVirtualNetworkApplianceManager extends ManagerBase implement
|
|||||||
* @see com.cloud.network.VpcVirtualNetworkApplianceService#addVpcRouterToGuestNetwork(com.cloud.network.router.VirtualRouter, com.cloud.network.Network, boolean)
|
* @see com.cloud.network.VpcVirtualNetworkApplianceService#addVpcRouterToGuestNetwork(com.cloud.network.router.VirtualRouter, com.cloud.network.Network, boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean addVpcRouterToGuestNetwork(final VirtualRouter router, final Network network, final boolean isRedundant, final Map<VirtualMachineProfile.Param, Object> params)
|
public boolean addVpcRouterToGuestNetwork(final VirtualRouter router, final Network network, final Map<VirtualMachineProfile.Param, Object> params)
|
||||||
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
@ -201,7 +201,7 @@ public class MockVpcVirtualNetworkApplianceManager extends ManagerBase implement
|
|||||||
* @see com.cloud.network.VpcVirtualNetworkApplianceService#removeVpcRouterFromGuestNetwork(com.cloud.network.router.VirtualRouter, com.cloud.network.Network, boolean)
|
* @see com.cloud.network.VpcVirtualNetworkApplianceService#removeVpcRouterFromGuestNetwork(com.cloud.network.router.VirtualRouter, com.cloud.network.Network, boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean removeVpcRouterFromGuestNetwork(final VirtualRouter router, final Network network, final boolean isRedundant) throws ConcurrentOperationException {
|
public boolean removeVpcRouterFromGuestNetwork(final VirtualRouter router, final Network network) throws ConcurrentOperationException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -123,12 +123,12 @@ public class RouterDeploymentDefinitionTestBase {
|
|||||||
|
|
||||||
|
|
||||||
protected void initMocks() {
|
protected void initMocks() {
|
||||||
when(this.mockDestination.getDataCenter()).thenReturn(this.mockDataCenter);
|
when(mockDestination.getDataCenter()).thenReturn(mockDataCenter);
|
||||||
when(this.mockDataCenter.getId()).thenReturn(DATA_CENTER_ID);
|
when(mockDataCenter.getId()).thenReturn(DATA_CENTER_ID);
|
||||||
when(this.mockPod.getId()).thenReturn(POD_ID1);
|
when(mockPod.getId()).thenReturn(POD_ID1);
|
||||||
when(this.mockHostPodVO1.getId()).thenReturn(POD_ID1);
|
when(mockHostPodVO1.getId()).thenReturn(POD_ID1);
|
||||||
when(this.mockHostPodVO2.getId()).thenReturn(POD_ID2);
|
when(mockHostPodVO2.getId()).thenReturn(POD_ID2);
|
||||||
when(this.mockHostPodVO3.getId()).thenReturn(POD_ID3);
|
when(mockHostPodVO3.getId()).thenReturn(POD_ID3);
|
||||||
when(this.mockNw.getId()).thenReturn(NW_ID_1);
|
when(mockNw.getId()).thenReturn(NW_ID_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,17 +17,16 @@
|
|||||||
package org.cloud.network.router.deployment;
|
package org.cloud.network.router.deployment;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
import static junit.framework.Assert.assertEquals;
|
||||||
|
import static junit.framework.Assert.assertFalse;
|
||||||
import static junit.framework.Assert.assertNotNull;
|
import static junit.framework.Assert.assertNotNull;
|
||||||
import static junit.framework.Assert.assertNull;
|
import static junit.framework.Assert.assertNull;
|
||||||
import static junit.framework.Assert.assertTrue;
|
import static junit.framework.Assert.assertTrue;
|
||||||
import static junit.framework.Assert.assertFalse;
|
|
||||||
import static org.mockito.Matchers.anyLong;
|
import static org.mockito.Matchers.anyLong;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import com.cloud.network.vpc.VpcOfferingVO;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -46,6 +45,7 @@ import com.cloud.network.dao.PhysicalNetworkDao;
|
|||||||
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
|
||||||
import com.cloud.network.router.NicProfileHelper;
|
import com.cloud.network.router.NicProfileHelper;
|
||||||
import com.cloud.network.vpc.VpcManager;
|
import com.cloud.network.vpc.VpcManager;
|
||||||
|
import com.cloud.network.vpc.VpcOfferingVO;
|
||||||
import com.cloud.network.vpc.VpcVO;
|
import com.cloud.network.vpc.VpcVO;
|
||||||
import com.cloud.network.vpc.dao.VpcDao;
|
import com.cloud.network.vpc.dao.VpcDao;
|
||||||
import com.cloud.network.vpc.dao.VpcOfferingDao;
|
import com.cloud.network.vpc.dao.VpcOfferingDao;
|
||||||
@ -154,7 +154,7 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
|
|||||||
@Test
|
@Test
|
||||||
public void testFindDestinations() {
|
public void testFindDestinations() {
|
||||||
// Execute
|
// Execute
|
||||||
List<DeployDestination> foundDestinations = deployment.findDestinations();
|
final List<DeployDestination> foundDestinations = deployment.findDestinations();
|
||||||
// Assert
|
// Assert
|
||||||
assertEquals(FOR_VPC_ONLY_THE_GIVEN_DESTINATION_SHOULD_BE_USED, deployment.dest, foundDestinations.get(0));
|
assertEquals(FOR_VPC_ONLY_THE_GIVEN_DESTINATION_SHOULD_BE_USED, deployment.dest, foundDestinations.get(0));
|
||||||
assertEquals(FOR_VPC_ONLY_THE_GIVEN_DESTINATION_SHOULD_BE_USED, 1, foundDestinations.size());
|
assertEquals(FOR_VPC_ONLY_THE_GIVEN_DESTINATION_SHOULD_BE_USED, 1, foundDestinations.size());
|
||||||
@ -180,8 +180,8 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
|
|||||||
@Test
|
@Test
|
||||||
public void testFindOfferingIdLeavingPrevious() {
|
public void testFindOfferingIdLeavingPrevious() {
|
||||||
// Prepare
|
// Prepare
|
||||||
Long initialOfferingId = deployment.serviceOfferingId;
|
final Long initialOfferingId = deployment.serviceOfferingId;
|
||||||
VpcOfferingVO vpcOffering = mock(VpcOfferingVO.class);
|
final VpcOfferingVO vpcOffering = mock(VpcOfferingVO.class);
|
||||||
when(mockVpcOffDao.findById(VPC_OFFERING_ID)).thenReturn(vpcOffering);
|
when(mockVpcOffDao.findById(VPC_OFFERING_ID)).thenReturn(vpcOffering);
|
||||||
when(vpcOffering.getServiceOfferingId()).thenReturn(null);
|
when(vpcOffering.getServiceOfferingId()).thenReturn(null);
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
|
|||||||
@Test
|
@Test
|
||||||
public void testFindOfferingIdSettingNewOne() {
|
public void testFindOfferingIdSettingNewOne() {
|
||||||
// Prepare
|
// Prepare
|
||||||
VpcOfferingVO vpcOffering = mock(VpcOfferingVO.class);
|
final VpcOfferingVO vpcOffering = mock(VpcOfferingVO.class);
|
||||||
when(mockVpcOffDao.findById(VPC_OFFERING_ID)).thenReturn(vpcOffering);
|
when(mockVpcOffDao.findById(VPC_OFFERING_ID)).thenReturn(vpcOffering);
|
||||||
when(vpcOffering.getServiceOfferingId()).thenReturn(VPC_OFFERING_ID);
|
when(vpcOffering.getServiceOfferingId()).thenReturn(VPC_OFFERING_ID);
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeployAllVirtualRoutersWithNoDeployedRouter() throws InsufficientAddressCapacityException, InsufficientServerCapacityException, StorageUnavailableException,
|
public void testDeployAllVirtualRoutersWithNoDeployedRouter() throws InsufficientAddressCapacityException, InsufficientServerCapacityException, StorageUnavailableException,
|
||||||
InsufficientCapacityException, ResourceUnavailableException {
|
InsufficientCapacityException, ResourceUnavailableException {
|
||||||
|
|
||||||
driveTestDeployAllVirtualRouters(null);
|
driveTestDeployAllVirtualRouters(null);
|
||||||
|
|
||||||
@ -225,9 +225,9 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void driveTestDeployAllVirtualRouters(final DomainRouterVO router) throws InsufficientAddressCapacityException, InsufficientServerCapacityException,
|
public void driveTestDeployAllVirtualRouters(final DomainRouterVO router) throws InsufficientAddressCapacityException, InsufficientServerCapacityException,
|
||||||
StorageUnavailableException, InsufficientCapacityException, ResourceUnavailableException {
|
StorageUnavailableException, InsufficientCapacityException, ResourceUnavailableException {
|
||||||
// Prepare
|
// Prepare
|
||||||
VpcRouterDeploymentDefinition vpcDeployment = (VpcRouterDeploymentDefinition) deployment;
|
final VpcRouterDeploymentDefinition vpcDeployment = (VpcRouterDeploymentDefinition) deployment;
|
||||||
when(vpcDeployment.nwHelper.deployRouter(vpcDeployment, true)).thenReturn(router);
|
when(vpcDeployment.nwHelper.deployRouter(vpcDeployment, true)).thenReturn(router);
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
@ -242,7 +242,7 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
|
|||||||
@Test
|
@Test
|
||||||
public void testFindSourceNatIP() throws InsufficientAddressCapacityException, ConcurrentOperationException {
|
public void testFindSourceNatIP() throws InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||||
// Prepare
|
// Prepare
|
||||||
PublicIp publicIp = mock(PublicIp.class);
|
final PublicIp publicIp = mock(PublicIp.class);
|
||||||
when(vpcMgr.assignSourceNatIpAddressToVpc(mockOwner, mockVpc)).thenReturn(publicIp);
|
when(vpcMgr.assignSourceNatIpAddressToVpc(mockOwner, mockVpc)).thenReturn(publicIp);
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
@ -255,13 +255,13 @@ public class VpcRouterDeploymentDefinitionTest extends RouterDeploymentDefinitio
|
|||||||
@Test
|
@Test
|
||||||
public void testRedundancyProperty() {
|
public void testRedundancyProperty() {
|
||||||
// Set and confirm is redundant
|
// Set and confirm is redundant
|
||||||
when(this.mockVpc.isRedundant()).thenReturn(true);
|
when(mockVpc.isRedundant()).thenReturn(true);
|
||||||
RouterDeploymentDefinition deployment = this.builder.create()
|
final RouterDeploymentDefinition deployment = builder.create()
|
||||||
.setVpc(this.mockVpc)
|
.setVpc(mockVpc)
|
||||||
.setDeployDestination(this.mockDestination)
|
.setDeployDestination(mockDestination)
|
||||||
.build();
|
.build();
|
||||||
assertTrue("The builder ignored redundancy from its inner network", deployment.isRedundant());
|
assertTrue("The builder ignored redundancy from its inner network", deployment.isRedundant());
|
||||||
when(this.mockVpc.isRedundant()).thenReturn(false);
|
when(mockVpc.isRedundant()).thenReturn(false);
|
||||||
assertFalse("The builder ignored redundancy from its inner network", deployment.isRedundant());
|
assertFalse("The builder ignored redundancy from its inner network", deployment.isRedundant());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ vrrp_instance inside_network {
|
|||||||
}
|
}
|
||||||
|
|
||||||
!That's the correct path of the master.py file.
|
!That's the correct path of the master.py file.
|
||||||
notify_master "/cloud_scripts/opt/cloud/bin/master.py --master"
|
notify_master "/root/cloud_scripts/opt/cloud/bin/master.py --master"
|
||||||
notify_backup "/cloud_scripts/opt/cloud/bin/master.py --backup"
|
notify_backup "/root/cloud_scripts/opt/cloud/bin/master.py --backup"
|
||||||
notify_fault "/cloud_scripts/opt/cloud/bin/master.py --fault"
|
notify_fault "/root/cloud_scripts/opt/cloud/bin/master.py --fault"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user