From ade1b2665b4b46872cd7ecb50690ecc6cbdf66a9 Mon Sep 17 00:00:00 2001 From: alena Date: Mon, 6 Dec 2010 13:23:44 -0800 Subject: [PATCH] Removed podId from createNetwork api command --- api/src/com/cloud/api/commands/CreateNetworkCmd.java | 7 ------- server/src/com/cloud/network/NetworkManagerImpl.java | 12 +++++++----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/api/src/com/cloud/api/commands/CreateNetworkCmd.java b/api/src/com/cloud/api/commands/CreateNetworkCmd.java index ae8bde18124..6487e4ca97a 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkCmd.java @@ -49,9 +49,6 @@ public class CreateNetworkCmd extends BaseCmd { @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required=true, description="the Zone ID for the Vlan ip range") private Long zoneId; - - @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="the Pod ID for the Vlan ip range") - private Long podId; @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, description="the gateway of the VLAN IP range") private String gateway; @@ -88,10 +85,6 @@ public class CreateNetworkCmd extends BaseCmd { return zoneId; } - public Long getPodId() { - return podId; - } - public String getGateway() { return gateway; } diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index c129ffc405e..6d83ca54ee2 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -1803,12 +1803,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag Long userId = UserContext.current().getUserId(); Long networkOfferingId = cmd.getNetworkOfferingId(); Long zoneId = cmd.getZoneId(); - Long podId = cmd.getPodId(); String gateway = cmd.getGateway(); String startIP = cmd.getStartIp(); String endIP = cmd.getEndIp(); String vlanNetmask = cmd.getNetmask(); - String cidr = NetUtils.ipAndNetMaskToCidr(gateway, vlanNetmask); + String cidr = null; + if (gateway != null && vlanNetmask != null) { + cidr = NetUtils.ipAndNetMaskToCidr(gateway, vlanNetmask); + } String accountName = cmd.getAccountName(); Long domainId = cmd.getDomainId(); String vlanId = cmd.getVlan(); @@ -1908,12 +1910,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag owner = null; } - if (ctxAccount.getType() == Account.ACCOUNT_TYPE_ADMIN && networkOffering.getGuestIpType() != GuestIpType.Virtual && startIP != null && endIP != null && gateway != null) { + if (ctxAccount.getType() == Account.ACCOUNT_TYPE_ADMIN && networkOffering.getGuestIpType() == GuestIpType.Direct && startIP != null && endIP != null && gateway != null) { //Create vlan ip range - Vlan vlan = _configMgr.createVlanAndPublicIpRange(userId, zoneId, podId, startIP, endIP, gateway, vlanNetmask, false, vlanId, owner, networkId); + Vlan vlan = _configMgr.createVlanAndPublicIpRange(userId, zoneId, null, startIP, endIP, gateway, vlanNetmask, false, vlanId, owner, networkId); if (vlan == null) { txn.rollback(); - throw new CloudRuntimeException("Fail to create a vlan"); + throw new CloudRuntimeException("Failed to create a vlan"); } } txn.commit();