mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 7185: the tags logic in the update disk,service offerings was wrong. once a tag is created, it should not be modified. we should only append to the existing list of tags, adding more tags. fixing the same
status 7185: resolved fixed
This commit is contained in:
parent
f9333a282d
commit
0876136dc4
@ -1183,10 +1183,24 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
offering.setGuestIpType(guestIpType);
|
offering.setGuestIpType(guestIpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tags != null) {
|
if (tags != null)
|
||||||
if (tags.trim().isEmpty()) {
|
{
|
||||||
|
if (tags.trim().isEmpty() && offeringHandle.getTags() == null)
|
||||||
|
{
|
||||||
|
//no new tags; no existing tags
|
||||||
offering.setTagsArray(csvTagsToList(null));
|
offering.setTagsArray(csvTagsToList(null));
|
||||||
} else {
|
}
|
||||||
|
else if (!tags.trim().isEmpty() && offeringHandle.getTags() != null)
|
||||||
|
{
|
||||||
|
//new tags + existing tags
|
||||||
|
List<String> oldTags = csvTagsToList(offeringHandle.getTags());
|
||||||
|
List<String> newTags = csvTagsToList(tags);
|
||||||
|
oldTags.addAll(newTags);
|
||||||
|
offering.setTagsArray(oldTags);
|
||||||
|
}
|
||||||
|
else if(!tags.trim().isEmpty())
|
||||||
|
{
|
||||||
|
//new tags; NO existing tags
|
||||||
offering.setTagsArray(csvTagsToList(tags));
|
offering.setTagsArray(csvTagsToList(tags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1247,9 +1261,9 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
String tags = cmd.getTags();
|
String tags = cmd.getTags();
|
||||||
|
|
||||||
//Check if diskOffering exists
|
//Check if diskOffering exists
|
||||||
DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId);
|
DiskOfferingVO diskOfferingHandle = _diskOfferingDao.findById(diskOfferingId);
|
||||||
|
|
||||||
if (diskOffering == null) {
|
if (diskOfferingHandle == null) {
|
||||||
throw new InvalidParameterValueException("Unable to find disk offering by id " + diskOfferingId);
|
throw new InvalidParameterValueException("Unable to find disk offering by id " + diskOfferingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1258,7 +1272,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
return _diskOfferingDao.findById(diskOfferingId);
|
return _diskOfferingDao.findById(diskOfferingId);
|
||||||
}
|
}
|
||||||
|
|
||||||
diskOffering = _diskOfferingDao.createForUpdate(diskOfferingId);
|
DiskOfferingVO diskOffering = _diskOfferingDao.createForUpdate(diskOfferingId);
|
||||||
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
diskOffering.setName(name);
|
diskOffering.setName(name);
|
||||||
@ -1268,10 +1282,24 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
diskOffering.setDisplayText(displayText);
|
diskOffering.setDisplayText(displayText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tags != null) {
|
if (tags != null)
|
||||||
if (tags.trim().isEmpty()) {
|
{
|
||||||
|
if (tags.trim().isEmpty() && diskOfferingHandle.getTags() == null)
|
||||||
|
{
|
||||||
|
//no new tags; no existing tags
|
||||||
diskOffering.setTagsArray(csvTagsToList(null));
|
diskOffering.setTagsArray(csvTagsToList(null));
|
||||||
} else {
|
}
|
||||||
|
else if (!tags.trim().isEmpty() && diskOfferingHandle.getTags() != null)
|
||||||
|
{
|
||||||
|
//new tags + existing tags
|
||||||
|
List<String> oldTags = csvTagsToList(diskOfferingHandle.getTags());
|
||||||
|
List<String> newTags = csvTagsToList(tags);
|
||||||
|
oldTags.addAll(newTags);
|
||||||
|
diskOffering.setTagsArray(oldTags);
|
||||||
|
}
|
||||||
|
else if(!tags.trim().isEmpty())
|
||||||
|
{
|
||||||
|
//new tags; NO existing tags
|
||||||
diskOffering.setTagsArray(csvTagsToList(tags));
|
diskOffering.setTagsArray(csvTagsToList(tags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user