From e5e128545d0f36b03e14c36cd8799784a43fe89f Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 16 Nov 2010 13:25:25 -0800 Subject: [PATCH] removing the tags support in the update commands for disk and service offerings --- .../api/commands/UpdateDiskOfferingCmd.java | 10 +- .../commands/UpdateServiceOfferingCmd.java | 10 +- .../ConfigurationManagerImpl.java | 94 +++++++++---------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java b/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java index a3fcbca4449..d2805b32cdc 100644 --- a/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java +++ b/server/src/com/cloud/api/commands/UpdateDiskOfferingCmd.java @@ -47,8 +47,8 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="updates name of the disk offering with this value") private String diskOfferingName; - @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="update tags of the disk offering with this value") - private String tags; +// @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="update tags of the disk offering with this value") +// private String tags; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -66,9 +66,9 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ return diskOfferingName; } - public String getTags() { - return tags; - } +// public String getTags() { +// return tags; +// } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// diff --git a/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java b/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java index 1771e08687b..24fd7f5e189 100644 --- a/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java +++ b/server/src/com/cloud/api/commands/UpdateServiceOfferingCmd.java @@ -50,8 +50,8 @@ public class UpdateServiceOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.OFFER_HA, type=CommandType.BOOLEAN, description="the HA of the service offering to be updated") private Boolean offerHa; - @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for this service offering.") - private String tags; +// @Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for this service offering.") +// private String tags; @Parameter(name=ApiConstants.USE_VIRTUAL_NETWORK, type=CommandType.BOOLEAN, description="if true, the VM created from the offering will use default virtual networking. If false, the VM created will use a direct attached networking model. The default value is true.") private Boolean useVirtualNetwork; @@ -76,9 +76,9 @@ public class UpdateServiceOfferingCmd extends BaseCmd { return offerHa; } - public String getTags() { - return tags; - } +// public String getTags() { +// return tags; +// } public Boolean getUseVirtualNetwork() { return useVirtualNetwork; diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index f3c588bab44..7d03fc4804c 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -1145,7 +1145,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura Long id = cmd.getId(); String name = cmd.getServiceOfferingName(); Boolean ha = cmd.getOfferHa(); - String tags = cmd.getTags(); +// String tags = cmd.getTags(); Boolean useVirtualNetwork = cmd.getUseVirtualNetwork(); Long userId = UserContext.current().getUserId(); @@ -1159,7 +1159,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find service offering " + id); } - boolean updateNeeded = (name != null || displayText != null || ha != null || useVirtualNetwork != null || tags != null); + boolean updateNeeded = (name != null || displayText != null || ha != null || useVirtualNetwork != null); if (!updateNeeded) { return _serviceOfferingDao.findById(id); } @@ -1182,28 +1182,28 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura NetworkOffering.GuestIpType guestIpType = useVirtualNetwork ? NetworkOffering.GuestIpType.Virtualized : NetworkOffering.GuestIpType.DirectSingle; offering.setGuestIpType(guestIpType); } - - if (tags != null) - { - if (tags.trim().isEmpty() && offeringHandle.getTags() == null) - { - //no new tags; no existing tags - offering.setTagsArray(csvTagsToList(null)); - } - else if (!tags.trim().isEmpty() && offeringHandle.getTags() != null) - { - //new tags + existing tags - List oldTags = csvTagsToList(offeringHandle.getTags()); - List newTags = csvTagsToList(tags); - oldTags.addAll(newTags); - offering.setTagsArray(oldTags); - } - else if(!tags.trim().isEmpty()) - { - //new tags; NO existing tags - offering.setTagsArray(csvTagsToList(tags)); - } - } + +// if (tags != null) +// { +// if (tags.trim().isEmpty() && offeringHandle.getTags() == null) +// { +// //no new tags; no existing tags +// offering.setTagsArray(csvTagsToList(null)); +// } +// else if (!tags.trim().isEmpty() && offeringHandle.getTags() != null) +// { +// //new tags + existing tags +// List oldTags = csvTagsToList(offeringHandle.getTags()); +// List newTags = csvTagsToList(tags); +// oldTags.addAll(newTags); +// offering.setTagsArray(oldTags); +// } +// else if(!tags.trim().isEmpty()) +// { +// //new tags; NO existing tags +// offering.setTagsArray(csvTagsToList(tags)); +// } +// } if (_serviceOfferingDao.update(id, offering)) { offering = _serviceOfferingDao.findById(id); @@ -1258,7 +1258,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura Long diskOfferingId = cmd.getId(); String name = cmd.getDiskOfferingName(); String displayText = cmd.getDisplayText(); - String tags = cmd.getTags(); +// String tags = cmd.getTags(); //Check if diskOffering exists DiskOfferingVO diskOfferingHandle = _diskOfferingDao.findById(diskOfferingId); @@ -1267,7 +1267,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura throw new InvalidParameterValueException("Unable to find disk offering by id " + diskOfferingId); } - boolean updateNeeded = (name != null || displayText != null || tags != null); + boolean updateNeeded = (name != null || displayText != null); if (!updateNeeded) { return _diskOfferingDao.findById(diskOfferingId); } @@ -1282,27 +1282,27 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura diskOffering.setDisplayText(displayText); } - if (tags != null) - { - if (tags.trim().isEmpty() && diskOfferingHandle.getTags() == null) - { - //no new tags; no existing tags - diskOffering.setTagsArray(csvTagsToList(null)); - } - else if (!tags.trim().isEmpty() && diskOfferingHandle.getTags() != null) - { - //new tags + existing tags - List oldTags = csvTagsToList(diskOfferingHandle.getTags()); - List newTags = csvTagsToList(tags); - oldTags.addAll(newTags); - diskOffering.setTagsArray(oldTags); - } - else if(!tags.trim().isEmpty()) - { - //new tags; NO existing tags - diskOffering.setTagsArray(csvTagsToList(tags)); - } - } +// if (tags != null) +// { +// if (tags.trim().isEmpty() && diskOfferingHandle.getTags() == null) +// { +// //no new tags; no existing tags +// diskOffering.setTagsArray(csvTagsToList(null)); +// } +// else if (!tags.trim().isEmpty() && diskOfferingHandle.getTags() != null) +// { +// //new tags + existing tags +// List oldTags = csvTagsToList(diskOfferingHandle.getTags()); +// List newTags = csvTagsToList(tags); +// oldTags.addAll(newTags); +// diskOffering.setTagsArray(oldTags); +// } +// else if(!tags.trim().isEmpty()) +// { +// //new tags; NO existing tags +// diskOffering.setTagsArray(csvTagsToList(tags)); +// } +// } if (_diskOfferingDao.update(diskOfferingId, diskOffering)) { saveConfigurationEvent(UserContext.current().getUserId(), null, EventTypes.EVENT_DISK_OFFERING_EDIT, "Successfully updated disk offering with name: " + diskOffering.getName() + ".", "doId=" + diskOffering.getId(), "name=" + diskOffering.getName(),