當前位置: 首頁>>代碼示例>>Java>>正文


Java NicVO.getSecondaryIp方法代碼示例

本文整理匯總了Java中com.cloud.vm.NicVO.getSecondaryIp方法的典型用法代碼示例。如果您正苦於以下問題:Java NicVO.getSecondaryIp方法的具體用法?Java NicVO.getSecondaryIp怎麽用?Java NicVO.getSecondaryIp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.cloud.vm.NicVO的用法示例。


在下文中一共展示了NicVO.getSecondaryIp方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isSecondaryIpSetForNic

import com.cloud.vm.NicVO; //導入方法依賴的package包/類
@Override
public boolean isSecondaryIpSetForNic(final long nicId) {
    final NicVO nic = _nicDao.findById(nicId);
    return nic.getSecondaryIp();
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:6,代碼來源:NetworkOrchestrator.java

示例2: sendRulesetUpdates

import com.cloud.vm.NicVO; //導入方法依賴的package包/類
public void sendRulesetUpdates(final SecurityGroupWork work) {
    final Long userVmId = work.getInstanceId();
    final UserVm vm = _userVMDao.findById(userVmId);

    if (vm != null && vm.getState() == State.Running) {
        if (s_logger.isTraceEnabled()) {
            s_logger.trace("SecurityGroupManager v2: found vm, " + userVmId + " state=" + vm.getState());
        }
        final Map<PortAndProto, Set<String>> ingressRules = generateRulesForVM(userVmId, SecurityRuleType.IngressRule);
        final Map<PortAndProto, Set<String>> egressRules = generateRulesForVM(userVmId, SecurityRuleType.EgressRule);
        final Long agentId = vm.getHostId();
        if (agentId != null) {
            final String privateIp = vm.getPrivateIpAddress();
            final NicVO nic = _nicDao.findByIp4AddressAndVmId(privateIp, vm.getId());
            List<String> nicSecIps = null;
            if (nic != null) {
                if (nic.getSecondaryIp()) {
                    //get secondary ips of the vm
                    final long networkId = nic.getNetworkId();
                    nicSecIps = _nicSecIpDao.getSecondaryIpAddressesForNic(nic.getId());
                }
            }
            final SecurityGroupRulesCmd cmd =
                    generateRulesetCmd(vm.getInstanceName(), vm.getPrivateIpAddress(), vm.getPrivateMacAddress(), vm.getId(), null, work.getLogsequenceNumber(),
                            ingressRules, egressRules, nicSecIps);
            cmd.setMsId(_serverId);
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("SecurityGroupManager v2: sending ruleset update for vm " + vm.getInstanceName() + ":ingress num rules=" +
                        cmd.getIngressRuleSet().length + ":egress num rules=" + cmd.getEgressRuleSet().length + " num cidrs=" + cmd.getTotalNumCidrs() + " sig=" +
                        cmd.getSignature());
            }
            final Commands cmds = new Commands(cmd);
            try {
                _agentMgr.send(agentId, cmds, _answerListener);
                if (s_logger.isTraceEnabled()) {
                    s_logger.trace("SecurityGroupManager v2: sent ruleset updates for " + vm.getInstanceName() + " curr queue size=" + _workQueue.size());
                }
            } catch (final AgentUnavailableException e) {
                s_logger.debug("Unable to send updates for vm: " + userVmId + "(agentid=" + agentId + ")");
                _workTracker.handleException(agentId);
            }
        }
    } else {
        if (s_logger.isDebugEnabled()) {
            if (vm != null) {
                s_logger.debug("No rules sent to vm " + vm + "state=" + vm.getState());
            } else {
                s_logger.debug("Could not find vm: No rules sent to vm " + userVmId);
            }
        }
    }
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:53,代碼來源:SecurityGroupManagerImpl2.java

示例3: toNicTO

import com.cloud.vm.NicVO; //導入方法依賴的package包/類
@Override
public NicTO toNicTO(final NicProfile profile) {
    final NicTO to = new NicTO();
    to.setDeviceId(profile.getDeviceId());
    to.setBroadcastType(profile.getBroadcastType());
    to.setType(profile.getTrafficType());
    to.setIp(profile.getIPv4Address());
    to.setNetmask(profile.getIPv4Netmask());
    to.setMac(profile.getMacAddress());
    to.setDns1(profile.getIPv4Dns1());
    to.setDns2(profile.getIPv4Dns2());
    to.setGateway(profile.getIPv4Gateway());
    to.setDefaultNic(profile.isDefaultNic());
    to.setBroadcastUri(profile.getBroadCastUri());
    to.setIsolationuri(profile.getIsolationUri());
    to.setNetworkRateMbps(profile.getNetworkRate());
    to.setName(profile.getName());
    to.setSecurityGroupEnabled(profile.isSecurityGroupEnabled());

    final NetworkVO network = _networkDao.findById(profile.getNetworkId());
    to.setNetworkUuid(network.getUuid());

    // Workaround to make sure the TO has the UUID we need for Nicira integration
    final NicVO nicVO = _nicDao.findById(profile.getId());
    if (nicVO != null) {
        to.setUuid(nicVO.getUuid());
        List<String> secIps = null;
        if (nicVO.getSecondaryIp()) {
            secIps = _nicSecIpDao.getSecondaryIpAddressesForNic(nicVO.getId());
        }
        to.setNicSecIps(secIps);
    } else {
        s_logger.warn("Unabled to load NicVO for NicProfile " + profile.getId());
        //Workaround for dynamically created nics
        //FixMe: uuid and secondary IPs can be made part of nic profile
        to.setUuid(UUID.randomUUID().toString());
    }

    //check whether the this nic has secondary ip addresses set
    //set nic secondary ip address in NicTO which are used for security group
    // configuration. Use full when vm stop/start
    return to;
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:44,代碼來源:HypervisorGuruBase.java


注:本文中的com.cloud.vm.NicVO.getSecondaryIp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。