mirror of https://github.com/apache/cloudstack.git
Add parameter to ListPublicIpAddressCmd : forloadbalancing
This commit is contained in:
parent
a6b1453254
commit
1471b0a97a
|
|
@ -247,4 +247,5 @@ public class ApiConstants {
|
|||
public static final String SNAPSHOT_RESERVATION = "snapshotreservation";
|
||||
public static final String REDUNDANT_ROUTER = "redundantrouter";
|
||||
public static final String IP_NETWORK_LIST = "iptonetworklist";
|
||||
public static final String FOR_LOAD_BALANCING = "forloadbalancing";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ public class ListPublicIpAddressesCmd extends BaseListCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="lists all public IP addresses by Zone ID")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.FOR_LOAD_BALANCING, type=CommandType.BOOLEAN, description="list only ips used for load balancing")
|
||||
private Boolean forLoadBalancing;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -128,5 +131,34 @@ public class ListPublicIpAddressesCmd extends BaseListCmd {
|
|||
|
||||
public AsyncJob.Type getInstanceType() {
|
||||
return AsyncJob.Type.IpAddress;
|
||||
}
|
||||
|
||||
|
||||
public Boolean isForLoadBalancing() {
|
||||
return forLoadBalancing;
|
||||
}
|
||||
|
||||
public Boolean getAllocatedOnly() {
|
||||
return allocatedOnly;
|
||||
}
|
||||
|
||||
public void setAllocatedOnly(Boolean allocatedOnly) {
|
||||
this.allocatedOnly = allocatedOnly;
|
||||
}
|
||||
|
||||
public Boolean getForVirtualNetwork() {
|
||||
return forVirtualNetwork;
|
||||
}
|
||||
|
||||
public void setForVirtualNetwork(Boolean forVirtualNetwork) {
|
||||
this.forVirtualNetwork = forVirtualNetwork;
|
||||
}
|
||||
|
||||
public Boolean getForLoadBalancing() {
|
||||
return forLoadBalancing;
|
||||
}
|
||||
|
||||
public void setForLoadBalancing(Boolean forLoadBalancing) {
|
||||
this.forLoadBalancing = forLoadBalancing;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,8 +174,10 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
|||
import com.cloud.info.ConsoleProxyInfo;
|
||||
import com.cloud.keystore.KeystoreManager;
|
||||
import com.cloud.network.IPAddressVO;
|
||||
import com.cloud.network.LoadBalancerVO;
|
||||
import com.cloud.network.NetworkVO;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.network.dao.LoadBalancerDao;
|
||||
import com.cloud.network.dao.NetworkDao;
|
||||
import com.cloud.network.security.SecurityGroupVO;
|
||||
import com.cloud.network.security.dao.SecurityGroupDao;
|
||||
|
|
@ -325,6 +327,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
private final UploadMonitor _uploadMonitor;
|
||||
private final UploadDao _uploadDao;
|
||||
private final SSHKeyPairDao _sshKeyPairDao;
|
||||
private final LoadBalancerDao _loadbalancerDao;
|
||||
|
||||
private final KeystoreManager _ksMgr;
|
||||
|
||||
|
|
@ -338,7 +341,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
|
||||
private String _hashKey = null;
|
||||
|
||||
protected ManagementServerImpl() {
|
||||
public ManagementServerImpl() {
|
||||
ComponentLocator locator = ComponentLocator.getLocator(Name);
|
||||
_configDao = locator.getDao(ConfigurationDao.class);
|
||||
_routerDao = locator.getDao(DomainRouterDao.class);
|
||||
|
|
@ -354,6 +357,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
_clusterDao = locator.getDao(ClusterDao.class);
|
||||
_nicDao = locator.getDao(NicDao.class);
|
||||
_networkDao = locator.getDao(NetworkDao.class);
|
||||
_loadbalancerDao = locator.getDao(LoadBalancerDao.class);
|
||||
|
||||
_accountMgr = locator.getManager(AccountManager.class);
|
||||
_agentMgr = locator.getManager(AgentManager.class);
|
||||
|
|
@ -2489,6 +2493,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
Object address = cmd.getIpAddress();
|
||||
Object vlan = cmd.getVlanId();
|
||||
Object forVirtualNetwork = cmd.isForVirtualNetwork();
|
||||
Object forLoadBalancing = cmd.isForLoadBalancing();
|
||||
Object ipId = cmd.getId();
|
||||
|
||||
SearchBuilder<IPAddressVO> sb = _publicIpAddressDao.createSearchBuilder();
|
||||
|
|
@ -2504,6 +2509,11 @@ public class ManagementServerImpl implements ManagementServer {
|
|||
domainSearch.and("path", domainSearch.entity().getPath(), SearchCriteria.Op.LIKE);
|
||||
sb.join("domainSearch", domainSearch, sb.entity().getAllocatedInDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
}
|
||||
|
||||
if (forLoadBalancing != null && (Boolean)forLoadBalancing) {
|
||||
SearchBuilder<LoadBalancerVO> lbSearch = _loadbalancerDao.createSearchBuilder();
|
||||
sb.join("lbSearch", lbSearch, sb.entity().getId(), lbSearch.entity().getSourceIpAddressId(), JoinType.INNER);
|
||||
}
|
||||
|
||||
if (keyword != null && address == null) {
|
||||
sb.and("addressLIKE", sb.entity().getAddress(), SearchCriteria.Op.LIKE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue