bernardodemarco commented on code in PR #12758:
URL: https://github.com/apache/cloudstack/pull/12758#discussion_r3429046907


##########
server/src/main/java/org/apache/cloudstack/backup/BackupCompressionServiceJobController.java:
##########
@@ -0,0 +1,241 @@
+//Licensed to the Apache Software Foundation (ASF) under one
+//or more contributor license agreements.  See the NOTICE file
+//distributed with this work for additional information
+//regarding copyright ownership.  The ASF licenses this file
+//to you under the Apache License, Version 2.0 (the
+//"License"); you may not use this file except in compliance
+//the License.  You may obtain a copy of the License at
+//
+//http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing,
+//software distributed under the License is distributed on an
+//"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+//KIND, either express or implied.  See the License for the
+//specific language governing permissions and limitations
+//under the License.
+package org.apache.cloudstack.backup;
+
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.host.HostVO;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.Pair;
+import com.cloud.utils.UuidUtils;
+import com.cloud.utils.concurrency.NamedThreadFactory;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
+import org.apache.logging.log4j.ThreadContext;
+
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+public class BackupCompressionServiceJobController extends 
InternalBackupServiceJobController implements Configurable {
+
+    private static final String LOCK = "compression_lock";
+    protected ConfigKey<Integer> 
backupCompressionMaxConcurrentOperationsPerHost = new ConfigKey<>("Advanced", 
Integer.class,
+            "backup.compression.max.concurrent.operations.per.host", "5", 
"Determines the maximum number of concurrent backup compressions per host. 
Values lower than 0 remove" +
+            " the limit, meaning that as many compressions as possible will be 
done at the same time.", true, ConfigKey.Scope.Cluster);
+
+    protected ConfigKey<Integer> backupCompressionMaxConcurrentOperations = 
new ConfigKey<>("Advanced", Integer.class,
+            "backup.compression.max.concurrent.operations", "10", "Determines 
the maximum number of concurrent backup compressions in the zone. Values lower 
than 1 remove" +
+            " the limit, meaning that as many compressions as possible will be 
done at the same time.", true, ConfigKey.Scope.Zone);
+
+    protected ConfigKey<Integer> backupCompressionMaxJobRetries = new 
ConfigKey<>("Advanced", Integer.class,
+            "backup.compression.max.job.retries", "2", "Determines the maximum 
number of retries for backup compression jobs. This includes both start 
compression jobs and " +
+            "finalize compression jobs.", true, ConfigKey.Scope.Cluster);
+
+    protected ConfigKey<Integer> backupCompressionRetryInterval = new 
ConfigKey<>("Advanced", Integer.class,
+            "backup.compression.retry.interval", "60", "Determines the minimum 
amount of time (in minutes) to retry a backup compression job. This includes 
both start " +
+            "compression jobs and finalize compression jobs.", true, 
ConfigKey.Scope.Cluster);
+
+    protected ConfigKey<Boolean> backupCompressionTaskEnabled = new 
ConfigKey<>("Advanced", Boolean.class, "backup.compression.task.enabled", 
"true", "Whether the backup " +
+            "compression task should be running or not. Please set this to 
false and wait for any compression jobs to finish before restarting the 
Management Server.", true,
+            ConfigKey.Scope.Account);

Review Comment:
   Is it required to restart the MS after changing the setting? Isn't it 
dynamic? 



##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -1577,7 +1700,9 @@ public boolean restoreBackupVolumeAndAttachToVM(final 
String backedUpVolumeUuid,
         validateBackupForZone(backup.getZoneId());
 
         final VMInstanceVO vm = findVmById(vmId);
-        accountManager.checkAccess(CallContext.current().getCallingAccount(), 
null, true, vm);
+        Account callerAccount = CallContext.current().getCallingAccount();
+        accountManager.checkAccess(callerAccount, null, true, vm);
+        validateHostIdParameter(hostId, callerAccount);
 
         if (vm.getBackupOfferingId() != null && 
!BackupEnableAttachDetachVolumes.value()) {
             throw new CloudRuntimeException("The selected Instance has 
backups, cannot restore and attach Volume to the Instance.");

Review Comment:
   @JoaoJandre, I know that this is not related to KBOSS, but I have run into 
this error message and it is misleading: The selected VM has a backup offering, 
and not necessarily backups.
   
   ```suggestion
               throw new CloudRuntimeException("The selected VM is attached to 
a backup offering. Thus, it is not possible to restore and attach volumes from 
backups to the instance.");
   ```



-- 
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