andrijapanicsb commented on code in PR #14256:
URL: https://github.com/apache/cloudstack/pull/14256#discussion_r4186720882


##########
plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java:
##########
@@ -593,7 +593,30 @@ public KVMPhysicalDisk createDiskFromTemplate(
     @Override
     public List<KVMPhysicalDisk> listPhysicalDisks(String storagePoolUuid, 
KVMStoragePool pool)
     {
-        throw new UnsupportedOperationException("Listing disks is not 
supported for this configuration.");
+        logger.debug("Linstor: listPhysicalDisks for pool {}", 
storagePoolUuid);
+        final DevelopersApi api = getLinstorAPI(pool);
+        final LinstorStoragePool linstorPool = (LinstorStoragePool) pool;
+        final String rscGroup = linstorPool.getResourceGroup();
+        List<KVMPhysicalDisk> disks = new ArrayList<>();
+        try {
+            List<ResourceDefinition> rscDfns = 
LinstorUtil.getRDListStartingWith(api, LinstorUtil.RSC_PREFIX);
+            for (ResourceDefinition rscDfn : rscDfns) {
+                if (rscGroup != null && 
!rscGroup.equalsIgnoreCase(rscDfn.getResourceGroupName())) {
+                    continue;
+                }
+                String name = 
rscDfn.getName().substring(LinstorUtil.RSC_PREFIX.length());

Review Comment:
   Thanks for the concrete cross-pool example — the stopped-VM case makes it 
clear why an in-use check alone is insufficient. Addressed in 01058cd674.
   
   Both DATA-volume import and shared-storage VM/ROOT import now validate the 
resource definition’s group against the selected pool’s group on the management 
server, before agent inspection and allocation. The VM import path also 
revalidates against the actual deployment pool before CheckVolume. Agent-side 
LINSTOR inspection independently enforces the same group check.
   
   A mismatch, missing resource or failed ownership lookup rejects the import 
rather than allowing it to proceed. Regression tests cover cross-group 
rejection in both management paths and agent-side validation.
   
   Across these fixes, the targeted local Maven run passed 195 unit tests with 
Checkstyle enabled. 
   
   Package rebuild and live LINSTOR/E2E validation are still pending.



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