JoaoJandre commented on code in PR #13746:
URL: https://github.com/apache/cloudstack/pull/13746#discussion_r3731323434


##########
plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java:
##########
@@ -252,14 +252,12 @@ public void create(final QemuImgFile file, final 
QemuImgFile backingFile, final
             Shouldn't this be -o backing_file=filename instead?
          */
         s.add("-f");
+        s.add(file.getFormat().toString());

Review Comment:
   Are we sure that the format is passed every time for the file if it has a 
backing file? If so, I think this change is good.



##########
engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/SnapshotDataStoreDaoImpl.java:
##########
@@ -88,14 +91,24 @@ public class SnapshotDataStoreDaoImpl extends 
GenericDaoBase<SnapshotDataStoreVO
     @Inject
     protected ImageStoreDao imageStoreDao;
 
+    @Inject
+    protected VolumeDao volumeDao;
+
+    @Inject
+    protected PrimaryDataStoreDao storagePoolDao;
+
     private static final String FIND_OLDEST_OR_LATEST_SNAPSHOT = "select 
store_id, store_role, snapshot_id from cloud.snapshot_store_ref where " +
             " store_role = ? and volume_id = ? and state = 'Ready'" +
             " order by created %s " +
             " limit 1";
 
+    // prefer the reference carrying the incremental chain link: content-based 
(Linstor) chains only
+    // link their image store reference, the primary one stays unlinked, and 
chain walks (e.g.
+    // snapshot.delta.max enforcement) must not end up on the unlinked copy
     private static final String FIND_SNAPSHOT_IN_ZONE = "SELECT ssr.* FROM " +
             "snapshot_store_ref ssr, snapshots s " +
-            "WHERE ssr.snapshot_id=? AND ssr.snapshot_id = s.id AND 
s.data_center_id=?;";
+            "WHERE ssr.snapshot_id=? AND ssr.snapshot_id = s.id AND 
s.data_center_id=? " +
+            "ORDER BY (ssr.parent_snapshot_id > 0) DESC, 
(ssr.kvm_checkpoint_path IS NOT NULL) DESC LIMIT 1;";

Review Comment:
   We should use a join here instead of Cartesian product, I have no idea why I 
did not do it with a join originally. Could you refactor this?



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