当前位置: 首页>>代码示例>>Java>>正文


Java HostPodVO.getCidrSize方法代码示例

本文整理汇总了Java中com.cloud.dc.HostPodVO.getCidrSize方法的典型用法代码示例。如果您正苦于以下问题:Java HostPodVO.getCidrSize方法的具体用法?Java HostPodVO.getCidrSize怎么用?Java HostPodVO.getCidrSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cloud.dc.HostPodVO的用法示例。


在下文中一共展示了HostPodVO.getCidrSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkCIDR

import com.cloud.dc.HostPodVO; //导入方法依赖的package包/类
private boolean checkCIDR(final HostPodVO pod, final String serverPrivateIP, final String serverPrivateNetmask) {
    if (serverPrivateIP == null) {
        return true;
    }
    // Get the CIDR address and CIDR size
    final String cidrAddress = pod.getCidrAddress();
    final long cidrSize = pod.getCidrSize();

    // If the server's private IP address is not in the same subnet as the
    // pod's CIDR, return false
    final String cidrSubnet = NetUtils.getCidrSubNet(cidrAddress, cidrSize);
    final String serverSubnet = NetUtils.getSubNet(serverPrivateIP, serverPrivateNetmask);
    if (!cidrSubnet.equals(serverSubnet)) {
        return false;
    }

    // If the server's private netmask is less inclusive than the pod's CIDR
    // netmask, return false
    final String cidrNetmask = NetUtils.getCidrSubNet("255.255.255.255", cidrSize);
    final long cidrNetmaskNumeric = NetUtils.ip2Long(cidrNetmask);
    final long serverNetmaskNumeric = NetUtils.ip2Long(serverPrivateNetmask);
    return serverNetmaskNumeric <= cidrNetmaskNumeric;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:24,代码来源:ResourceManagerImpl.java

示例2: checkCIDR

import com.cloud.dc.HostPodVO; //导入方法依赖的package包/类
private boolean checkCIDR(final HostPodVO pod, final String serverPrivateIP, final String serverPrivateNetmask) {
    if (serverPrivateIP == null) {
        return true;
    }
    // Get the CIDR address and CIDR size
    final String cidrAddress = pod.getCidrAddress();
    final long cidrSize = pod.getCidrSize();

    // If the server's private IP address is not in the same subnet as the
    // pod's CIDR, return false
    final String cidrSubnet = NetUtils.getCidrSubNet(cidrAddress, cidrSize);
    final String serverSubnet = NetUtils.getSubNet(serverPrivateIP, serverPrivateNetmask);
    if (!cidrSubnet.equals(serverSubnet)) {
        return false;
    }

    // If the server's private netmask is less inclusive than the pod's CIDR
    // netmask, return false
    final String cidrNetmask = NetUtils.getCidrSubNet("255.255.255.255", cidrSize);
    final long cidrNetmaskNumeric = NetUtils.ip2Long(cidrNetmask);
    final long serverNetmaskNumeric = NetUtils.ip2Long(serverPrivateNetmask);
    if (serverNetmaskNumeric > cidrNetmaskNumeric) {
        return false;
    }
    return true;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:27,代码来源:ResourceManagerImpl.java

示例3: checkCIDR

import com.cloud.dc.HostPodVO; //导入方法依赖的package包/类
private boolean checkCIDR(Host.Type type, HostPodVO pod, String serverPrivateIP, String serverPrivateNetmask) {
    if (serverPrivateIP == null) {
        return true;
    }
    // Get the CIDR address and CIDR size
    String cidrAddress = pod.getCidrAddress();
    long cidrSize = pod.getCidrSize();

    // If the server's private IP address is not in the same subnet as the
    // pod's CIDR, return false
    String cidrSubnet = NetUtils.getCidrSubNet(cidrAddress, cidrSize);
    String serverSubnet = NetUtils.getSubNet(serverPrivateIP, serverPrivateNetmask);
    if (!cidrSubnet.equals(serverSubnet)) {
        return false;
    }
    return true;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:18,代码来源:CloudZonesStartupProcessor.java

示例4: updatePodNetmaskIfNeeded

import com.cloud.dc.HostPodVO; //导入方法依赖的package包/类
private void updatePodNetmaskIfNeeded(HostPodVO pod, String agentNetmask) {
    // If the server's private netmask is less inclusive than the pod's CIDR
    // netmask, update cidrSize of the default POD
    //(reason: we are maintaining pods only for internal accounting.)
    long cidrSize = pod.getCidrSize();
    String cidrNetmask = NetUtils.getCidrSubNet("255.255.255.255", cidrSize);
    long cidrNetmaskNumeric = NetUtils.ip2Long(cidrNetmask);
    long serverNetmaskNumeric = NetUtils.ip2Long(agentNetmask);//
    if (serverNetmaskNumeric > cidrNetmaskNumeric) {
        //update pod's cidrsize
        int newCidrSize = new Long(NetUtils.getCidrSize(agentNetmask)).intValue();
        pod.setCidrSize(newCidrSize);
        _podDao.update(pod.getId(), pod);
    }
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:16,代码来源:CloudZonesStartupProcessor.java


注:本文中的com.cloud.dc.HostPodVO.getCidrSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。