Search in sources :

Example 31 with NicVO

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);
}
Also used : UserVmVO(com.cloud.vm.UserVmVO) Commands(com.cloud.agent.manager.Commands) NicVO(com.cloud.vm.NicVO) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 32 with NicVO

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);
}
Also used : Commands(com.cloud.agent.manager.Commands) VirtualMachineProfile(com.cloud.vm.VirtualMachineProfile) NicVO(com.cloud.vm.NicVO) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 33 with NicVO

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;
}
Also used : UserVmVO(com.cloud.vm.UserVmVO) DeployDestination(com.cloud.deploy.DeployDestination) Commands(com.cloud.agent.manager.Commands) NicVO(com.cloud.vm.NicVO) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 34 with NicVO

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;
}
Also used : Network(com.cloud.network.Network) ArrayList(java.util.ArrayList) VMInstanceVO(com.cloud.vm.VMInstanceVO) Nic(com.cloud.vm.Nic) NicVO(com.cloud.vm.NicVO)

Example 35 with NicVO

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;
}
Also used : NicSecondaryIpResponse(org.apache.cloudstack.api.response.NicSecondaryIpResponse) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) NetworkVO(com.cloud.network.dao.NetworkVO) NicVO(com.cloud.vm.NicVO)

Aggregations

NicVO (com.cloud.vm.NicVO)86 NetworkVO (com.cloud.network.dao.NetworkVO)33 ArrayList (java.util.ArrayList)21 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)18 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)17 NicProfile (com.cloud.vm.NicProfile)15 VMInstanceVO (com.cloud.vm.VMInstanceVO)13 DataCenterVO (com.cloud.dc.DataCenterVO)12 Commands (com.cloud.agent.manager.Commands)11 Network (com.cloud.network.Network)11 HostVO (com.cloud.host.HostVO)10 UserVmVO (com.cloud.vm.UserVmVO)10 Answer (com.cloud.agent.api.Answer)9 NetworkGuru (com.cloud.network.guru.NetworkGuru)9 Nic (com.cloud.vm.Nic)9 VirtualMachineProfile (com.cloud.vm.VirtualMachineProfile)9 Test (org.junit.Test)9 DataCenter (com.cloud.dc.DataCenter)7 IPAddressVO (com.cloud.network.dao.IPAddressVO)7 VirtualRouter (com.cloud.network.router.VirtualRouter)7