Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
1a85213
Rules and visitors for Load Balance Rules
Jul 3, 2014
f28426e
Extract general behavior to Router and Vpc delegates
Jul 10, 2014
24b230d
Fix dependency problem. Extract and unify router deployment stuff
Jul 11, 2014
65d7e07
Adding Firewall Rules to comply with the Visitor pattern implementati…
Jul 13, 2014
3457d0f
changing accessor modifier in instance variables
Jul 14, 2014
bbce7d9
fixing checkstyles
wilderrodrigues Jul 14, 2014
4b1112a
finished firewall rules and load balancing rules; fixed all the injec…
wilderrodrigues Jul 14, 2014
f17a0b8
TODO
DaanHoogland Jul 14, 2014
fb8973f
adding static nat rules. Deploying new VMs is not working due to the …
wilderrodrigues Jul 14, 2014
7e98e3e
we have to check if VPC is null bfore calling it. VPC is not used in …
wilderrodrigues Jul 15, 2014
f965fb9
adding apache license headers
wilderrodrigues Jul 15, 2014
6b2d35c
adding Ip Association and VPN Rules
wilderrodrigues Jul 15, 2014
563f853
Fix offering setup
Jul 15, 2014
e1866bf
package rename
DaanHoogland Jul 15, 2014
a982532
Temporary put state info in a state object
Jul 15, 2014
87f0e68
fixing the classes relationship; adding beans properly in the spring …
wilderrodrigues Jul 15, 2014
299c42c
adding password to router rules; moving the advance code to the advan…
wilderrodrigues Jul 15, 2014
631b561
Unify and encapsulate deployment flow methods and params
Jul 15, 2014
f0189ac
adding userdata to router and ssh pub key to router rules.
wilderrodrigues Jul 16, 2014
b9ffe23
making instance variables compliant with ACS convention
wilderrodrigues Jul 16, 2014
8f313ca
adding user data pwd rules
wilderrodrigues Jul 16, 2014
d153296
fixing injection of beans with a relationship
wilderrodrigues Jul 16, 2014
c76952b
whitespace
DaanHoogland Jul 16, 2014
e99b5b0
fixing the injection of the networkDao
wilderrodrigues Jul 16, 2014
95395f9
Deployment more OO - Objects with data and behavior
Jul 16, 2014
869f0ad
replacing my IP by localhost to avoid problems with my environment
wilderrodrigues Jul 17, 2014
0b78731
fixing import in virtual router element and checkstyle in dhcp entry …
wilderrodrigues Jul 17, 2014
e35fded
commenting broken code in tests in order to run build adn tests other…
wilderrodrigues Jul 17, 2014
8437c2f
removing bean from the xml
wilderrodrigues Jul 17, 2014
bfd4316
adding new bean to spring context file; renaming package from "com" t…
wilderrodrigues Jul 17, 2014
f23ba91
Fixing null pointers during vpc router deployment
Jul 17, 2014
b97f2b0
apply network acls; acls items to pvt gw; vpc ip association
wilderrodrigues Jul 17, 2014
325026d
fixing VPC IP Association and ACL rules. Have to rewrite in a better …
wilderrodrigues Jul 18, 2014
8852153
Splitting Vpc and NonVpc deployment into phases & testing it
Jul 17, 2014
f3c0417
RouterDeployment and VPC. Improving code and Unit Testing
Jul 23, 2014
6fac126
More refactoring and testing in the same classes
Jul 27, 2014
a83f579
License headers
Jul 28, 2014
12b0d18
Replacing the old [Vpc}VirtualNetworkApplianceManager by the new ones;
wilderrodrigues Aug 18, 2014
d2d9157
Complete tests for normal deployment and start vpc one
Jul 28, 2014
240a539
Factor out prepareDeployment and update tests
Jul 29, 2014
0d81cf0
Increasing test coverage for Vpc Deployment
Jul 29, 2014
95d32b4
Fix unnecessary changes Spring contexts
Aug 18, 2014
16ad412
moving sendCommand to the NetworkGeneralHelper;
wilderrodrigues Aug 19, 2014
00dc8a7
fixing check styles
wilderrodrigues Aug 19, 2014
2da3ced
Refactor to include network creation as actual deployment
Aug 19, 2014
b96035f
adding applyStaticRoutes method to the network topology/visitor. it w…
wilderrodrigues Aug 19, 2014
adebaf2
adding applyStaticRoutes to the new visitor pattern.
wilderrodrigues Aug 19, 2014
3d4ddb7
DeployRouter includes nw creation following TellDontAsk principle
Aug 20, 2014
b9bff84
Whole router.deployment package got 97% coverage
Aug 20, 2014
01edc8e
adding setupPrivateGateway to new style;
wilderrodrigues Aug 20, 2014
e08cb11
fixing check style issues
wilderrodrigues Aug 21, 2014
2802d3b
Refactor and test NetworkHelper#sendCommandsToRouterWithNoAnswers
Aug 21, 2014
b5e96af
Missing license headers
Aug 21, 2014
546e563
refactor all private methods in the virtual router appliance and VPC …
wilderrodrigues Aug 21, 2014
65fb216
auto wire the network helper
wilderrodrigues Aug 21, 2014
cd8cada
Refactor hypervisor retrieval from VpcNwHelper and NwHelper
Aug 21, 2014
02c7525
Fixing NPE due to use of dependencies before Spring injection
Aug 22, 2014
5f51a06
fix dhcp subnet rules. we can create VMs again.
wilderrodrigues Aug 23, 2014
b7c193a
fixing nic plug unplug rule
wilderrodrigues Aug 25, 2014
ee9068b
merging cmd-visitor into cmd-visitor-rebase, with the upstream from A…
wilderrodrigues Sep 5, 2014
64eed6c
Fix: VpcRouter has always PublicIp setup as it did before refactoring
Aug 28, 2014
dc5fefc
making sure the instance variable _router in the Rules is being used …
wilderrodrigues Sep 2, 2014
251e7ff
removing the root password becuase it was breaking the simulator test…
wilderrodrigues Sep 2, 2014
f2f4732
Removing the VirtualNetworkStatus, it was not being used properly;
wilderrodrigues Sep 4, 2014
60eea3b
Adding fixes for the add user data and vpn rules
wilderrodrigues Sep 8, 2014
9f801d1
Changing the way the DAOs were being injected in the RuleApplier;
wilderrodrigues Sep 9, 2014
025ff72
fixing checkstyle in the virtual network manager. problem appeared af…
wilderrodrigues Sep 9, 2014
4e21948
Fixing the NetworkHelperImpl class. It was throwing a NPE due to a hy…
wilderrodrigues Sep 11, 2014
3ac2e22
CLOUDSTACK-6278 Baremetal Advanced Networking support from commit id …
wilderrodrigues Sep 11, 2014
c81b338
Applying the latest chances from the VPC Refactor branch onto the new…
wilderrodrigues Sep 29, 2014
db86bdf
Applygin fix from commit ID aaeadc5c44e3fe16a1deea5348b085b08b5f4f4d
wilderrodrigues Sep 30, 2014
2ed64b2
Applying fix from commit id 6b8e0baa21e6cffc62eb2d35eecc7aeb2087d1c1
wilderrodrigues Oct 14, 2014
1e87d7b
Fixing checkstyle.
wilderrodrigues Oct 14, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
we have to check if VPC is null bfore calling it. VPC is not used in …
…gest networks, so deploying a new VM was broken.
  • Loading branch information
wilderrodrigues committed Oct 14, 2014
commit 7e98e3e1327af3d0bcaeae211d41c1270123f891
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<bean id="vpcManagerImpl" class="com.cloud.network.vpc.VpcManagerImpl" >
<property name="vpcElements" value="#{vpcProvidersRegistry.registered}"></property>
</bean>

<bean id="vpcVirtualNetworkApplianceManagerImpl"
class="com.cloud.network.router.VpcVirtualNetworkApplianceManagerImpl" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
LoadBalancingRulesManager _lbMgr;
@Inject
NetworkOfferingDao _networkOfferingDao;

@Inject
VpcVirtualNetworkApplianceManager _routerMgr;
@Inject
Expand Down
104 changes: 55 additions & 49 deletions server/src/com/cloud/network/router/NetworkGeneralHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public String getRouterIpInNetwork(final long networkId, final long instanceId)
}


// @Override
// @Override
public boolean sendCommandsToRouter(final VirtualRouter router, final Commands cmds) throws AgentUnavailableException {
if(!checkRouterVersion(router)){
s_logger.debug("Router requires upgrade. Unable to send command to router:" + router.getId() + ", router template version : " + router.getTemplateVersion()
Expand Down Expand Up @@ -184,14 +184,14 @@ public boolean sendCommandsToRouter(final VirtualRouter router, final Commands c
}


// @Override
public NicTO getNicTO(final VirtualRouter router, Long networkId, String broadcastUri) {
// @Override
public NicTO getNicTO(final VirtualRouter router, final Long networkId, final String broadcastUri) {
NicProfile nicProfile = _networkModel.getNicProfile(router, networkId, broadcastUri);

return _itMgr.toNicTO(nicProfile, router.getHypervisorType());
}

// @Override
// @Override
public VirtualRouter destroyRouter(final long routerId, final Account caller, final Long callerUserId) throws ResourceUnavailableException, ConcurrentOperationException {

if (s_logger.isDebugEnabled()) {
Expand All @@ -216,7 +216,7 @@ public VirtualRouter destroyRouter(final long routerId, final Account caller, fi
* @param router
* @return
*/
// @Override
// @Override
public boolean checkRouterVersion(final VirtualRouter router) {
if(!VirtualNetworkApplianceManagerImpl.routerVersionCheckEnabled.value()){
//Router version check is disabled.
Expand Down Expand Up @@ -252,11 +252,12 @@ protected DomainRouterVO start(DomainRouterVO router, final User user, final Acc
return _routerDao.findById(router.getId());
}

protected DomainRouterVO waitRouter(DomainRouterVO router) {
protected DomainRouterVO waitRouter(final DomainRouterVO router) {
DomainRouterVO vm = _routerDao.findById(router.getId());

if (s_logger.isDebugEnabled())
if (s_logger.isDebugEnabled()) {
s_logger.debug("Router " + router.getInstanceName() + " is not fully up yet, we will wait");
}
while (vm.getState() == State.Starting) {
try {
Thread.sleep(1000);
Expand All @@ -268,8 +269,9 @@ protected DomainRouterVO waitRouter(DomainRouterVO router) {
}

if (vm.getState() == State.Running) {
if (s_logger.isDebugEnabled())
if (s_logger.isDebugEnabled()) {
s_logger.debug("Router " + router.getInstanceName() + " is now fully up");
}

return router;
}
Expand All @@ -279,7 +281,7 @@ protected DomainRouterVO waitRouter(DomainRouterVO router) {
}


// @Override
// @Override
public List<DomainRouterVO> startRouters(final Map<Param, Object> params, final List<DomainRouterVO> routers) throws StorageUnavailableException,
InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
List<DomainRouterVO> runningRouters = null;
Expand Down Expand Up @@ -309,13 +311,13 @@ public List<DomainRouterVO> startRouters(final Map<Param, Object> params, final
return runningRouters;
}

// @Override
public DomainRouterVO startVirtualRouter(DomainRouterVO router, User user, Account caller, Map<Param, Object> params)
// @Override
public DomainRouterVO startVirtualRouter(final DomainRouterVO router, final User user, final Account caller, final Map<Param, Object> params)
throws StorageUnavailableException, InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
ConcurrentOperationException, ResourceUnavailableException {

if (router.getRole() != Role.VIRTUAL_ROUTER || !router.getIsRedundantRouter()) {
return this.start(router, user, caller, params, null);
return start(router, user, caller, params, null);
}

if (router.getState() == State.Running) {
Expand Down Expand Up @@ -355,7 +357,7 @@ public DomainRouterVO startVirtualRouter(DomainRouterVO router, User user, Accou
}
}
if (routerToBeAvoid == null) {
return this.start(router, user, caller, params, null);
return start(router, user, caller, params, null);
}
// We would try best to deploy the router to another place
final int retryIndex = 5;
Expand All @@ -380,7 +382,7 @@ public DomainRouterVO startVirtualRouter(DomainRouterVO router, User user, Accou
}
plan.setAvoids(avoids[i]);
try {
result = this.start(router, user, caller, params, plan);
result = start(router, user, caller, params, plan);
} catch (final InsufficientServerCapacityException ex) {
result = null;
}
Expand All @@ -392,14 +394,14 @@ public DomainRouterVO startVirtualRouter(DomainRouterVO router, User user, Accou
}


// @Override
// @Override
public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploymentDefinition,
VirtualRouterProvider vrProvider, long svcOffId,
LinkedHashMap<Network, List<? extends NicProfile>> networks,
boolean startRouter, List<HypervisorType> supportedHypervisors)
throws InsufficientAddressCapacityException,
InsufficientServerCapacityException, InsufficientCapacityException,
StorageUnavailableException, ResourceUnavailableException {
final VirtualRouterProvider vrProvider, final long svcOffId,
final LinkedHashMap<Network, List<? extends NicProfile>> networks,
final boolean startRouter, final List<HypervisorType> supportedHypervisors)
throws InsufficientAddressCapacityException,
InsufficientServerCapacityException, InsufficientCapacityException,
StorageUnavailableException, ResourceUnavailableException {

final ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId);
final DeployDestination dest = routerDeploymentDefinition.getDest();
Expand All @@ -422,23 +424,23 @@ public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploy

String templateName = null;
switch (hType) {
case XenServer:
templateName = VirtualNetworkApplianceManager.RouterTemplateXen.valueIn(dest.getDataCenter().getId());
break;
case KVM:
templateName = VirtualNetworkApplianceManager.RouterTemplateKvm.valueIn(dest.getDataCenter().getId());
break;
case VMware:
templateName = VirtualNetworkApplianceManager.RouterTemplateVmware.valueIn(dest.getDataCenter().getId());
break;
case Hyperv:
templateName = VirtualNetworkApplianceManager.RouterTemplateHyperV.valueIn(dest.getDataCenter().getId());
break;
case LXC:
templateName = VirtualNetworkApplianceManager.RouterTemplateLxc.valueIn(dest.getDataCenter().getId());
break;
default:
break;
case XenServer:
templateName = VirtualNetworkApplianceManager.RouterTemplateXen.valueIn(dest.getDataCenter().getId());
break;
case KVM:
templateName = VirtualNetworkApplianceManager.RouterTemplateKvm.valueIn(dest.getDataCenter().getId());
break;
case VMware:
templateName = VirtualNetworkApplianceManager.RouterTemplateVmware.valueIn(dest.getDataCenter().getId());
break;
case Hyperv:
templateName = VirtualNetworkApplianceManager.RouterTemplateHyperV.valueIn(dest.getDataCenter().getId());
break;
case LXC:
templateName = VirtualNetworkApplianceManager.RouterTemplateLxc.valueIn(dest.getDataCenter().getId());
break;
default:
break;
}
final VMTemplateVO template = _templateDao.findRoutingTemplate(hType, templateName);

Expand All @@ -453,10 +455,14 @@ public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploy
offerHA = false;
}

// routerDeploymentDefinition.getVpc().getId() ==> do not use VPC because it is not a VPC offering.
Long vpcId = routerDeploymentDefinition.getVpc() != null ? routerDeploymentDefinition.getVpc().getId() : null;

router = new DomainRouterVO(id, routerOffering.getId(), vrProvider.getId(),
VirtualMachineName.getRouterName(id, VirtualNwStatus.instance), template.getId(), template.getHypervisorType(),
template.getGuestOSId(), owner.getDomainId(), owner.getId(), routerDeploymentDefinition.isRedundant(), 0,
false, RedundantState.UNKNOWN, offerHA, false, routerDeploymentDefinition.getVpc().getId());
false, RedundantState.UNKNOWN, offerHA, false, vpcId);

router.setDynamicallyScalable(template.isDynamicallyScalable());
router.setRole(Role.VIRTUAL_ROUTER);
router = _routerDao.persist(router);
Expand Down Expand Up @@ -565,21 +571,21 @@ protected HypervisorType getClusterToStartDomainRouterForOvm(final long podId) {

final String errMsg =
new StringBuilder("Cannot find an available cluster in Pod ")
.append(podId)
.append(" to start domain router for Ovm. \n Ovm won't support any system vm including domain router, ")
.append("please make sure you have a cluster with hypervisor type of any of xenserver/KVM/Vmware in the same pod")
.append(" with Ovm cluster. And there is at least one host in UP status in that cluster.")
.toString();
.append(podId)
.append(" to start domain router for Ovm. \n Ovm won't support any system vm including domain router, ")
.append("please make sure you have a cluster with hypervisor type of any of xenserver/KVM/Vmware in the same pod")
.append(" with Ovm cluster. And there is at least one host in UP status in that cluster.")
.toString();
throw new CloudRuntimeException(errMsg);
}


// @Override
// @Override
public LinkedHashMap<Network, List<? extends NicProfile>> createRouterNetworks(
final RouterDeploymentDefinition routerDeploymentDefinition,
Network guestNetwork, Pair<Boolean, PublicIp> publicNetwork)
throws ConcurrentOperationException,
InsufficientAddressCapacityException {
final Network guestNetwork, final Pair<Boolean, PublicIp> publicNetwork)
throws ConcurrentOperationException,
InsufficientAddressCapacityException {

boolean setupPublicNetwork = false;
if (publicNetwork != null) {
Expand Down
47 changes: 31 additions & 16 deletions server/src/com/cloud/network/router/RouterDeploymentDefinition.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// 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 com.cloud.network.router;

import java.util.Map;
Expand All @@ -19,9 +35,9 @@ public class RouterDeploymentDefinition {
protected boolean isRedundant;
protected DeploymentPlan plan;

public RouterDeploymentDefinition(Vpc vpc, DeployDestination dest,
Account owner, Map<Param, Object> params,
boolean isRedundant) {
public RouterDeploymentDefinition(final Vpc vpc, final DeployDestination dest,
final Account owner, final Map<Param, Object> params,
final boolean isRedundant) {

this.vpc = vpc;
this.dest = dest;
Expand All @@ -30,8 +46,8 @@ public RouterDeploymentDefinition(Vpc vpc, DeployDestination dest,
this.isRedundant = isRedundant;
}

public RouterDeploymentDefinition(Network guestNetwork, DeployDestination dest,
Account owner, Map<Param, Object> params, boolean isRedundant) {
public RouterDeploymentDefinition(final Network guestNetwork, final DeployDestination dest,
final Account owner, final Map<Param, Object> params, final boolean isRedundant) {

this.guestNetwork = guestNetwork;
this.dest = dest;
Expand All @@ -43,51 +59,50 @@ public RouterDeploymentDefinition(Network guestNetwork, DeployDestination dest,
public Vpc getVpc() {
return vpc;
}
public void setVpc(Vpc vpc) {
public void setVpc(final Vpc vpc) {
this.vpc = vpc;
}
public Network getGuestNetwork() {
return guestNetwork;
}
public void setGuestNetwork(Network guestNetwork) {
public void setGuestNetwork(final Network guestNetwork) {
this.guestNetwork = guestNetwork;
}
public DeployDestination getDest() {
return dest;
}
public void setDest(DeployDestination dest) {
public void setDest(final DeployDestination dest) {
this.dest = dest;
}
public Account getOwner() {
return owner;
}
public void setOwner(Account owner) {
public void setOwner(final Account owner) {
this.owner = owner;
}
public Map<Param, Object> getParams() {
return params;
}
public void setParams(Map<Param, Object> params) {
public void setParams(final Map<Param, Object> params) {
this.params = params;
}
public boolean isRedundant() {
return isRedundant;
}
public void setRedundant(boolean isRedundant) {
public void setRedundant(final boolean isRedundant) {
this.isRedundant = isRedundant;
}
public DeploymentPlan getPlan() {
return plan;
}
public void setPlan(DeploymentPlan plan) {
public void setPlan(final DeploymentPlan plan) {
this.plan = plan;
}

public boolean isVpcRouter() {
return this.vpc != null;
return vpc != null;
}
public Long getPodId() {
return this.plan.getPodId();
return plan.getPodId();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ public boolean configure(final String name, final Map<String, Object> params) th
public List<DomainRouterVO> deployVirtualRouter(final RouterDeploymentDefinition routerDeploymentDefinition)
throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
return routerDeploymentManager.deployVirtualRouterInVpc(routerDeploymentDefinition);

Vpc vpc = routerDeploymentDefinition.getVpc();
if (vpc != null) {
return routerDeploymentManager.deployVirtualRouterInVpc(routerDeploymentDefinition);
} else {
return super.deployVirtualRouter(routerDeploymentDefinition);
}
}

@Override
Expand Down