use of com.cloud.vm.NicVO in project cloudstack by apache.
the class AdvancedNetworkVisitor method visit.
@Override
public boolean visit(final DhcpEntryRules dhcp) throws ResourceUnavailableException {
final VirtualRouter router = dhcp.getRouter();
final Commands commands = new Commands(Command.OnError.Stop);
final NicVO nicVo = dhcp.getNicVo();
final UserVmVO userVM = dhcp.getUserVM();
_commandSetupHelper.createDhcpEntryCommand(router, userVM, nicVo, commands);
return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
use of com.cloud.vm.NicVO 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.vm.NicVO in project cloudstack by apache.
the class BasicNetworkVisitor method visit.
@Override
public boolean visit(final DhcpEntryRules dhcp) throws ResourceUnavailableException {
final VirtualRouter router = dhcp.getRouter();
final Commands commands = new Commands(Command.OnError.Stop);
final NicVO nicVo = dhcp.getNicVo();
final UserVmVO userVM = dhcp.getUserVM();
final DeployDestination destination = dhcp.getDestination();
if (router.getPodIdToDeployIn().longValue() == destination.getPod().getId()) {
_commandSetupHelper.createDhcpEntryCommand(router, userVM, nicVo, commands);
return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
return true;
}
use of com.cloud.vm.NicVO in project cloudstack by apache.
the class OvsNetworkTopologyGuruImpl method getVpcOnHost.
/**
* get the list of VPC id's of the vpc's for which one or more VM's from the VPC are running on the host
*/
@Override
public List<Long> getVpcOnHost(long hostId) {
List<Long> vpcIds = new ArrayList<>();
List<VMInstanceVO> vmInstances = _vmInstanceDao.listByHostId(hostId);
for (VMInstanceVO instance : vmInstances) {
List<NicVO> nics = _nicDao.listByVmId(instance.getId());
for (Nic nic : nics) {
Network network = _networkDao.findById(nic.getNetworkId());
if (network.getTrafficType() == Networks.TrafficType.Guest && network.getVpcId() != null) {
if (!vpcIds.contains(network.getVpcId())) {
vpcIds.add(network.getVpcId());
}
}
}
}
return vpcIds;
}
use of com.cloud.vm.NicVO in project cloudstack by apache.
the class ApiResponseHelper method createSecondaryIPToNicResponse.
@Override
public NicSecondaryIpResponse createSecondaryIPToNicResponse(NicSecondaryIp result) {
NicSecondaryIpResponse response = new NicSecondaryIpResponse();
NicVO nic = _entityMgr.findById(NicVO.class, result.getNicId());
NetworkVO network = _entityMgr.findById(NetworkVO.class, result.getNetworkId());
response.setId(result.getUuid());
response.setIpAddr(result.getIp4Address());
response.setNicId(nic.getUuid());
response.setNwId(network.getUuid());
response.setObjectName("nicsecondaryip");
return response;
}
Aggregations