use of com.cloud.network.router.VirtualRouter in project cloudstack by apache.
the class BasicNetworkVisitor method visit.
@Override
public boolean visit(final PasswordToRouterRules passwd) throws ResourceUnavailableException {
final VirtualRouter router = passwd.getRouter();
final NicVO nicVo = passwd.getNicVo();
final VirtualMachineProfile profile = passwd.getProfile();
final Commands cmds = new Commands(Command.OnError.Stop);
_commandSetupHelper.createPasswordCommand(router, profile, nicVo, cmds);
return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
}
use of com.cloud.network.router.VirtualRouter in project cloudstack by apache.
the class BasicNetworkVisitor method visit.
@Override
public boolean visit(final DhcpSubNetRules subnet) throws ResourceUnavailableException {
final VirtualRouter router = subnet.getRouter();
final Network network = subnet.getNetwork();
final NicIpAliasVO nicAlias = subnet.getNicAlias();
final String routerAliasIp = subnet.getRouterAliasIp();
final Commands cmds = new Commands(Command.OnError.Stop);
final List<IpAliasTO> ipaliasTo = new ArrayList<IpAliasTO>();
ipaliasTo.add(new IpAliasTO(routerAliasIp, nicAlias.getNetmask(), nicAlias.getAliasCount().toString()));
_commandSetupHelper.createIpAlias(router, ipaliasTo, nicAlias.getNetworkId(), cmds);
// also add the required configuration to the dnsmasq for supporting
// dhcp and dns on the new ip.
_commandSetupHelper.configDnsMasq(router, network, cmds);
return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
}
use of com.cloud.network.router.VirtualRouter in project cloudstack by apache.
the class BasicNetworkVisitor method visit.
@Override
public boolean visit(final UserdataPwdRules userdata) throws ResourceUnavailableException {
final VirtualRouter router = userdata.getRouter();
final Commands commands = new Commands(Command.OnError.Stop);
final VirtualMachineProfile profile = userdata.getProfile();
final NicVO nicVo = userdata.getNicVo();
final UserVmVO userVM = userdata.getUserVM();
final DeployDestination destination = userdata.getDestination();
if (router.getPodIdToDeployIn().longValue() == destination.getPod().getId()) {
_commandSetupHelper.createPasswordCommand(router, profile, nicVo, commands);
_commandSetupHelper.createVmDataCommand(router, userVM, nicVo, userVM.getDetail("SSH.PublicKey"), commands);
return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
return true;
}
use of com.cloud.network.router.VirtualRouter in project cloudstack by apache.
the class StopNetScalerVMCmd method execute.
@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");
}
}
use of com.cloud.network.router.VirtualRouter in project cloudstack by apache.
the class DestroyRouterCmd method execute.
@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");
}
}
Aggregations