Damans227 commented on code in PR #14389:
URL: https://github.com/apache/cloudstack/pull/14389#discussion_r4296844998


##########
plugins/storage/volume/storpool/src/main/java/org/apache/cloudstack/storage/datastore/driver/StorPoolPrimaryDataStoreDriver.java:
##########
@@ -1367,6 +1377,120 @@ public Pair<Long, Long> getVolumeStats(StoragePool 
storagePool, String volumeId)
         return null;
     }
 
+    /**
+     * Lists StorPool volumes available for import (globalId name, no "cs" tag 
unless
+     * {@code forUnmanage}). When {@code volumePath} is given, looks up that 
one volume directly
+     * instead of browsing the whole pool; when {@code forUnmanage} is also 
true, an already
+     * "cs"-tagged volume is still returned, since the caller is 
unmanageVolume() looking for the
+     * very volume it is about to drop from CloudStack.
+     */
+    @Override
+    public List<VolumeOnStorageTO> listVolumesForImport(StoragePool pool, 
String volumePath, String keyword, boolean forUnmanage) {
+        
StorPoolUtil.spLog("StorPoolPrimaryDataStoreDriver.listVolumesForImport: 
pool=%s, volumePath=%s, keyword=%s, forUnmanage=%s", pool.getName(), 
volumePath, keyword, forUnmanage);
+        SpConnectionDesc conn = StorPoolUtil.getSpConnection(pool.getUuid(), 
pool.getId(), storagePoolDetailsDao, primaryStoreDao);
+        List<VolumeOnStorageTO> volumes = new ArrayList<>();
+
+        if (StringUtils.isNotBlank(volumePath)) {
+            return getVolumeOnStorageByPath(pool, volumePath, conn, volumes, 
forUnmanage);
+        }
+
+        SpApiResponse resp = StorPoolUtil.volumesListResponse(conn);

Review Comment:
   ok, makes sense. once a disk is imported it gets the cs tag and drops off 
every pool's list, so it cant come in twice



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