Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4ABFA9DC8 for ; Tue, 14 May 2013 15:53:02 +0000 (UTC) Received: (qmail 74318 invoked by uid 500); 14 May 2013 15:53:02 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 74245 invoked by uid 500); 14 May 2013 15:53:02 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 74238 invoked by uid 99); 14 May 2013 15:53:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2013 15:53:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D899185E6; Tue, 14 May 2013 15:53:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: widodh@apache.org To: commits@cloudstack.apache.org Message-Id: <00c79b65af404057a94bb199a0619ff4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/rbd-snap-clone to af1ac35 Date: Tue, 14 May 2013 15:53:01 +0000 (UTC) Updated Branches: refs/heads/rbd-snap-clone 099ceb9f3 -> af1ac3575 rbd: Use the name instead of the path for the image name The path variable contains the pool name which we don't need Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/af1ac357 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/af1ac357 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/af1ac357 Branch: refs/heads/rbd-snap-clone Commit: af1ac35751544b7a2e7326d42ffed443e3986ea6 Parents: 099ceb9 Author: Wido den Hollander Authored: Tue May 14 17:49:47 2013 +0200 Committer: Wido den Hollander Committed: Tue May 14 17:49:47 2013 +0200 ---------------------------------------------------------------------- .../kvm/storage/LibvirtStorageAdaptor.java | 22 +++++++------- 1 files changed, 11 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/af1ac357/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 0024173..5ecba41 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 @@ -731,10 +731,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { IoCTX io = r.ioCtxCreate(srcPool.getSourceDir()); Rbd rbd = new Rbd(io); - RbdImage image = rbd.open(template.getPath()); + RbdImage image = rbd.open(template.getName()); if (image.isOldFormat()) { - s_logger.debug("The source image " + template.getPath() + " is RBD format 1. We have to perform a regular copy"); + s_logger.debug("The source image " + template.getName() + " is RBD format 1. We have to perform a regular copy"); /* The source image is RBD format 1, we have to do a regular copy */ template.setFormat(PhysicalDiskFormat.RAW); srcFile = new QemuImgFile(KVMPhysicalDisk.RBDStringBuilder(srcPool.getSourceHost(), @@ -745,13 +745,13 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { srcFile.setFormat(template.getFormat()); qemu.convert(srcFile, destFile); } else { - s_logger.debug("The source image " + template.getPath() + " is RBD format 2. We will perform a RBD clone using snapshot " + s_logger.debug("The source image " + template.getName() + " is RBD format 2. We will perform a RBD clone using snapshot " + this.rbdTemplateSnapName); /* The source image is format 2, we can do a RBD snapshot+clone (layering) */ /* Feature 1<<0 means layering in RBD format 2 */ int rbdFeatures = (1<<0); int rbdOrder = 0; - rbd.clone(template.getPath(), this.rbdTemplateSnapName, io, disk.getPath(), rbdFeatures, rbdOrder); + rbd.clone(template.getName(), this.rbdTemplateSnapName, io, disk.getName(), rbdFeatures, rbdOrder); } rbd.close(image); @@ -890,7 +890,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { * A HUGE performance gain can be achieved here if QCOW2 -> RBD format 2 can be done in one step */ s_logger.debug("The source image is not RBD, but the destination is. We will convert into RBD format 2"); - String tmpFile = "/tmp/" + destPath; + String tmpFile = "/tmp/" + name; int rbdFeatures = (1<<0); int rbdOrder = 0; @@ -909,10 +909,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { IoCTX io = r.ioCtxCreate(destPool.getSourceDir()); Rbd rbd = new Rbd(io); - s_logger.debug("Creating RBD image " + destPath + " in Ceph pool " + destPool.getSourceDir() + " with RBD format 2"); - rbd.create(destPath, disk.getVirtualSize(), rbdFeatures, rbdOrder); + s_logger.debug("Creating RBD image " + name + " in Ceph pool " + destPool.getSourceDir() + " with RBD format 2"); + rbd.create(name, disk.getVirtualSize(), rbdFeatures, rbdOrder); - RbdImage image = rbd.open(destPath); + RbdImage image = rbd.open(name); // We now read the temporary file and write it to the RBD image File fh = new File(tmpFile); @@ -921,7 +921,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { int chunkSize = 4194304; int offset = 0; byte[] buf = new byte[chunkSize]; - s_logger.debug("Reading temporary file " + tmpFile + " into RBD image " + destPath + " in chunks of " + chunkSize + " bytes"); + s_logger.debug("Reading temporary file " + tmpFile + " into RBD image " + name + " in chunks of " + chunkSize + " bytes"); while(true) { int bytes = bis.read(buf); if (bytes < 0 ) { @@ -932,9 +932,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } /* Snapshot the image and protect that snapshot so we can clone (layer) from it */ - s_logger.debug("Creating RBD snapshot " + this.rbdTemplateSnapName + " on image " + destPath); + s_logger.debug("Creating RBD snapshot " + this.rbdTemplateSnapName + " on image " + name); image.snapCreate(this.rbdTemplateSnapName); - s_logger.debug("Protecting RBD snapshot " + this.rbdTemplateSnapName + " on image " + destPath); + s_logger.debug("Protecting RBD snapshot " + this.rbdTemplateSnapName + " on image " + name); image.snapProtect(this.rbdTemplateSnapName); rbd.close(image);