当前位置: 首页>>代码示例>>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;未经允许,请勿转载。