weizhouapache commented on code in PR #12357:
URL: https://github.com/apache/cloudstack/pull/12357#discussion_r2795384633
##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -325,6 +326,78 @@ public BackupOffering importBackupOffering(final
ImportBackupOfferingCmd cmd) {
return savedOffering;
}
+ @Override
+ @ActionEvent(eventType = EventTypes.EVENT_VM_BACKUP_OFFERING_CLONE,
eventDescription = "cloning backup offering")
+ public BackupOffering cloneBackupOffering(final CloneBackupOfferingCmd
cmd) {
+ final BackupOfferingVO sourceOffering =
backupOfferingDao.findById(cmd.getSourceOfferingId());
+ if (sourceOffering == null) {
+ throw new InvalidParameterValueException("Unable to find backup
offering with ID: " + cmd.getSourceOfferingId());
+ }
+
+ validateBackupForZone(sourceOffering.getZoneId());
+
+ if (backupOfferingDao.findByName(cmd.getName(),
sourceOffering.getZoneId()) != null) {
+ throw new CloudRuntimeException("A backup offering with the name
'" + cmd.getName() + "' already exists in this zone");
+ }
+
+ final String description = cmd.getDescription() != null ?
cmd.getDescription() : sourceOffering.getDescription();
+ final String externalId = cmd.getExternalId() != null ?
cmd.getExternalId() : sourceOffering.getExternalId();
+ final boolean userDrivenBackups = cmd.getUserDrivenBackups() != null ?
cmd.getUserDrivenBackups() : sourceOffering.isUserDrivenBackupAllowed();
+ final Long zoneId = cmd.getZoneId() != null ? cmd.getZoneId() :
sourceOffering.getZoneId();
+
+ if (!Objects.equals(sourceOffering.getExternalId(), externalId)) {
Review Comment:
@Pearl1594
sorry one more comment, in line 348,
```
if (external is not same or zoneid is not same) , then xxx
```
?
--
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]