Skip to content

Commit 6544820

Browse files
committed
Moved networkRestart to the NetworkManager as it's up to the manager (not network elements) to decide what to do on restart (IpAssoc/ruleApply/etc..)
1 parent a21ce17 commit 6544820

26 files changed

Lines changed: 348 additions & 165 deletions

api/src/com/cloud/api/commands/CreateIpForwardingRuleCmd.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ public long getNetworkId() {
191191

192192
@Override
193193
public long getDomainId() {
194-
throw new UnsupportedOperationException("Don't call me");
194+
IpAddress ip = _networkService.getIp(ipAddressId);
195+
return ip.getDomainId();
195196
}
196197

197198
@Override
@@ -215,7 +216,8 @@ public int getDestinationPortEnd() {
215216

216217
@Override
217218
public long getAccountId() {
218-
throw new UnsupportedOperationException("Get the account id from network");
219+
IpAddress ip = _networkService.getIp(ipAddressId);
220+
return ip.getAccountId();
219221
}
220222

221223
@Override

api/src/com/cloud/api/commands/CreatePortForwardingRuleCmd.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.cloud.event.EventTypes;
3131
import com.cloud.exception.NetworkRuleConflictException;
3232
import com.cloud.exception.ResourceUnavailableException;
33+
import com.cloud.network.IpAddress;
3334
import com.cloud.network.rules.PortForwardingRule;
3435
import com.cloud.user.Account;
3536
import com.cloud.user.UserContext;
@@ -175,7 +176,8 @@ public long getEntityOwnerId() {
175176

176177
@Override
177178
public long getDomainId() {
178-
throw new UnsupportedOperationException("Get the domain id from network");
179+
IpAddress ip = _networkService.getIp(ipAddressId);
180+
return ip.getDomainId();
179181
}
180182

181183
@Override
@@ -217,7 +219,8 @@ public String getEventDescription() {
217219

218220
@Override
219221
public long getAccountId() {
220-
throw new UnsupportedOperationException("Get the account id from network");
222+
IpAddress ip = _networkService.getIp(ipAddressId);
223+
return ip.getAccountId();
221224
}
222225

223226
@Override

api/src/com/cloud/api/commands/DisassociateIPAddrCmd.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ public class DisassociateIPAddrCmd extends BaseCmd {
3636
//////////////// API parameters /////////////////////
3737
/////////////////////////////////////////////////////
3838

39-
@Parameter(name=ApiConstants.IP_ADDRESS_ID, type=CommandType.LONG, required=true, description="the id of the public ip address to disassociate")
40-
private Long ipAddressId;
39+
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the id of the public ip address to disassociate")
40+
private Long id;
4141

4242
/////////////////////////////////////////////////////
4343
/////////////////// Accessors ///////////////////////
4444
/////////////////////////////////////////////////////
4545

4646
public Long getIpAddressId() {
47-
return ipAddressId;
47+
return id;
4848
}
4949

5050
/////////////////////////////////////////////////////

api/src/com/cloud/api/commands/RebootRouterCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public Long getInstanceId() {
9595

9696
@Override
9797
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
98-
VirtualRouter result = _routerService.rebootRouter(this.getId());
98+
VirtualRouter result = _routerService.rebootRouter(this.getId(), true);
9999
if (result != null){
100100
DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
101101
response.setResponseName("router");

api/src/com/cloud/api/commands/StartRouterCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public Long getInstanceId() {
101101

102102
@Override
103103
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
104-
VirtualRouter result = _routerService.startRouter(this.getId());
104+
VirtualRouter result = _routerService.startRouter(this.getId(), true);
105105
if (result != null){
106106
DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result);
107107
routerResponse.setResponseName(getCommandName());

api/src/com/cloud/network/VirtualNetworkApplianceService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ public interface VirtualNetworkApplianceService{
3232
* @return DomainRouter object
3333
* @throws InvalidParameterValueException, PermissionDeniedException
3434
*/
35-
VirtualRouter startRouter(long routerId) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
35+
VirtualRouter startRouter(long routerId, boolean restartNetwork) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
3636

3737
/**
3838
* Reboots domain router
3939
* @param cmd the command specifying router's id
4040
* @return router if successful
4141
* @throws InvalidParameterValueException, PermissionDeniedException
4242
*/
43-
VirtualRouter rebootRouter(long routerId) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
43+
VirtualRouter rebootRouter(long routerId, boolean restartNetwork) throws InvalidParameterValueException, PermissionDeniedException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
4444

4545
VirtualRouter upgradeRouter(UpgradeRouterCmd cmd);
4646

api/src/com/cloud/network/vpn/RemoteAccessVpnService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ public interface RemoteAccessVpnService {
4040

4141
List<? extends RemoteAccessVpn> searchForRemoteAccessVpns(ListRemoteAccessVpnsCmd cmd);
4242
List<? extends VpnUser> searchForVpnUsers(ListVpnUsersCmd cmd);
43+
44+
List<? extends RemoteAccessVpn> listRemoteAccessVpns(long networkId);
4345

4446
}

api/src/com/cloud/vm/VirtualMachineProfile.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.cloud.vm;
1919

2020
import java.util.List;
21+
import java.util.Map;
2122

2223
import com.cloud.agent.api.to.VolumeTO;
2324
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@@ -43,6 +44,7 @@ public interface VirtualMachineProfile<T extends VirtualMachine> {
4344
enum Param {
4445
VmPassword,
4546
ControlNic,
47+
RestartNetwork,
4648
}
4749

4850
String getHostName();
@@ -115,4 +117,6 @@ enum Param {
115117

116118
void setBootLoaderType(BootloaderType bootLoader);
117119
BootloaderType getBootLoaderType();
120+
121+
Map<Param, Object> getParameters();
118122
}

0 commit comments

Comments
 (0)