Skip to content

Commit f4e9282

Browse files
committed
CLOUDSTACK-3764: [EIP/ELB] [BasicZone] Unable acquire IP as non-ROOT
domain users Since the basic zone network is owned by 'Root' domain, domain access checkers will fail for the accounts in non-root domains while acquiring public IP. So add an exception for the 'Basic' zone shared network with EIP/ELB service.
1 parent 34f75b0 commit f4e9282

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import com.cloud.network.IpAddress;
5050
import com.cloud.network.Network;
5151
import com.cloud.network.vpc.Vpc;
52+
import com.cloud.offering.NetworkOffering;
5253
import com.cloud.projects.Project;
5354
import com.cloud.user.Account;
5455
import com.cloud.user.UserContext;
@@ -210,6 +211,20 @@ public long getEntityOwnerId() {
210211
}
211212
} else if (networkId != null){
212213
Network network = _networkService.getNetwork(networkId);
214+
if (network == null) {
215+
throw new InvalidParameterValueException("Unable to find network by network id specified");
216+
}
217+
218+
NetworkOffering offering = _configService.getNetworkOffering(network.getNetworkOfferingId());
219+
220+
DataCenter zone = _configService.getZone(network.getDataCenterId());
221+
if (zone.getNetworkType() == NetworkType.Basic && offering.getElasticIp() && offering.getElasticLb()) {
222+
// Since the basic zone network is owned by 'Root' domain, domain access checkers will fail for the
223+
// accounts in non-root domains while acquiring public IP. So add an exception for the 'Basic' zone
224+
// shared network with EIP/ELB service.
225+
return caller.getAccountId();
226+
}
227+
213228
return network.getAccountId();
214229
} else if (vpcId != null) {
215230
Vpc vpc = _vpcService.getVpc(getVpcId());

0 commit comments

Comments
 (0)