cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject git commit: updated refs/heads/master to 3fb58c4
Date Fri, 02 Aug 2013 11:19:27 GMT
Updated Branches:
  refs/heads/master 514cb9190 -> 3fb58c42c


CLOUDSTACK-4004: Fix attaching a newly allocated RBD image to an Instance

Signed-off-by: Wido den Hollander <wido@42on.com>


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

Branch: refs/heads/master
Commit: 3fb58c42c4835cfaf635c83e2527c541844f7672
Parents: 514cb91
Author: Wido den Hollander <wido@42on.com>
Authored: Thu Aug 1 11:08:56 2013 +0200
Committer: Wido den Hollander <wido@42on.com>
Committed: Fri Aug 2 13:19:12 2013 +0200

----------------------------------------------------------------------
 .../cloud/hypervisor/kvm/resource/LibvirtVMDef.java |  2 +-
 .../hypervisor/kvm/storage/KVMStorageProcessor.java | 16 ++++++++++++----
 .../kvm/storage/LibvirtStorageAdaptor.java          |  4 ++--
 3 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3fb58c42/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 9a3bef9..6aaabc5 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -384,7 +384,7 @@ public class LibvirtVMDef {
             }
         }
 
-        enum diskProtocol {
+        public enum diskProtocol {
             RBD("rbd"), SHEEPDOG("sheepdog");
             String _diskProtocol;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3fb58c42/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
index 35cdaf3..783c65e 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
@@ -67,6 +67,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource;
 import com.cloud.hypervisor.kvm.resource.LibvirtConnection;
 import com.cloud.hypervisor.kvm.resource.LibvirtDomainXMLParser;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol;
 import com.cloud.storage.JavaStorageLayer;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Storage.StoragePoolType;
@@ -626,6 +627,7 @@ public class KVMStorageProcessor implements StorageProcessor {
         List<DiskDef> disks = null;
         Domain dm = null;
         DiskDef diskdef = null;
+        KVMStoragePool attachingPool = attachingDisk.getPool();
         try {
             if (!attach) {
                 dm = conn.domainLookupByName(vmName);
@@ -646,11 +648,17 @@ public class KVMStorageProcessor implements StorageProcessor {
                 }
             } else {
                 diskdef = new DiskDef();
-                if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
-                    diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, DiskDef.diskBus.VIRTIO,
-                            DiskDef.diskFmtType.QCOW2);
+                if (attachingPool.getType() == StoragePoolType.RBD) {
+                    diskdef.defNetworkBasedDisk(attachingDisk.getPath(),
+                            attachingPool.getSourceHost(), attachingPool.getSourcePort(),
+                            attachingPool.getAuthUserName(), attachingPool.getUuid(), devId,
+                            DiskDef.diskBus.VIRTIO, diskProtocol.RBD);
+                } else if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
+                    diskdef.defFileBasedDisk(attachingDisk.getPath(), devId,
+                            DiskDef.diskBus.VIRTIO, DiskDef.diskFmtType.QCOW2);
                 } else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
-                    diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, DiskDef.diskBus.VIRTIO);
+                    diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId,
+                            DiskDef.diskBus.VIRTIO);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3fb58c42/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 dae25ae..b8a9f0f 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
@@ -634,7 +634,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
             format = PhysicalDiskFormat.RAW;
 
             try {
-                s_logger.info("Creating RBD image " + pool.getSourcePort() + "/" + name +
" with size " + size);
+                s_logger.info("Creating RBD image " + pool.getSourceDir() + "/" + name +
" with size " + size);
 
                 Rados r = new Rados(pool.getAuthUserName());
                 r.confSet("mon_host", pool.getSourceHost() + ":" + pool.getSourcePort());
@@ -653,7 +653,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
                 throw new CloudRuntimeException(e.toString());
             }
 
-            volPath = name;
+            volPath = pool.getSourceDir() + "/" + name;
             volName = name;
             volCapacity = size;
             volAllocation = size;


Mime
View raw message