You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by nv...@apache.org on 2022/04/27 10:24:59 UTC

[cloudstack] branch main updated: Disable creating StorPool logs when there isn't StorPool primary storage (#6317)

This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new 453bb57fd2 Disable creating StorPool logs when there isn't StorPool primary storage (#6317)
453bb57fd2 is described below

commit 453bb57fd254c2b02878549b0729a5448c7401d9
Author: slavkap <51...@users.noreply.github.com>
AuthorDate: Wed Apr 27 13:24:44 2022 +0300

    Disable creating StorPool logs when there isn't StorPool primary storage (#6317)
    
    There is not need to create log files for StorPool driver when there
    isn't a StorPool primary storage
---
 .../storage/collector/StorPoolAbandonObjectsCollector.java          | 6 +++++-
 .../storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java    | 2 +-
 .../cloudstack/storage/snapshot/StorPoolSnapshotStrategy.java       | 6 +++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java
index 499d0630b8..f4821e2692 100644
--- a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java
+++ b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/collector/StorPoolAbandonObjectsCollector.java
@@ -89,9 +89,13 @@ public class StorPoolAbandonObjectsCollector extends ManagerBase implements Conf
     }
 
     private void init() {
+        List<StoragePoolVO> spPools = storagePoolDao.findPoolsByProvider(StorPoolUtil.SP_PROVIDER_NAME);
+        if (CollectionUtils.isNotEmpty(spPools)) {
+            StorPoolHelper.appendLogger(log, ABANDON_LOG, "abandon");
+        }
         _volumeTagsUpdateExecutor = Executors.newScheduledThreadPool(2,
                 new NamedThreadFactory("StorPoolAbandonObjectsCollector"));
-        StorPoolHelper.appendLogger(log, ABANDON_LOG, "abandon");
+
         if (volumeCheckupTagsInterval.value() > 0) {
             _volumeTagsUpdateExecutor.scheduleAtFixedRate(new StorPoolVolumesTagsUpdate(),
                     volumeCheckupTagsInterval.value(), volumeCheckupTagsInterval.value(), TimeUnit.SECONDS);
diff --git a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java
index 97b15d847f..e9429c274f 100644
--- a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java
@@ -898,7 +898,7 @@ public class StorPoolPrimaryDataStoreDriver implements PrimaryDataStoreDriver {
     }
 
     public void handleQualityOfServiceForVolumeMigration(VolumeInfo arg0, QualityOfServiceState arg1) {
-        StorPoolUtil.spLog("handleQualityOfServiceForVolumeMigration with volume name=%s", arg0.getName());
+        log.debug(String.format("handleQualityOfServiceForVolumeMigration with volume name=%s is not supported", arg0.getName()));
     }
 
 
diff --git a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/snapshot/StorPoolSnapshotStrategy.java b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/snapshot/StorPoolSnapshotStrategy.java
index f66617d8f3..35731e6a84 100644
--- a/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/snapshot/StorPoolSnapshotStrategy.java
+++ b/plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/snapshot/StorPoolSnapshotStrategy.java
@@ -81,11 +81,11 @@ public class StorPoolSnapshotStrategy implements SnapshotStrategy {
             snapshotObj.processEvent(Snapshot.Event.BackupToSecondary);
             snapshotObj.processEvent(Snapshot.Event.OperationSucceeded);
         } catch (NoTransitionException ex) {
-            StorPoolUtil.spLog("Failed to change state: " + ex.toString());
+            log.debug("Failed to change state: " + ex.toString());
             try {
                 snapshotObj.processEvent(Snapshot.Event.OperationFailed);
             } catch (NoTransitionException ex2) {
-                StorPoolUtil.spLog("Failed to change state: " + ex2.toString());
+                log.debug("Failed to change state: " + ex2.toString());
             }
         }
         return snapshotInfo;
@@ -126,7 +126,7 @@ public class StorPoolSnapshotStrategy implements SnapshotStrategy {
 
     @Override
     public StrategyPriority canHandle(Snapshot snapshot, SnapshotOperation op) {
-        StorPoolUtil.spLog("StorpoolSnapshotStrategy.canHandle: snapshot=%s, uuid=%s, op=%s", snapshot.getName(), snapshot.getUuid(), op);
+        log.debug(String.format("StorpoolSnapshotStrategy.canHandle: snapshot=%s, uuid=%s, op=%s", snapshot.getName(), snapshot.getUuid(), op));
 
         if (op != SnapshotOperation.DELETE) {
             return StrategyPriority.CANT_HANDLE;