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


Java IPAddressVO.getVpcId方法代碼示例

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


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

示例1: unassignIPFromVpcNetwork

import com.cloud.network.dao.IPAddressVO; //導入方法依賴的package包/類
@Override
public void unassignIPFromVpcNetwork(final long ipId, final long networkId) {
    final IPAddressVO ip = _ipAddressDao.findById(ipId);
    if (isIpAllocatedToVpc(ip)) {
        return;
    }

    if (ip == null || ip.getVpcId() == null) {
        return;
    }

    s_logger.debug("Releasing VPC ip address " + ip + " from vpc network id=" + networkId);

    final long vpcId = ip.getVpcId();
    final boolean success;
    try {
        // unassign ip from the VPC router
        success = _ipAddrMgr.applyIpAssociations(_ntwkModel.getNetwork(networkId), true);
    } catch (final ResourceUnavailableException ex) {
        throw new CloudRuntimeException("Failed to apply ip associations for network id=" + networkId
                + " as a part of unassigning ip " + ipId + " from vpc", ex);
    }

    if (success) {
        ip.setAssociatedWithNetworkId(null);
        _ipAddressDao.update(ipId, ip);
        s_logger.debug("IP address " + ip + " is no longer associated with the network inside vpc id=" + vpcId);
    } else {
        throw new CloudRuntimeException("Failed to apply ip associations for network id=" + networkId
                + " as a part of unassigning ip " + ipId + " from vpc");
    }
    s_logger.debug("Successfully released VPC ip address " + ip + " back to VPC pool ");
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:34,代碼來源:VpcManagerImpl.java

示例2: replacePublicIpACL

import com.cloud.network.dao.IPAddressVO; //導入方法依賴的package包/類
@Override
public boolean replacePublicIpACL(final long aclId, final long publicIpId) throws ResourceUnavailableException {
    final Account caller = CallContext.current().getCallingAccount();

    final IPAddressVO publicIp = _ipAddressDao.findById(publicIpId);
    if (publicIp == null) {
        throw new InvalidParameterValueException("Unable to find specified IP address");
    }

    final NetworkACL acl = _networkACLDao.findById(aclId);
    if (acl == null) {
        throw new InvalidParameterValueException("Unable to find specified NetworkACL");
    }

    if (publicIp.getVpcId() == null) {
        throw new InvalidParameterValueException("IP address is not part of a VPC: " + publicIp.getUuid());
    }

    if (aclId != NetworkACL.DEFAULT_DENY && aclId != NetworkACL.DEFAULT_ALLOW) {
        // ACL is not default DENY/ALLOW
        // ACL should be associated with a VPC
        final Vpc vpc = _entityMgr.findById(Vpc.class, acl.getVpcId());
        if (vpc == null) {
            throw new InvalidParameterValueException("Unable to find Vpc associated with the NetworkACL");
        }

        _accountMgr.checkAccess(caller, null, true, vpc);
        if (!publicIp.getVpcId().equals(acl.getVpcId())) {
            throw new InvalidParameterValueException("IP address: " + publicIpId + " and ACL: " + aclId + " do not belong to the same VPC");
        }
    }

    return _networkAclMgr.replacePublicIpACL(acl, publicIp);
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:35,代碼來源:NetworkACLServiceImpl.java

示例3: unassignIPFromVpcNetwork

import com.cloud.network.dao.IPAddressVO; //導入方法依賴的package包/類
@Override
public void unassignIPFromVpcNetwork(final long ipId, final long networkId) {
    final IPAddressVO ip = _ipAddressDao.findById(ipId);
    if (isIpAllocatedToVpc(ip)) {
        return;
    }

    if (ip == null || ip.getVpcId() == null) {
        return;
    }

    s_logger.debug("Releasing VPC ip address " + ip + " from vpc network id=" + networkId);

    final long vpcId = ip.getVpcId();
    boolean success = false;
    try {
        // unassign ip from the VPC router
        success = _ipAddrMgr.applyIpAssociations(_ntwkModel.getNetwork(networkId), true);
    } catch (final ResourceUnavailableException ex) {
        throw new CloudRuntimeException("Failed to apply ip associations for network id=" + networkId + " as a part of unassigning ip " + ipId + " from vpc", ex);
    }

    if (success) {
        ip.setAssociatedWithNetworkId(null);
        _ipAddressDao.update(ipId, ip);
        s_logger.debug("IP address " + ip + " is no longer associated with the network inside vpc id=" + vpcId);
    } else {
        throw new CloudRuntimeException("Failed to apply ip associations for network id=" + networkId + " as a part of unassigning ip " + ipId + " from vpc");
    }
    s_logger.debug("Successfully released VPC ip address " + ip + " back to VPC pool ");
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:32,代碼來源:VpcManagerImpl.java

示例4: updateIpResourceCount

import com.cloud.network.dao.IPAddressVO; //導入方法依賴的package包/類
protected boolean updateIpResourceCount(final IPAddressVO ip) {
    // don't increment resource count for direct and dedicated ip addresses
    return (ip.getAssociatedWithNetworkId() != null || ip.getVpcId() != null) && !isIpDedicated(ip);
}
 
開發者ID:MissionCriticalCloud,項目名稱:cosmic,代碼行數:5,代碼來源:IpAddressManagerImpl.java

示例5: updateIpResourceCount

import com.cloud.network.dao.IPAddressVO; //導入方法依賴的package包/類
protected boolean updateIpResourceCount(IPAddressVO ip) {
    // don't increment resource count for direct and dedicated ip addresses
    return (ip.getAssociatedWithNetworkId() != null || ip.getVpcId() != null) && !isIpDedicated(ip);
}
 
開發者ID:apache,項目名稱:cloudstack,代碼行數:5,代碼來源:IpAddressManagerImpl.java


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