You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2013/05/14 17:53:01 UTC
git commit: updated refs/heads/rbd-snap-clone to af1ac35
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 <wi...@widodh.nl>
Authored: Tue May 14 17:49:47 2013 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
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);