本文整理汇总了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 ");
}
示例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);
}
示例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 ");
}
示例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);
}
示例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);
}