@Override public void execute() { VirtualRouter router = _routerService.upgradeRouter(this); if (router != null) { DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(router); routerResponse.setResponseName(getCommandName()); setResponseObject(routerResponse); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router"); } } }
@Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId())); VirtualRouter result = _routerService.rebootRouter(getId(), true); if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName("router"); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router"); } } }
@Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { CallContext ctx = CallContext.current(); ctx.setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class,getId())); VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCallingAccount(), ctx.getCallingUserId()); if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router"); } } }
@Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) { throw new InvalidParameterValueException("Can't find router by id"); } else { result = _routerService.startRouter(getId()); } if (result != null) { DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result); routerResponse.setResponseName(getCommandName()); setResponseObject(routerResponse); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router"); } } }
@Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { CallContext.current().setEventDetails("Router Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.VIRTUAL_ROUTER) { throw new InvalidParameterValueException("Can't find router by id"); } else { result = _routerService.stopRouter(getId(), isForced()); } if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router"); } } }
@Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { CallContext.current().setEventDetails("Internal Lb Vm Id: " + getId()); VirtualRouter result = null; VirtualRouter router = _routerService.findRouter(getId()); if (router == null || router.getRole() != Role.INTERNAL_LB_VM) { throw new InvalidParameterValueException("Can't find internal lb vm by id"); } else { result = _internalLbSvc.startInternalLbVm(getId(), CallContext.current().getCallingAccount(), CallContext.current().getCallingUserId()); } if (result != null) { DomainRouterResponse routerResponse = _responseGenerator.createDomainRouterResponse(result); routerResponse.setResponseName(getCommandName()); setResponseObject(routerResponse); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start internal lb vm"); } } }
@Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { CallContext.current().setEventDetails("Internal lb vm Id: " + getId()); VirtualRouter result = null; VirtualRouter vm = _routerService.findRouter(getId()); if (vm == null || vm.getRole() != Role.INTERNAL_LB_VM) { throw new InvalidParameterValueException("Can't find internal lb vm by id"); } else { result = _internalLbSvc.stopInternalLbVm(getId(), isForced(), CallContext.current().getCallingAccount(), CallContext.current().getCallingUserId()); } if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop internal lb vm"); } } }
@Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException { CallContext.current().setEventDetails("NetScaler vm Id: " + getId()); VirtualRouter result = null; VirtualRouter vm = _routerService.findRouter(getId()); if (vm == null || vm.getRole() != Role.NETSCALER_VM) { throw new InvalidParameterValueException("Can't find NetScaler lb vm by id"); } else { result = _netsclarLbService.stopNetscalerServiceVm(getId(), isForced(), CallContext.current().getCallingAccount(), CallContext.current().getCallingUserId()); } if (result != null) { DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop Netscaler vm"); } } }