From 6731dc66f18b863970b4d743e96d5ae4a80e0562 Mon Sep 17 00:00:00 2001 From: abhishek Date: Thu, 16 Sep 2010 12:02:29 -0700 Subject: [PATCH] bug 3120: incremental checkin --- .../com/cloud/api/commands/AssociateIPAddrCmd.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java b/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java index a4c06429d3a..5c338d569b0 100644 --- a/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java +++ b/server/src/com/cloud/api/commands/AssociateIPAddrCmd.java @@ -48,7 +48,8 @@ public class AssociateIPAddrCmd extends BaseCmd { s_properties.add(new Pair(BaseCmd.Properties.DOMAIN_ID, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.ACCOUNT_OBJ, Boolean.FALSE)); s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.ZONE_ID, Boolean.TRUE)); + s_properties.add(new Pair(BaseCmd.Properties.VIRTUAL_MACHINE_ID, Boolean.FALSE)); } public String getName() { @@ -69,7 +70,8 @@ public class AssociateIPAddrCmd extends BaseCmd { Account account = (Account)params.get(BaseCmd.Properties.ACCOUNT_OBJ.getName()); Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); String accountName = (String)params.get(BaseCmd.Properties.ACCOUNT.getName()); - Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName()); + Long domainId = (Long)params.get(BaseCmd.Properties.DOMAIN_ID.getName()); + Long vmId = (Long)params.get(BaseCmd.Properties.VIRTUAL_MACHINE_ID.getName()); String newIpAddr = null; String errorDesc = null; Long accountId = null; @@ -104,7 +106,13 @@ public class AssociateIPAddrCmd extends BaseCmd { if (userId == null) { userId = Long.valueOf(1); } - + + //vmId == 0 => general flow + //vmId = 1 => 1:1 NAT + if(vmId == null){ + vmId = Long.valueOf(0); + } + try { newIpAddr = getManagementServer().associateIpAddress(userId.longValue(), accountId.longValue(), domainId.longValue(), zoneId.longValue()); } catch (ResourceAllocationException rae) {