Skip to content

Commit 739f7ca

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 0984594 commit 739f7ca

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
@@ -51,6 +51,7 @@
5151
import com.cloud.network.IpAddress;
5252
import com.cloud.network.Network;
5353
import com.cloud.network.vpc.Vpc;
54+
import com.cloud.offering.NetworkOffering;
5455
import com.cloud.projects.Project;
5556
import com.cloud.user.Account;
5657

@@ -211,6 +212,20 @@ public long getEntityOwnerId() {
211212
}
212213
} else if (networkId != null){
213214
Network network = _networkService.getNetwork(networkId);
215+
if (network == null) {
216+
throw new InvalidParameterValueException("Unable to find network by network id specified");
217+
}
218+
219+
NetworkOffering offering = _configService.getNetworkOffering(network.getNetworkOfferingId());
220+
221+
DataCenter zone = _configService.getZone(network.getDataCenterId());
222+
if (zone.getNetworkType() == NetworkType.Basic && offering.getElasticIp() && offering.getElasticLb()) {
223+
// Since the basic zone network is owned by 'Root' domain, domain access checkers will fail for the
224+
// accounts in non-root domains while acquiring public IP. So add an exception for the 'Basic' zone
225+
// shared network with EIP/ELB service.
226+
return caller.getAccountId();
227+
}
228+
214229
return network.getAccountId();
215230
} else if (vpcId != null) {
216231
Vpc vpc = _vpcService.getVpc(getVpcId());

0 commit comments

Comments
 (0)