mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Aggregate command cleanup is not required for the virtual router as we
already cleanup in the finish. And consequently dies if somebody tries to test with assertions enabled.
This commit is contained in:
parent
56e37243b8
commit
dbc7d80329
@ -361,7 +361,7 @@ public class VirtualRoutingResource {
|
|||||||
|
|
||||||
Queue<NetworkElementCommand> queue = new LinkedBlockingQueue<>();
|
Queue<NetworkElementCommand> queue = new LinkedBlockingQueue<>();
|
||||||
_vrAggregateCommandsSet.put(routerName, queue);
|
_vrAggregateCommandsSet.put(routerName, queue);
|
||||||
return new Answer(cmd);
|
return new Answer(cmd, true, "Command aggregation started");
|
||||||
} else if (action == Action.Finish) {
|
} else if (action == Action.Finish) {
|
||||||
Queue<NetworkElementCommand> queue = _vrAggregateCommandsSet.get(routerName);
|
Queue<NetworkElementCommand> queue = _vrAggregateCommandsSet.get(routerName);
|
||||||
int answerCounts = 0;
|
int answerCounts = 0;
|
||||||
@ -402,20 +402,11 @@ public class VirtualRoutingResource {
|
|||||||
return new Answer(cmd, false, result.getDetails());
|
return new Answer(cmd, false, result.getDetails());
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Answer(cmd);
|
return new Answer(cmd, true, "Command aggregation finished");
|
||||||
} finally {
|
} finally {
|
||||||
queue.clear();
|
queue.clear();
|
||||||
_vrAggregateCommandsSet.remove(routerName);
|
_vrAggregateCommandsSet.remove(routerName);
|
||||||
}
|
}
|
||||||
} else if (action == Action.Cleanup) {
|
|
||||||
assert (_vrAggregateCommandsSet.containsKey(routerName));
|
|
||||||
Queue<NetworkElementCommand> queue = _vrAggregateCommandsSet.get(routerName);
|
|
||||||
if (queue != null) {
|
|
||||||
queue.clear();
|
|
||||||
}
|
|
||||||
_vrAggregateCommandsSet.remove(routerName);
|
|
||||||
|
|
||||||
return new Answer(cmd);
|
|
||||||
}
|
}
|
||||||
return new Answer(cmd, false, "Fail to recongize aggregation action " + action.toString());
|
return new Answer(cmd, false, "Fail to recongize aggregation action " + action.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,26 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.element;
|
package com.cloud.network.element;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.command.admin.router.ConfigureOvsElementCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.router.CreateVirtualRouterElementCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.router.ListOvsElementsCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
|
||||||
|
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||||
|
|
||||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||||
import com.cloud.configuration.ConfigurationManager;
|
import com.cloud.configuration.ConfigurationManager;
|
||||||
import com.cloud.dc.DataCenter;
|
import com.cloud.dc.DataCenter;
|
||||||
@ -81,22 +101,6 @@ import com.cloud.vm.VirtualMachine.State;
|
|||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.cloud.vm.dao.DomainRouterDao;
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
import com.cloud.vm.dao.UserVmDao;
|
import com.cloud.vm.dao.UserVmDao;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import org.apache.cloudstack.api.command.admin.router.ConfigureOvsElementCmd;
|
|
||||||
import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
|
|
||||||
import org.apache.cloudstack.api.command.admin.router.CreateVirtualRouterElementCmd;
|
|
||||||
import org.apache.cloudstack.api.command.admin.router.ListOvsElementsCmd;
|
|
||||||
import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
|
|
||||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import javax.ejb.Local;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Local(value = {NetworkElement.class, FirewallServiceProvider.class,
|
@Local(value = {NetworkElement.class, FirewallServiceProvider.class,
|
||||||
DhcpServiceProvider.class, UserDataServiceProvider.class,
|
DhcpServiceProvider.class, UserDataServiceProvider.class,
|
||||||
@ -287,7 +291,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
int i = Integer.parseInt(number);
|
Integer.parseInt(number);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -323,21 +327,14 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else if (StickinessMethodType.AppCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName())) {
|
} else if (StickinessMethodType.AppCookieBased.getName().equalsIgnoreCase(stickinessPolicy.getMethodName())) {
|
||||||
/*
|
|
||||||
* FORMAT : appsession <cookie> len <length> timeout <holdtime>
|
|
||||||
* [request-learn] [prefix] [mode
|
|
||||||
* <path-parameters|query-string>]
|
|
||||||
*/
|
|
||||||
/* example: appsession JSESSIONID len 52 timeout 3h */
|
|
||||||
String cookieName = null; // optional
|
|
||||||
String length = null; // optional
|
String length = null; // optional
|
||||||
String holdTime = null; // optional
|
String holdTime = null; // optional
|
||||||
|
|
||||||
for (Pair<String, String> paramKV : paramsList) {
|
for (Pair<String, String> paramKV : paramsList) {
|
||||||
String key = paramKV.first();
|
String key = paramKV.first();
|
||||||
String value = paramKV.second();
|
String value = paramKV.second();
|
||||||
if ("cookie-name".equalsIgnoreCase(key))
|
if ("cookie-name".equalsIgnoreCase(key)) {
|
||||||
cookieName = value;
|
}
|
||||||
if ("length".equalsIgnoreCase(key))
|
if ("length".equalsIgnoreCase(key))
|
||||||
length = value;
|
length = value;
|
||||||
if ("holdtime".equalsIgnoreCase(key))
|
if ("holdtime".equalsIgnoreCase(key))
|
||||||
@ -1118,12 +1115,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean cleanupAggregatedExecution(Network network, DeployDestination dest) throws ResourceUnavailableException {
|
public boolean cleanupAggregatedExecution(Network network, DeployDestination dest) throws ResourceUnavailableException {
|
||||||
List<DomainRouterVO> routers = getRouters(network, dest);
|
// The VR code already cleansup in the Finish routine using finally, lets not waste another command
|
||||||
|
return true;
|
||||||
if ((routers == null) || (routers.size() == 0)) {
|
|
||||||
throw new ResourceUnavailableException("Can't find at least one router!", DataCenter.class, network.getDataCenterId());
|
|
||||||
}
|
|
||||||
|
|
||||||
return _routerMgr.cleanupAggregatedExecution(network, routers);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,11 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.network.router;
|
package com.cloud.network.router;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||||
|
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
import com.cloud.exception.AgentUnavailableException;
|
import com.cloud.exception.AgentUnavailableException;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
@ -35,10 +40,6 @@ import com.cloud.utils.component.Manager;
|
|||||||
import com.cloud.vm.DomainRouterVO;
|
import com.cloud.vm.DomainRouterVO;
|
||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NetworkManager manages the network for the different end users.
|
* NetworkManager manages the network for the different end users.
|
||||||
@ -137,6 +138,4 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
|
|||||||
public boolean prepareAggregatedExecution(Network network, List<DomainRouterVO> routers) throws AgentUnavailableException;
|
public boolean prepareAggregatedExecution(Network network, List<DomainRouterVO> routers) throws AgentUnavailableException;
|
||||||
|
|
||||||
public boolean completeAggregatedExecution(Network network, List<DomainRouterVO> routers) throws AgentUnavailableException;
|
public boolean completeAggregatedExecution(Network network, List<DomainRouterVO> routers) throws AgentUnavailableException;
|
||||||
|
|
||||||
public boolean cleanupAggregatedExecution(Network network, List<DomainRouterVO> routers) throws AgentUnavailableException;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4464,8 +4464,4 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine.
|
|||||||
return aggregationExecution(Action.Finish, network, routers);
|
return aggregationExecution(Action.Finish, network, routers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean cleanupAggregatedExecution(Network network, List<DomainRouterVO> routers) throws AgentUnavailableException {
|
|
||||||
return aggregationExecution(Action.Cleanup, network, routers);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,17 @@
|
|||||||
|
|
||||||
package com.cloud.vpc;
|
package com.cloud.vpc;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.ejb.Local;
|
||||||
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
|
||||||
|
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
|
||||||
|
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
import com.cloud.exception.AgentUnavailableException;
|
import com.cloud.exception.AgentUnavailableException;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
@ -44,14 +55,6 @@ import com.cloud.vm.DomainRouterVO;
|
|||||||
import com.cloud.vm.NicProfile;
|
import com.cloud.vm.NicProfile;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.cloud.vm.VirtualMachineProfile.Param;
|
import com.cloud.vm.VirtualMachineProfile.Param;
|
||||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
|
|
||||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.ejb.Local;
|
|
||||||
import javax.naming.ConfigurationException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Local(value = {VpcVirtualNetworkApplianceManager.class, VpcVirtualNetworkApplianceService.class})
|
@Local(value = {VpcVirtualNetworkApplianceManager.class, VpcVirtualNetworkApplianceService.class})
|
||||||
@ -428,11 +431,6 @@ public class MockVpcVirtualNetworkApplianceManager extends ManagerBase implement
|
|||||||
return true; //To change body of implemented methods use File | Settings | File Templates.
|
return true; //To change body of implemented methods use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean cleanupAggregatedExecution(Network network, List<DomainRouterVO> routers) throws AgentUnavailableException {
|
|
||||||
return true; //To change body of implemented methods use File | Settings | File Templates.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startRemoteAccessVpn(RemoteAccessVpn vpn, VirtualRouter router) throws ResourceUnavailableException {
|
public boolean startRemoteAccessVpn(RemoteAccessVpn vpn, VirtualRouter router) throws ResourceUnavailableException {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user