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


##########
plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/driver/LinstorPrimaryDataStoreDriverImpl.java:
##########
@@ -403,6 +403,29 @@ private void deleteTemplateForProps(
         }
     }
 
+    /**
+     * Request the target size as part of the clone if the controller supports 
it.
+     *
+     * A clone reports COMPLETE as soon as every replica can access UpToDate 
data, which with
+     * Clone/BalanceAfterClone is while the additional replica is still 
syncing. A resize issued at that
+     * point is rejected with "Cannot resize volume, because we have a 
non-UpToDate DRBD device".
+     * Controllers with REST API 1.29.1+ take the size in the clone request 
and grow the volume inside the
+     * clone before the balance placement, so the race cannot occur. Older 
controllers keep the
+     * clone-then-resize sequence.
+     *
+     * @return true if the caller still has to resize the resource after the 
clone finished
+     */
+    static boolean applyCloneSize(DevelopersApi api, 
ResourceDefinitionCloneRequest cloneRequest, Long sizeByte) {
+        if (sizeByte == null || sizeByte <= 0) {
+            return false;
+        }
+        if (LinstorUtil.supportsCloneVolumeSizes(api)) {
+            cloneRequest.setVolumeSizes(Collections.singletonList(sizeByte / 
1024));

Review Comment:
   makes sense, that covers it. thanks



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