You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mu...@apache.org on 2013/08/12 01:18:04 UTC
git commit: updated refs/heads/4.2 to ba22daa
Updated Branches:
refs/heads/4.2 8f503c7ff -> ba22daa5c
CLOUDSTACK-4206: [EIP/ELB] Failed to disableStaticNAT when the userVM is
in destroyed state.
ignore VM state when system is enabling static NAT on the system IP to
VM in EIP enable network
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ba22daa5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ba22daa5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ba22daa5
Branch: refs/heads/4.2
Commit: ba22daa5c94a09f5a65b2692841b5671aa8b3724
Parents: 8f503c7
Author: Murali Reddy <mu...@gmail.com>
Authored: Mon Aug 12 04:46:29 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Mon Aug 12 04:46:29 2013 +0530
----------------------------------------------------------------------
.../com/cloud/network/rules/RulesManagerImpl.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba22daa5/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 397ece8..5781238 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -137,7 +137,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
LoadBalancerVMMapDao _loadBalancerVMMapDao;
- protected void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller) {
+ protected void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller, Boolean ignoreVmState) {
if (ipAddress == null || ipAddress.getAllocatedTime() == null || ipAddress.getAllocatedToAccountId() == null) {
throw new InvalidParameterValueException("Unable to create ip forwarding rule on address " + ipAddress + ", invalid IP address specified.");
}
@@ -147,7 +147,9 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
}
if (userVm.getState() == VirtualMachine.State.Destroyed || userVm.getState() == VirtualMachine.State.Expunging) {
- throw new InvalidParameterValueException("Invalid user vm: " + userVm.getId());
+ if (!ignoreVmState) {
+ throw new InvalidParameterValueException("Invalid user vm: " + userVm.getId());
+ }
}
_accountMgr.checkAccess(caller, null, true, ipAddress, userVm);
@@ -544,7 +546,12 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
}
// Check permissions
- checkIpAndUserVm(ipAddress, vm, caller);
+ if (ipAddress.getSystem()) {
+ // when system is enabling static NAT on system IP's (for EIP) ignore VM state
+ checkIpAndUserVm(ipAddress, vm, caller, true);
+ } else {
+ checkIpAndUserVm(ipAddress, vm, caller, false);
+ }
//is static nat is for vm secondary ip
//dstIp = guestNic.getIp4Address();
@@ -1185,7 +1192,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
UserContext ctx = UserContext.current();
Account caller = ctx.getCaller();
IPAddressVO ipAddress = _ipAddressDao.findById(ipId);
- checkIpAndUserVm(ipAddress, null, caller);
+ checkIpAndUserVm(ipAddress, null, caller, false);
if (ipAddress.getSystem()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Can't disable static nat for system IP address with specified id");
@@ -1219,7 +1226,7 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
boolean success = true;
IPAddressVO ipAddress = _ipAddressDao.findById(ipId);
- checkIpAndUserVm(ipAddress, null, caller);
+ checkIpAndUserVm(ipAddress, null, caller, false);
long networkId = ipAddress.getAssociatedWithNetworkId();
if (!ipAddress.isOneToOneNat()) {