sureshanaparti commented on a change in pull request #5511:
URL: https://github.com/apache/cloudstack/pull/5511#discussion_r718143140



##########
File path: 
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java
##########
@@ -1050,4 +1054,45 @@ public Long getDelay() {
             return BackupSyncPollingInterval.value() * 1000L;
         }
     }
+
+    @Override
+    @ActionEvent(eventType = EventTypes.EVENT_VM_BACKUP_EDIT, eventDescription 
= "updating backup offering")
+    public BackupOffering updateBackupOffering(UpdateBackupOfferingCmd 
updateBackupOfferingCmd) {
+        Long id = updateBackupOfferingCmd.getId();
+        String name = updateBackupOfferingCmd.getName();
+        String description = updateBackupOfferingCmd.getDescription();
+
+        BackupOfferingVO backupOfferingVO = backupOfferingDao.findById(id);
+        if (backupOfferingVO == null) {
+            throw new InvalidParameterValueException(String.format("Unable to 
find Backup Offering with id: [%s].", id));
+        }
+
+        LOG.debug(String.format("Trying to update Backup Offering [id: %s, 
name: %s, description: %s] to [name: %s, description: %s].",
+                backupOfferingVO.getUuid(), backupOfferingVO.getName(), 
backupOfferingVO.getDescription(), name, description));
+        if (StringUtils.isAllEmpty(name, description)) {
+            throw new InvalidParameterValueException(String.format("Can't 
update Backup Offering [id: %s] because there is no change in name or 
description.", backupOfferingVO.getId()));

Review comment:
       @SadiJr can you move this params null/empty check to cmd class 
(_UpdateBackupOfferingCmd_) before calling this method.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to