mirror of https://github.com/apache/cloudstack.git
Internal Lb: list internal lb vms as a part of listRouters response. Introduced new parameter - role (can be virtual_router or internal_lb_vm)
This commit is contained in:
parent
c113ea184b
commit
bb73531fed
|
|
@ -28,6 +28,7 @@ import java.util.regex.Pattern;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
||||
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
|
|
@ -139,6 +140,8 @@ public abstract class BaseCmd {
|
|||
@Inject public NetworkModel _ntwkModel;
|
||||
@Inject public ApplicationLoadBalancerService _appLbService;
|
||||
@Inject public AffinityGroupService _affinityGroupService;
|
||||
@Inject public InternalLoadBalancerElementService _internalLbSvs;
|
||||
|
||||
|
||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.FOR_VPC, type=CommandType.BOOLEAN, description="if true is passed for this parameter, list only VPC routers")
|
||||
private Boolean forVpc;
|
||||
|
||||
@Parameter(name=ApiConstants.ROLE, type=CommandType.STRING, description="list routers by role (Virtual_router or Internal_lb_vm)")
|
||||
private String role;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -114,6 +117,10 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
|
|||
public Boolean getForVpc() {
|
||||
return forVpc;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
|
|
|||
|
|
@ -150,8 +150,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
@SerializedName("scriptsversion") @Param(description="the version of scripts")
|
||||
private String scriptsVersion;
|
||||
|
||||
@SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the network belongs to")
|
||||
@SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the router belongs to")
|
||||
private String vpcId;
|
||||
|
||||
@SerializedName(ApiConstants.ROLE) @Param(description="role of the domain router")
|
||||
private String role;
|
||||
|
||||
@SerializedName("nic") @Param(description="the list of nics associated with the router",
|
||||
responseObject = NicResponse.class, since="4.0")
|
||||
|
|
@ -161,15 +164,11 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
nics = new LinkedHashSet<NicResponse>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -361,4 +360,8 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView
|
|||
public void setIp6Dns2(String ip6Dns2) {
|
||||
this.ip6Dns2 = ip6Dns2;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ import com.cloud.network.element.NetworkElement;
|
|||
import com.cloud.network.element.VirtualRouterElement;
|
||||
import com.cloud.network.element.VirtualRouterProviderVO;
|
||||
import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.router.VirtualRouter.Role;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.network.rules.LoadBalancerContainer;
|
||||
|
|
@ -169,12 +170,12 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
|
||||
@Override
|
||||
public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
List<DomainRouterVO> internalLbVms = _routerDao.listByNetworkAndRole(network.getId(), Role.INTERNAL_LB_VM);
|
||||
List<? extends VirtualRouter> internalLbVms = _routerDao.listByNetworkAndRole(network.getId(), Role.INTERNAL_LB_VM);
|
||||
if (internalLbVms == null || internalLbVms.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
boolean result = true;
|
||||
for (DomainRouterVO internalLbVm : internalLbVms) {
|
||||
for (VirtualRouter internalLbVm : internalLbVms) {
|
||||
result = result && _internalLbMgr.destroyInternalLbVm(internalLbVm.getId(),
|
||||
context.getAccount(), context.getCaller().getId());
|
||||
if (cleanup) {
|
||||
|
|
@ -193,12 +194,12 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
|
||||
@Override
|
||||
public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
List<DomainRouterVO> internalLbVms = _routerDao.listByNetworkAndRole(network.getId(), Role.INTERNAL_LB_VM);
|
||||
List<? extends VirtualRouter> internalLbVms = _routerDao.listByNetworkAndRole(network.getId(), Role.INTERNAL_LB_VM);
|
||||
if (internalLbVms == null || internalLbVms.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
boolean result = true;
|
||||
for (DomainRouterVO internalLbVm : internalLbVms) {
|
||||
for (VirtualRouter internalLbVm : internalLbVms) {
|
||||
result = result && (_internalLbMgr.destroyInternalLbVm(internalLbVm.getId(),
|
||||
context.getAccount(), context.getCaller().getId()));
|
||||
}
|
||||
|
|
@ -259,7 +260,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
for (Ip sourceIp : rulesToApply.keySet()) {
|
||||
if (vmsToDestroy.contains(sourceIp)) {
|
||||
//2.1 Destroy internal lb vm
|
||||
List<DomainRouterVO> vms = _internalLbMgr.findInternalLbVms(network.getId(), sourceIp);
|
||||
List<? extends VirtualRouter> vms = _internalLbMgr.findInternalLbVms(network.getId(), sourceIp);
|
||||
//only one internal lb per IP exists
|
||||
try {
|
||||
s_logger.debug("Destroying internal lb vm for ip " + sourceIp.addr() + " as all the rules for this vm are in Revoke state");
|
||||
|
|
@ -271,7 +272,7 @@ public class InternalLoadBalancerElement extends AdapterBase implements LoadBala
|
|||
}
|
||||
} else {
|
||||
//2.2 Start Internal LB vm per IP address
|
||||
List<DomainRouterVO> internalLbVms;
|
||||
List<? extends VirtualRouter> internalLbVms;
|
||||
try {
|
||||
DeployDestination dest = new DeployDestination(_configMgr.getZone(network.getDataCenterId()), null, null, null);
|
||||
internalLbVms = _internalLbMgr.deployInternalLbVm(network, sourceIp, dest, _accountMgr.getAccount(network.getAccountId()), null);
|
||||
|
|
|
|||
|
|
@ -23,15 +23,12 @@ import com.cloud.deploy.DeployDestination;
|
|||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.lb.LoadBalancingRule;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
import com.cloud.vm.VirtualMachineProfile.Param;
|
||||
|
||||
public interface InternalLoadBalancerManager extends Manager{
|
||||
|
|
@ -46,20 +43,6 @@ public interface InternalLoadBalancerManager extends Manager{
|
|||
*/
|
||||
boolean destroyInternalLbVm(long vmId, Account caller, Long callerUserId)
|
||||
throws ResourceUnavailableException, ConcurrentOperationException;
|
||||
|
||||
|
||||
/**
|
||||
* Stops Internal lb vm
|
||||
* @param vmId
|
||||
* @param forced
|
||||
* @param caller
|
||||
* @param callerUserId
|
||||
* @return
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
VirtualRouter stopInternalLbVm(long vmId, boolean forced, Account caller, Long callerUserId)
|
||||
throws ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -74,27 +57,11 @@ public interface InternalLoadBalancerManager extends Manager{
|
|||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
List<DomainRouterVO> deployInternalLbVm(Network guestNetwork, Ip requestedGuestIp, DeployDestination dest, Account owner,
|
||||
List<? extends VirtualRouter> deployInternalLbVm(Network guestNetwork, Ip requestedGuestIp, DeployDestination dest, Account owner,
|
||||
Map<Param, Object> params) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException;
|
||||
|
||||
|
||||
/**
|
||||
* Starts Internal lb vm
|
||||
* @param internalLbVm
|
||||
* @param user
|
||||
* @param caller
|
||||
* @param params
|
||||
* @return
|
||||
* @throws StorageUnavailableException
|
||||
* @throws InsufficientCapacityException
|
||||
* @throws ConcurrentOperationException
|
||||
* @throws ResourceUnavailableException
|
||||
*/
|
||||
DomainRouterVO startInternalLbVm(DomainRouterVO internalLbVm, User user, Account caller, Map<Param, Object> params)
|
||||
throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException,
|
||||
ResourceUnavailableException;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -114,6 +81,6 @@ public interface InternalLoadBalancerManager extends Manager{
|
|||
* @param requestedGuestIp
|
||||
* @return
|
||||
*/
|
||||
List<DomainRouterVO> findInternalLbVms(long guestNetworkId, Ip requestedGuestIp);
|
||||
List<? extends VirtualRouter> findInternalLbVms(long guestNetworkId, Ip requestedGuestIp);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.network.lb;
|
||||
|
||||
import java.lang.Thread.State;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
|
@ -57,6 +56,7 @@ import com.cloud.exception.ConcurrentOperationException;
|
|||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InsufficientServerCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.exception.StorageUnavailableException;
|
||||
|
|
@ -117,7 +117,7 @@ import com.cloud.vm.dao.DomainRouterDao;
|
|||
import com.cloud.vm.dao.NicDao;
|
||||
|
||||
@Component
|
||||
@Local(value = { InternalLoadBalancerManager.class })
|
||||
@Local(value = { InternalLoadBalancerManager.class})
|
||||
public class InternalLoadBalancerManagerImpl extends ManagerBase implements
|
||||
InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
||||
private static final Logger s_logger = Logger
|
||||
|
|
@ -539,8 +539,8 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
return _itMgr.expunge(internalLbVm, _accountMgr.getActiveUser(callerUserId), caller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualRouter stopInternalLbVm(long vmId, boolean forced, Account caller, Long callerUserId) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
|
||||
protected VirtualRouter stopInternalLbVm(long vmId, boolean forced, Account caller, long callerUserId) throws ConcurrentOperationException, ResourceUnavailableException {
|
||||
DomainRouterVO internalLbVm = _routerDao.findById(vmId);
|
||||
if (internalLbVm == null) {
|
||||
return null;
|
||||
|
|
@ -579,7 +579,7 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
|
||||
for (DomainRouterVO internalLbVm : internalLbVms) {
|
||||
if (internalLbVm.getState() != VirtualMachine.State.Running) {
|
||||
internalLbVm = startInternalLbVm(internalLbVm, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), params);
|
||||
internalLbVm = startInternalLbVm(internalLbVm, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), User.UID_SYSTEM, params);
|
||||
}
|
||||
|
||||
if (internalLbVm != null) {
|
||||
|
|
@ -686,7 +686,7 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
s_logger.debug("Adding nic for Internal LB vm in Control network ");
|
||||
List<? extends NetworkOffering> offerings = _ntwkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork);
|
||||
NetworkOffering controlOffering = offerings.get(0);
|
||||
NetworkVO controlConfig = _ntwkMgr.setupNetwork(_accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM), controlOffering, plan, null, null, false).get(0);
|
||||
NetworkVO controlConfig = _ntwkMgr.setupNetwork(_accountMgr.getSystemAccount(), controlOffering, plan, null, null, false).get(0);
|
||||
networks.add(new Pair<NetworkVO, NicProfile>(controlConfig, null));
|
||||
|
||||
return networks;
|
||||
|
|
@ -769,14 +769,14 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
|
||||
if (startVm) {
|
||||
try {
|
||||
internalLbVm = startInternalLbVm(internalLbVm, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), params);
|
||||
internalLbVm = startInternalLbVm(internalLbVm, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), User.UID_SYSTEM, params);
|
||||
break;
|
||||
} catch (InsufficientCapacityException ex) {
|
||||
if (startRetry < 2 && iter.hasNext()) {
|
||||
s_logger.debug("Failed to start the Internal lb vm " + internalLbVm + " with hypervisor type " + hType + ", " +
|
||||
"destroying it and recreating one more time");
|
||||
// destroy the internal lb vm
|
||||
destroyInternalLbVm(internalLbVm.getId(), _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM), User.UID_SYSTEM);
|
||||
destroyInternalLbVm(internalLbVm.getId(), _accountMgr.getSystemAccount(), User.UID_SYSTEM);
|
||||
continue;
|
||||
} else {
|
||||
throw ex;
|
||||
|
|
@ -793,10 +793,10 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DomainRouterVO startInternalLbVm(DomainRouterVO internalLbVm, User user, Account caller, Map<Param, Object> params)
|
||||
|
||||
protected DomainRouterVO startInternalLbVm(DomainRouterVO internalLbVm, User user, Account caller, long callerUserId, Map<Param, Object> params)
|
||||
throws StorageUnavailableException, InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
s_logger.debug("Starting Internal LB VM " + internalLbVm);
|
||||
if (_itMgr.start(internalLbVm, params, user, caller, null) != null) {
|
||||
if (internalLbVm.isStopPending()) {
|
||||
|
|
@ -887,4 +887,15 @@ InternalLoadBalancerManager, VirtualMachineGuru<DomainRouterVO> {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
protected VirtualRouter startInternalLbVm(long vmId, Account caller, long callerUserId) throws StorageUnavailableException, InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
DomainRouterVO vm = _routerDao.findById(vmId);
|
||||
if (vm == null || vm.getRole() != VirtualRouter.Role.INTERNAL_LB_VM) {
|
||||
throw new InvalidParameterValueException("Unable to find internal lb vm by id");
|
||||
}
|
||||
|
||||
return startInternalLbVm(vm, _accountMgr.getSystemUser(), _accountMgr.getSystemAccount(), callerUserId, null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,9 @@ import java.util.Set;
|
|||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupVO;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
|
||||
|
|
@ -111,7 +108,6 @@ import com.cloud.api.query.vo.UserAccountJoinVO;
|
|||
import com.cloud.api.query.vo.UserVmJoinVO;
|
||||
import com.cloud.api.query.vo.VolumeJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
|
|
@ -124,9 +120,9 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
|||
import com.cloud.network.security.SecurityGroupVMMapVO;
|
||||
import com.cloud.network.security.dao.SecurityGroupVMMapDao;
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.projects.ProjectInvitation;
|
||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.projects.Project.ListProjectResourcesCriteria;
|
||||
import com.cloud.projects.ProjectInvitation;
|
||||
import com.cloud.projects.ProjectManager;
|
||||
import com.cloud.projects.dao.ProjectAccountDao;
|
||||
import com.cloud.projects.dao.ProjectDao;
|
||||
|
|
@ -142,10 +138,8 @@ import com.cloud.user.dao.AccountDao;
|
|||
import com.cloud.utils.DateUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.component.Manager;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.db.Filter;
|
||||
import com.cloud.utils.db.JoinBuilder;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Func;
|
||||
|
|
@ -989,6 +983,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
Long networkId = cmd.getNetworkId();
|
||||
Long vpcId = cmd.getVpcId();
|
||||
Boolean forVpc = cmd.getForVpc();
|
||||
String role = cmd.getRole();
|
||||
|
||||
Account caller = UserContext.current().getCaller();
|
||||
List<Long> permittedAccounts = new ArrayList<Long>();
|
||||
|
|
@ -1018,6 +1013,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
sb.and("hostId", sb.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
sb.and("vpcId", sb.entity().getVpcId(), SearchCriteria.Op.EQ);
|
||||
sb.and("role", sb.entity().getRole(), SearchCriteria.Op.EQ);
|
||||
|
||||
if (forVpc != null) {
|
||||
if (forVpc) {
|
||||
|
|
@ -1074,6 +1070,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
if (vpcId != null) {
|
||||
sc.setParameters("vpcId", vpcId);
|
||||
}
|
||||
|
||||
if (role != null) {
|
||||
sc.setParameters("role", role);
|
||||
}
|
||||
|
||||
// search VR details by ids
|
||||
Pair<List<DomainRouterJoinVO>, Integer> uniqueVrPair = _routerJoinDao.searchAndCount(sc, searchFilter);
|
||||
|
|
|
|||
|
|
@ -155,6 +155,8 @@ public class DomainRouterJoinDaoImpl extends GenericDaoBase<DomainRouterJoinVO,
|
|||
routerResponse.setIp6Dns2(router.getIp6Dns2());
|
||||
|
||||
routerResponse.setVpcId(router.getVpcUuid());
|
||||
|
||||
routerResponse.setRole(router.getRole().toString());
|
||||
|
||||
// set async job
|
||||
routerResponse.setJobId(router.getJobUuid());
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import javax.persistence.Table;
|
|||
|
||||
import com.cloud.network.Network.GuestType;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.router.VirtualRouter.RedundantState;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
|
|
@ -235,14 +236,16 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
|
|||
@Column(name="guest_type")
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
private GuestType guestType;
|
||||
|
||||
@Column(name="role")
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
private VirtualRouter.Role role;
|
||||
|
||||
|
||||
public DomainRouterJoinVO() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
|
|
@ -991,4 +994,14 @@ public class DomainRouterJoinVO extends BaseViewVO implements ControlledViewEnti
|
|||
public void setIp6Dns2(String ip6Dns2) {
|
||||
this.ip6Dns2 = ip6Dns2;
|
||||
}
|
||||
|
||||
|
||||
public VirtualRouter.Role getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
|
||||
public void setRole(VirtualRouter.Role role) {
|
||||
this.role = role;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -691,3 +691,109 @@ CREATE VIEW `cloud`.`affinity_group_view` AS
|
|||
|
||||
-- Re-enable foreign key checking, at the end of the upgrade path
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
|
||||
-- Add role to the domain router view
|
||||
ALTER VIEW `cloud`.`domain_router_view` AS
|
||||
select
|
||||
vm_instance.id id,
|
||||
vm_instance.name name,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
projects.id project_id,
|
||||
projects.uuid project_uuid,
|
||||
projects.name project_name,
|
||||
vm_instance.uuid uuid,
|
||||
vm_instance.created created,
|
||||
vm_instance.state state,
|
||||
vm_instance.removed removed,
|
||||
vm_instance.pod_id pod_id,
|
||||
vm_instance.instance_name instance_name,
|
||||
host_pod_ref.uuid pod_uuid,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
data_center.dns1 dns1,
|
||||
data_center.dns2 dns2,
|
||||
data_center.ip6_dns1 ip6_dns1,
|
||||
data_center.ip6_dns2 ip6_dns2,
|
||||
host.id host_id,
|
||||
host.uuid host_uuid,
|
||||
host.name host_name,
|
||||
vm_template.id template_id,
|
||||
vm_template.uuid template_uuid,
|
||||
service_offering.id service_offering_id,
|
||||
disk_offering.uuid service_offering_uuid,
|
||||
disk_offering.name service_offering_name,
|
||||
nics.id nic_id,
|
||||
nics.uuid nic_uuid,
|
||||
nics.network_id network_id,
|
||||
nics.ip4_address ip_address,
|
||||
nics.ip6_address ip6_address,
|
||||
nics.ip6_gateway ip6_gateway,
|
||||
nics.ip6_cidr ip6_cidr,
|
||||
nics.default_nic is_default_nic,
|
||||
nics.gateway gateway,
|
||||
nics.netmask netmask,
|
||||
nics.mac_address mac_address,
|
||||
nics.broadcast_uri broadcast_uri,
|
||||
nics.isolation_uri isolation_uri,
|
||||
vpc.id vpc_id,
|
||||
vpc.uuid vpc_uuid,
|
||||
networks.uuid network_uuid,
|
||||
networks.name network_name,
|
||||
networks.network_domain network_domain,
|
||||
networks.traffic_type traffic_type,
|
||||
networks.guest_type guest_type,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id,
|
||||
domain_router.template_version template_version,
|
||||
domain_router.scripts_version scripts_version,
|
||||
domain_router.is_redundant_router is_redundant_router,
|
||||
domain_router.redundant_state redundant_state,
|
||||
domain_router.stop_pending stop_pending,
|
||||
domain_router.role role
|
||||
from
|
||||
`cloud`.`domain_router`
|
||||
inner join
|
||||
`cloud`.`vm_instance` ON vm_instance.id = domain_router.id
|
||||
inner join
|
||||
`cloud`.`account` ON vm_instance.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON vm_instance.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id
|
||||
left join
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
left join
|
||||
`cloud`.`data_center` ON vm_instance.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`host` ON vm_instance.host_id = host.id
|
||||
left join
|
||||
`cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id
|
||||
left join
|
||||
`cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id
|
||||
left join
|
||||
`cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id
|
||||
left join
|
||||
`cloud`.`volumes` ON vm_instance.id = volumes.instance_id
|
||||
left join
|
||||
`cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
|
||||
left join
|
||||
`cloud`.`nics` ON vm_instance.id = nics.instance_id
|
||||
left join
|
||||
`cloud`.`networks` ON nics.network_id = networks.id
|
||||
left join
|
||||
`cloud`.`vpc` ON domain_router.vpc_id = vpc.id
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = vm_instance.id
|
||||
and async_job.instance_type = 'DomainRouter'
|
||||
and async_job.job_status = 0;
|
||||
Loading…
Reference in New Issue