Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface PrivateIpDao extends GenericDao<PrivateIpVO, Long> {
* @param requestedIp TODO
* @return
*/
PrivateIpVO allocateIpAddress(long dcId, long networkId, String requestedIp);
PrivateIpVO allocateIpAddress(long dcId, long networkId, Long vpcId, String requestedIp);

/**
* @param ipAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ protected PrivateIpDaoImpl() {
}

@Override
public PrivateIpVO allocateIpAddress(long dcId, long networkId, String requestedIp) {
public PrivateIpVO allocateIpAddress(long dcId, long networkId, final Long vpcId, String requestedIp) {
SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
sc.setParameters("networkId", networkId);
sc.setParameters("taken", (Date)null);

if (vpcId != null) {
sc.setParameters("vpc_id", vpcId);
}
if (requestedIp != null) {
sc.setParameters("ipAddress", requestedIp);
}
Expand Down
9 changes: 0 additions & 9 deletions server/src/com/cloud/network/NetworkServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1878,15 +1878,6 @@ public boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws Con
+ Network.State.Setup);
}

if (network.getBroadcastDomainType() == BroadcastDomainType.Lswitch) {
/**
* Unable to restart these networks now.
* TODO Restarting a SDN based network requires updating the nics and the configuration
* in the controller. This requires a non-trivial rewrite of the restart procedure.
*/
throw new InvalidParameterException("Unable to restart a running SDN network.");
}

_accountMgr.checkAccess(callerAccount, null, true, network);

boolean success = _networkMgr.restartNetwork(networkId, callerAccount, callerUser, cleanup);
Expand Down
2 changes: 1 addition & 1 deletion server/src/com/cloud/network/guru/PrivateNetworkGuru.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfil

protected void getIp(NicProfile nic, DataCenter dc, Network network) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
if (nic.getIp4Address() == null) {
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(network.getDataCenterId(), network.getId(), null);
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(network.getDataCenterId(), network.getVpcId(), network.getId(), null);
String vlanTag = BroadcastDomainType.getValue(network.getBroadcastUri());
String netmask = NetUtils.getCidrNetmask(network.getCidr());
PrivateIpAddress ip =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ protected LinkedHashMap<Network, List<? extends NicProfile>> createVpcRouterNetw
@DB
protected NicProfile createPrivateNicProfileForGateway(VpcGateway privateGateway) {
Network privateNetwork = _networkModel.getNetwork(privateGateway.getNetworkId());
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), privateNetwork.getId(), privateGateway.getIp4Address());
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), privateNetwork.getId(), privateGateway.getVpcId(), privateGateway.getIp4Address());
Nic privateNic = _nicDao.findByIp4AddressAndNetworkId(ipVO.getIpAddress(), privateNetwork.getId());

NicProfile privateNicProfile = new NicProfile();
Expand Down