cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [44/47] git commit: updated refs/heads/rbd-snap-clone to 30acdb7
Date Tue, 14 May 2013 13:58:03 GMT
rbd: Use a static snapshot name for templates

We will never create multiple snapshots of the same base image


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/30acdb7d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/30acdb7d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/30acdb7d

Branch: refs/heads/rbd-snap-clone
Commit: 30acdb7d3ac0d4964f354f9864670a1f0ca6a602
Parents: 664fcb8
Author: Wido den Hollander <wido@widodh.nl>
Authored: Tue May 14 15:45:19 2013 +0200
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Tue May 14 15:56:57 2013 +0200

----------------------------------------------------------------------
 .../kvm/storage/LibvirtStorageAdaptor.java         |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30acdb7d/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index c15e020..b49142c 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -72,6 +72,8 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
     private String _mountPoint = "/mnt";
     private String _manageSnapshotPath;
 
+    private String rbdTemplateSnapName = "cloudstack-base-snap";
+
     public LibvirtStorageAdaptor(StorageLayer storage) {
         _storageLayer = storage;
         _manageSnapshotPath = Script.findScript("scripts/storage/qcow2/",
@@ -741,15 +743,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
                                 qemu.convert(srcFile, destFile);
                             } else {
                                 /* The source image is format 2, we can do a RBD snapshot+clone
(layering) */
-                                String snapName = "snapfortemplate";
-
                                 /* Feature 1<<0 means layering in RBD format 2 */
                                 int rbdFeatures = (1<<0);
                                 int rbdOrder = 0;
-
-                                image.snapCreate(snapName);
-                                image.snapProtect(snapName);
-                                rbd.clone(template.getPath(), snapName, io, disk.getPath(),
rbdFeatures, rbdOrder);
+                                rbd.clone(template.getPath(), this.rbdTemplateSnapName, io,
disk.getPath(), rbdFeatures, rbdOrder);
                             }
 
                             rbd.close(image);
@@ -922,6 +919,11 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
                     image.write(buf, offset);
                     offset += bytes;
                 }
+
+                /* Snapshot the image and protect that snapshot so we can clone (layer) from
it */
+                image.snapCreate(this.rbdTemplateSnapName);
+                image.snapProtect(this.rbdTemplateSnapName);
+
                 rbd.close(image);
                 r.ioCtxDestroy(io);
 


Mime
View raw message