mirror of https://github.com/apache/cloudstack.git
bug 11307: Add destroyRouter command
This commit is contained in:
parent
684a603a6e
commit
474d1a6034
|
|
@ -52,5 +52,6 @@ public interface VirtualNetworkApplianceService{
|
|||
VirtualRouter stopRouter(long routerId, boolean forced) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
VirtualRouter startRouter(StartRouterCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException;
|
||||
|
||||
|
||||
VirtualRouter destroyRouter(long routerId) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ updateLoadBalancerRule=com.cloud.api.commands.UpdateLoadBalancerRuleCmd;15
|
|||
startRouter=com.cloud.api.commands.StartRouterCmd;7
|
||||
rebootRouter=com.cloud.api.commands.RebootRouterCmd;7
|
||||
stopRouter=com.cloud.api.commands.StopRouterCmd;7
|
||||
destroyRouter=com.cloud.api.commands.DestroyRouterCmd;7
|
||||
changeServiceForRouter=com.cloud.api.commands.UpgradeRouterCmd;7
|
||||
listRouters=com.cloud.api.commands.ListRoutersCmd;7
|
||||
|
||||
|
|
@ -277,4 +278,4 @@ listFirewallRules=com.cloud.api.commands.ListFirewallRulesCmd;15
|
|||
|
||||
#### hypervisor capabilities commands
|
||||
updateHypervisorCapabilities=com.cloud.api.commands.UpdateHypervisorCapabilitiesCmd;1
|
||||
listHypervisorCapabilities=com.cloud.api.commands.ListHypervisorCapabilitiesCmd;1
|
||||
listHypervisorCapabilities=com.cloud.api.commands.ListHypervisorCapabilitiesCmd;1
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ public class DhcpElement extends AdapterBase implements NetworkElement, Password
|
|||
}
|
||||
boolean result = true;
|
||||
for (DomainRouterVO router : routers) {
|
||||
result = result && _routerMgr.destroyRouter(router.getId());
|
||||
result = result && (_routerMgr.destroyRouter(router.getId()) != null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public class VirtualRouterElement extends DhcpElement implements NetworkElement,
|
|||
if (router.getState() != State.Stopped || _routerMgr.stopRouter(router.getId(), false) == null) {
|
||||
s_logger.warn("Failed to stop virtual router element " + router + " as a part of network " + network + " restart");
|
||||
}
|
||||
if (!_routerMgr.destroyRouter(router.getId())) {
|
||||
if (_routerMgr.destroyRouter(router.getId()) == null) {
|
||||
s_logger.warn("Failed to destroy virtual router element " + router + " as a part of network " + network + " restart");
|
||||
}
|
||||
}
|
||||
|
|
@ -361,7 +361,7 @@ public class VirtualRouterElement extends DhcpElement implements NetworkElement,
|
|||
}
|
||||
boolean result = true;
|
||||
for (DomainRouterVO router : routers) {
|
||||
result = result && _routerMgr.destroyRouter(router.getId());
|
||||
result = result && (_routerMgr.destroyRouter(router.getId()) != null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,6 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
|
|||
*/
|
||||
boolean savePasswordToRouter(Network network, NicProfile nic, VirtualMachineProfile<UserVm> profile, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;
|
||||
|
||||
boolean destroyRouter(long routerId) throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
boolean getRouterStatistics(long vmId, Map<String, long[]> netStats, Map<String, long[]> diskStats);
|
||||
|
||||
List<DomainRouterVO> getRouters(long accountId, long zoneId);
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean destroyRouter(final long routerId) throws ResourceUnavailableException, ConcurrentOperationException {
|
||||
public VirtualRouter destroyRouter(final long routerId) throws ResourceUnavailableException, ConcurrentOperationException {
|
||||
UserContext context = UserContext.current();
|
||||
User user = _accountMgr.getActiveUser(context.getCallerUserId());
|
||||
|
||||
|
|
@ -364,11 +364,14 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
|
||||
DomainRouterVO router = _routerDao.findById(routerId);
|
||||
if (router == null) {
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
boolean result = _itMgr.expunge(router, user, _accountMgr.getAccount(router.getAccountId()));
|
||||
|
||||
return result;
|
||||
if (result) {
|
||||
return router;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue