diff --git a/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java b/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java index 4d4425f5d66..d9c22ad7312 100644 --- a/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java +++ b/server/src/com/cloud/api/commands/DeleteVlanIpRangeCmd.java @@ -18,29 +18,18 @@ package com.cloud.api.commands; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; +import com.cloud.api.Implementation; import com.cloud.api.Parameter; -import com.cloud.api.ServerApiException; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.user.User; -import com.cloud.utils.Pair; - +import com.cloud.api.BaseCmd.Manager; + +@Implementation(method="deleteVlanIpRange", manager=Manager.ConfigManager) public class DeleteVlanIpRangeCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteVlanIpRangeCmd.class.getName()); private static final String s_name = "deletevlaniprangeresponse"; - private static final List> s_properties = new ArrayList>(); - - static { - s_properties.add(new Pair(BaseCmd.Properties.ID, Boolean.TRUE)); - s_properties.add(new Pair(BaseCmd.Properties.USER_ID, Boolean.FALSE)); - } ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -65,31 +54,35 @@ public class DeleteVlanIpRangeCmd extends BaseCmd { public String getName() { return s_name; - } - public List> getProperties() { - return s_properties; - } + } + + + @Override + public String getResponse() { + // TODO Auto-generated method stub + return null; + } - @Override - public List> execute(Map params) { - Long vlanDbId = (Long) params.get(BaseCmd.Properties.ID.getName()); - Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); - - if (userId == null) { - userId = Long.valueOf(User.UID_SYSTEM); - } - - // Delete the VLAN and its public IP addresses - boolean success = false; - try { - success = getManagementServer().deleteVlanAndPublicIpRange(userId, vlanDbId); - } catch (InvalidParameterValueException ex) { - s_logger.error("Exception deleting VLAN", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VLAN: " + ex.getMessage()); - } - - List> returnValues = new ArrayList>(); - returnValues.add(new Pair(BaseCmd.Properties.SUCCESS.getName(), success)); - return returnValues; - } +// @Override +// public List> execute(Map params) { +// Long vlanDbId = (Long) params.get(BaseCmd.Properties.ID.getName()); +// Long userId = (Long)params.get(BaseCmd.Properties.USER_ID.getName()); +// +// if (userId == null) { +// userId = Long.valueOf(User.UID_SYSTEM); +// } +// +// // Delete the VLAN and its public IP addresses +// boolean success = false; +// try { +// success = getManagementServer().deleteVlanAndPublicIpRange(userId, vlanDbId); +// } catch (InvalidParameterValueException ex) { +// s_logger.error("Exception deleting VLAN", ex); +// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VLAN: " + ex.getMessage()); +// } +// +// List> returnValues = new ArrayList>(); +// returnValues.add(new Pair(BaseCmd.Properties.SUCCESS.getName(), success)); +// return returnValues; +// } } diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java index d5adf135b45..b848c90f40d 100644 --- a/server/src/com/cloud/configuration/ConfigurationManager.java +++ b/server/src/com/cloud/configuration/ConfigurationManager.java @@ -26,6 +26,7 @@ import com.cloud.api.commands.CreateServiceOfferingCmd; import com.cloud.api.commands.DeleteDiskOfferingCmd; import com.cloud.api.commands.DeletePodCmd; import com.cloud.api.commands.DeleteServiceOfferingCmd; +import com.cloud.api.commands.DeleteVlanIpRangeCmd; import com.cloud.api.commands.UpdateCfgCmd; import com.cloud.api.commands.UpdateDiskOfferingCmd; import com.cloud.api.commands.UpdatePodCmd; @@ -232,6 +233,7 @@ public interface ConfigurationManager extends Manager { * @return success/failure */ boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException; + boolean deleteVlanIpRange(DeleteVlanIpRangeCmd cmd) throws InvalidParameterValueException; /** * Adds/deletes private IPs diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 060519bc46c..084ccdad868 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -40,6 +40,7 @@ import com.cloud.api.commands.CreateServiceOfferingCmd; import com.cloud.api.commands.DeleteDiskOfferingCmd; import com.cloud.api.commands.DeletePodCmd; import com.cloud.api.commands.DeleteServiceOfferingCmd; +import com.cloud.api.commands.DeleteVlanIpRangeCmd; import com.cloud.api.commands.UpdateCfgCmd; import com.cloud.api.commands.UpdateDiskOfferingCmd; import com.cloud.api.commands.UpdatePodCmd; @@ -1924,5 +1925,19 @@ public class ConfigurationManagerImpl implements ConfigurationManager { s_logger.error("Unable to add the new config entry:",ex); return false; } + } + + @Override + public boolean deleteVlanAnIpRange(DeleteVlanIpRangeCmd cmd) throws InvalidParameterValueException { + + Long vlanDbId = cmd.getId(); + Long userId = UserContext.current().getUserId(); + + if (userId == null) { + userId = Long.valueOf(User.UID_SYSTEM); + } + + return deleteVlanAndPublicIpRange(userId, vlanDbId); + } } diff --git a/server/src/com/cloud/server/ManagementServer.java b/server/src/com/cloud/server/ManagementServer.java index 849401567d1..5f00a212ad2 100644 --- a/server/src/com/cloud/server/ManagementServer.java +++ b/server/src/com/cloud/server/ManagementServer.java @@ -468,7 +468,7 @@ public interface ManagementServer { * @param vlanDbId * @return success/failure */ - boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException; +// boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException; /** * Searches for vlan by the specified search criteria diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index a91cf3c2c3d..e546c96bff6 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -1828,10 +1828,10 @@ public class ManagementServerImpl implements ManagementServer { return _configMgr.createVlanAndPublicIpRange(userId, vlanType, zoneId, accountId, podId, vlanId, vlanGateway, vlanNetmask, startIP, endIP); } - @Override - public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException { - return _configMgr.deleteVlanAndPublicIpRange(userId, vlanDbId); - } +// @Override +// public boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId) throws InvalidParameterValueException { +// return _configMgr.deleteVlanAndPublicIpRange(userId, vlanDbId); +// } @Override public VolumeVO createVolume(long userId, long accountId, String name, long zoneId, long diskOfferingId, long startEventId, long size) throws InternalErrorException {