You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ra...@apache.org on 2014/09/04 11:26:47 UTC

git commit: updated refs/heads/master to 17164c3

Repository: cloudstack
Updated Branches:
  refs/heads/master 355eb72c7 -> 17164c3c8


Fixed CLOUDSTACK-6942: LXC: optimize template copy to primary

saving LXC template as tar to primary and extracting it only when
required.
This would improve the template copy time.

Reviewed By: Kishan Kavala


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

Branch: refs/heads/master
Commit: 17164c3c8387c2678e42ca4ceeabcc66b2844c25
Parents: 355eb72
Author: Rajani Karuturi <ra...@gmail.com>
Authored: Thu Sep 4 14:37:10 2014 +0530
Committer: Rajani Karuturi <ra...@gmail.com>
Committed: Thu Sep 4 14:56:29 2014 +0530

----------------------------------------------------------------------
 .../cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/17164c3c/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 e99d7fa..07fd4b1 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
@@ -890,7 +890,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
                 } else if (template.getFormat() == PhysicalDiskFormat.DIR) {
                     Script.runSimpleBashScript("mkdir -p " + disk.getPath());
                     Script.runSimpleBashScript("chmod 755 " + disk.getPath());
-                    Script.runSimpleBashScript("cp -p -r " + template.getPath() + "/* " + disk.getPath(), timeout); // TO BE FIXED to aware provisioningType
+                    Script.runSimpleBashScript("tar -x -f " + template.getPath() + "/*.tar -C " + disk.getPath(), timeout);
                 } else if (format == PhysicalDiskFormat.QCOW2) {
                     QemuImg qemu = new QemuImg(timeout);
                     QemuImgFile destFile = new QemuImgFile(disk.getPath(), format);
@@ -1183,7 +1183,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
         QemuImgFile destFile = null;
 
         if ((srcPool.getType() != StoragePoolType.RBD) && (destPool.getType() != StoragePoolType.RBD)) {
-            if (sourceFormat == PhysicalDiskFormat.TAR) {
+            if(sourceFormat == PhysicalDiskFormat.TAR && destFormat == PhysicalDiskFormat.DIR) { //LXC template
+                Script.runSimpleBashScript("cp "+ sourcePath + " " + destPath);
+            } else if (sourceFormat == PhysicalDiskFormat.TAR) {
                 Script.runSimpleBashScript("tar -x -f " + sourcePath + " -C " + destPath, timeout);
             } else if (sourceFormat == PhysicalDiskFormat.DIR) {
                 Script.runSimpleBashScript("mkdir -p " + destPath);