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

weizhouapache pushed a commit to branch 4.23.0-ceph
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 5e0ee62fdf2cbae31bf22a448861dd9f3ba9c0bc
Author: Brad House - Nexthop <[email protected]>
AuthorDate: Mon Sep 14 04:38:11 2026 -0400

    kvm: apply rbd_default_data_pool when creating volumes from templates on 
RBD (#13361)
    
    RBD erasure-coded pool support (#9808) added handling of the
    rbd_default_data_pool storage-pool detail to RBDStringBuilder (qemu-img
    path) and to createPhysicalDisk (blank volumes), but not to
    createDiskFromTemplateOnRBD. As a result, ROOT volumes created from a
    template via rados-java rbd.clone()/rbd.create() are created without a
    data pool: all of their data objects land in the (replicated) metadata
    pool instead of the erasure-coded data pool, defeating the point of EC
    and consuming ~3x raw space.
    
    Set rbd_default_data_pool on the Rados connection (before connect) in
    both the same-cluster clone/copy branch and the cross-cluster copy
    branch of createDiskFromTemplateOnRBD, using the destination pool's
    detail. librbd then honors it as the default data pool when the new
    image is created, so template-derived volumes get data_pool set, the
    same way blank volumes already do.
---
 .../cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index 794b88165aa..01e8fdcf2ca 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -1281,6 +1281,8 @@ public class LibvirtStorageAdaptor implements 
StorageAdaptor {
          */
 
         KVMStoragePool srcPool = template.getPool();
+        Map<String, String> destDetails = destPool.getDetails();
+        String dataPool = (destDetails == null) ? null : 
destDetails.get(KVMPhysicalDisk.RBD_DEFAULT_DATA_POOL);
         KVMPhysicalDisk disk = null;
         String newUuid = name;
 
@@ -1329,6 +1331,10 @@ public class LibvirtStorageAdaptor implements 
StorageAdaptor {
                     r.confSet("mon_host", srcPool.getSourceHost() + ":" + 
srcPool.getSourcePort());
                     r.confSet("key", srcPool.getAuthSecret());
                     r.confSet("client_mount_timeout", "30");
+                    if (dataPool != null) {
+                        logger.debug("Setting RBD data pool to " + dataPool + 
" for the new image " + disk.getName());
+                        r.confSet(KVMPhysicalDisk.RBD_DEFAULT_DATA_POOL, 
dataPool);
+                    }
                     r.connect();
                     logger.debug("Successfully connected to Ceph cluster at " 
+ r.confGet("mon_host"));
 
@@ -1405,6 +1411,10 @@ public class LibvirtStorageAdaptor implements 
StorageAdaptor {
                     rDest.confSet("mon_host", destPool.getSourceHost() + ":" + 
destPool.getSourcePort());
                     rDest.confSet("key", destPool.getAuthSecret());
                     rDest.confSet("client_mount_timeout", "30");
+                    if (dataPool != null) {
+                        logger.debug("Setting RBD data pool to " + dataPool + 
" on the destination cluster for the new image " + disk.getName());
+                        rDest.confSet(KVMPhysicalDisk.RBD_DEFAULT_DATA_POOL, 
dataPool);
+                    }
                     rDest.connect();
                     logger.debug("Successfully connected to source Ceph 
cluster at " + rDest.confGet("mon_host"));
 

Reply via email to