Examples of DhcpEntryCommand


Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }
   
    private void createDhcpEntryCommand(VirtualRouter router, UserVm vm, NicVO nic, Commands cmds) {
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName());
        DataCenterVO dcVo = _dcDao.findById(router.getDataCenterIdToDeployIn());
        String gatewayIp = findGatewayIp(vm.getId());
        if (!gatewayIp.equals(nic.getGateway())) {
            GuestOSVO guestOS = _guestOSDao.findById(vm.getGuestOSId());
            // Don't set dhcp:router option for non-default nic on CentOS/RHEL, because they would set routing on wrong interface
            // This is tricky, we may need to update this when we have more information on various OS's behavior
            if (guestOS.getDisplayName().startsWith("CentOS") || guestOS.getDisplayName().startsWith("Red Hat Enterprise")) {
                gatewayIp = "0.0.0.0";
            }
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setDefaultDns(findDefaultDnsIp(vm.getId()));

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }
   
    private void createDhcpEntryCommand(VirtualRouter router, UserVm vm, NicVO nic, Commands cmds) {
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName(), nic.getIp6Address(), _networkModel.getExecuteInSeqNtwkElmtCmd());
        DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
        Nic defaultNic = findGatewayIp(vm.getId());
        String gatewayIp = defaultNic.getGateway();
        if (gatewayIp != null && !gatewayIp.equals(nic.getGateway())) {
            gatewayIp = "0.0.0.0";
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setIp6Gateway(nic.getIp6Gateway());
        String ipaddress=null;
        NicVO domrDefaultNic =  findDefaultDnsIp(vm.getId());
        if (domrDefaultNic != null){
            ipaddress  = domrDefaultNic.getIp4Address();
        }
        dhcpCommand.setDefaultDns(ipaddress);
        dhcpCommand.setDuid(NetUtils.getDuidLL(nic.getMacAddress()));
        dhcpCommand.setDefault(nic.isDefaultNic());

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

        HostVO h = hosts.get(0);
        String dns = nic.getDns1();
        if (dns == null) {
            dns = nic.getDns2();
        }
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), profile.getVirtualMachine().getHostName(), null, dns,
                nic.getGateway(), null, _ntwkModel.getExecuteInSeqNtwkElmtCmd());
        String errMsg = String.format("Set dhcp entry on external DHCP %1$s failed(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(),
                nic.getIp4Address(), nic.getMacAddress(), profile.getVirtualMachine().getHostName());
        // prepareBareMetalDhcpEntry(nic, dhcpCommand);
        try {
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }
   
    private void createDhcpEntryCommand(VirtualRouter router, UserVm vm, NicVO nic, Commands cmds) {
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName(), nic.getIp6Address(), _networkModel.getExecuteInSeqNtwkElmtCmd());
        DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
        Nic defaultNic = findGatewayIp(vm.getId());
        String gatewayIp = defaultNic.getGateway();
        if (gatewayIp != null && !gatewayIp.equals(nic.getGateway())) {
            gatewayIp = "0.0.0.0";
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setIp6Gateway(nic.getIp6Gateway());
        String ipaddress=null;
        NicVO domrDefaultNic =  findDefaultDnsIp(vm.getId());
        if (domrDefaultNic != null){
            ipaddress  = domrDefaultNic.getIp4Address();
        }
        dhcpCommand.setDefaultDns(ipaddress);
        dhcpCommand.setDuid(NetUtils.getDuidLL(nic.getMacAddress()));
        dhcpCommand.setDefault(nic.isDefaultNic());

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }
   
    private void createDhcpEntryCommand(VirtualRouter router, UserVm vm, NicVO nic, Commands cmds) {
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName());
        DataCenterVO dcVo = _dcDao.findById(router.getDataCenterIdToDeployIn());
        String gatewayIp = findGatewayIp(vm.getId());
        if (!gatewayIp.equals(nic.getGateway())) {
            GuestOSVO guestOS = _guestOSDao.findById(vm.getGuestOSId());
            // Don't set dhcp:router option for non-default nic on CentOS/RHEL, because they would set routing on wrong interface
            // This is tricky, we may need to update this when we have more information on various OS's behavior
            if (guestOS.getDisplayName().startsWith("CentOS") || guestOS.getDisplayName().startsWith("Red Hat Enterprise")) {
                gatewayIp = "0.0.0.0";
            }
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setDefaultDns(findDefaultDnsIp(vm.getId()));

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }
   
    private void createDhcpEntryCommand(VirtualRouter router, UserVm vm, NicVO nic, Commands cmds) {
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName(), nic.getIp6Address(), _networkModel.getExecuteInSeqNtwkElmtCmd());
        DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
        Nic defaultNic = findGatewayIp(vm.getId());
        String gatewayIp = defaultNic.getGateway();
        if (gatewayIp != null && !gatewayIp.equals(nic.getGateway())) {
            gatewayIp = "0.0.0.0";
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setIp6Gateway(nic.getIp6Gateway());
        String ipaddress=null;
        NicVO domrDefaultNic =  findDefaultDnsIp(vm.getId());
        if (domrDefaultNic != null){
            ipaddress  = domrDefaultNic.getIp4Address();
        }
        dhcpCommand.setDefaultDns(ipaddress);
        dhcpCommand.setDuid(NetUtils.getDuidLL(nic.getMacAddress()));
        dhcpCommand.setDefault(nic.isDefaultNic());

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

        HostVO h = hosts.get(0);
        String dns = nic.getDns1();
        if (dns == null) {
            dns = nic.getDns2();
        }
        DhcpEntryCommand dhcpCommand =
            new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), profile.getVirtualMachine().getHostName(), null, dns, nic.getGateway(), null,
                _ntwkModel.getExecuteInSeqNtwkElmtCmd());
        String errMsg =
            String.format("Set dhcp entry on external DHCP %1$s failed(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(), nic.getIp4Address(),
                nic.getMacAddress(), profile.getVirtualMachine().getHostName());
        // prepareBareMetalDhcpEntry(nic, dhcpCommand);
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }
   
    private void createDhcpEntryCommand(VirtualRouter router, UserVm vm, NicVO nic, Commands cmds) {
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName());
        DataCenterVO dcVo = _dcDao.findById(router.getDataCenterIdToDeployIn());
        String gatewayIp = findGatewayIp(vm.getId());
        if (!gatewayIp.equals(nic.getGateway())) {
            GuestOSVO guestOS = _guestOSDao.findById(vm.getGuestOSId());
            // Don't set dhcp:router option for non-default nic on CentOS/RHEL, because they would set routing on wrong interface
            // This is tricky, we may need to update this when we have more information on various OS's behavior
            if (guestOS.getDisplayName().startsWith("CentOS") || guestOS.getDisplayName().startsWith("Red Hat Enterprise")) {
                gatewayIp = "0.0.0.0";
            }
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setDefaultDns(findDefaultDnsIp(vm.getId()));

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }

    private void createDhcpEntryCommand(final VirtualRouter router, final UserVm vm, final NicVO nic, final Commands cmds) {
        final DhcpEntryCommand dhcpCommand =
                new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName(), nic.getIp6Address(), _networkModel.getExecuteInSeqNtwkElmtCmd());
        final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
        final Nic defaultNic = findGatewayIp(vm.getId());
        String gatewayIp = defaultNic.getGateway();
        if (gatewayIp != null && !gatewayIp.equals(nic.getGateway())) {
            gatewayIp = "0.0.0.0";
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setIp6Gateway(nic.getIp6Gateway());
        String ipaddress = null;
        final NicVO domrDefaultNic = findDefaultDnsIp(vm.getId());
        if (domrDefaultNic != null) {
            ipaddress = domrDefaultNic.getIp4Address();
        }
        dhcpCommand.setDefaultDns(ipaddress);
        dhcpCommand.setDuid(NetUtils.getDuidLL(nic.getMacAddress()));
        dhcpCommand.setDefault(nic.isDefaultNic());

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here

Examples of com.cloud.agent.api.routing.DhcpEntryCommand

            }
        }
    }
   
    private void createDhcpEntryCommand(VirtualRouter router, UserVm vm, NicVO nic, Commands cmds) {
        DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), vm.getHostName(), nic.getIp6Address());
        DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
        String gatewayIp = findGatewayIp(vm.getId());
        boolean needGateway = true;
        if (gatewayIp != null && !gatewayIp.equals(nic.getGateway())) {
            needGateway = false;
            GuestOSVO guestOS = _guestOSDao.findById(vm.getGuestOSId());
            // Do set dhcp:router option for non-default nic on certain OS(including Windows), and leave other OS unset.
            // Because some OS(e.g. CentOS) would set routing on wrong interface
            for (String name : _guestOSNeedGatewayOnNonDefaultNetwork) {
                if (guestOS.getDisplayName().startsWith(name)) {
                    needGateway = true;
                    break;
                }
            }
        }
        if (!needGateway) {
            gatewayIp = "0.0.0.0";
        }
        dhcpCommand.setDefaultRouter(gatewayIp);
        dhcpCommand.setIp6Gateway(nic.getIp6Gateway());
        dhcpCommand.setDefaultDns(findDefaultDnsIp(vm.getId()));
        dhcpCommand.setDuid(NetUtils.getDuidLL(nic.getMacAddress()));
        dhcpCommand.setDefault(nic.isDefaultNic());

        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        dhcpCommand.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));
        dhcpCommand.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());

        cmds.addCommand("dhcp", dhcpCommand);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.