Repository: cloudstack Updated Branches: refs/heads/master 4bf321bd0 -> 7d3f381d9
Set mapped device path while detaching rbd disk Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7d3f381d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7d3f381d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7d3f381d Branch: refs/heads/master Commit: 7d3f381d9476fec5dc7ba1cada8294bcb2df0ffa Parents: 4bf321b Author: Kishan Kavala <kis...@apache.org> Authored: Tue Jul 22 17:50:16 2014 +0530 Committer: Kishan Kavala <kishan.kav...@citrix.com> Committed: Tue Jul 22 17:50:58 2014 +0530 ---------------------------------------------------------------------- .../hypervisor/kvm/resource/LibvirtDomainXMLParser.java | 4 +++- .../cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java | 5 +++++ .../hypervisor/kvm/storage/KVMStorageProcessor.java | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d3f381d/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java index fabe9a8..a0a4ac4 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java @@ -108,7 +108,9 @@ public class LibvirtDomainXMLParser { def.defBlockBasedDisk(diskDev, diskLabel, DiskDef.diskBus.valueOf(bus.toUpperCase())); } - def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode.toUpperCase())); + if (diskCacheMode != null) { + def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode.toUpperCase())); + } } NodeList iotune = disk.getElementsByTagName("iotune"); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d3f381d/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java index 669bd0b..c344e8c 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java @@ -91,4 +91,9 @@ public class KVMPhysicalDisk { public KVMStoragePool getPool() { return this.pool; } + + public void setPath(String path) { + this.path = path; + } + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7d3f381d/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 9b1c9de..5deb636 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 @@ -941,6 +941,18 @@ public class KVMStorageProcessor implements StorageProcessor { parser.parseDomainXML(xml); disks = parser.getDisks(); + if (attachingPool.getType() == StoragePoolType.RBD) { + if (resource.getHypervisorType() == Hypervisor.HypervisorType.LXC) { + String[] splitPoolImage = attachingDisk.getPath().split("/"); + //ToDo: rbd showmapped supports json and xml output. Use json/xml to get device + String device = Script.runSimpleBashScript("rbd showmapped | grep \""+splitPoolImage[0]+" "+splitPoolImage[1]+"\" | cut -d \" \" -f10"); + if (device != null) { + s_logger.debug("RBD device on host is: "+device); + attachingDisk.setPath(device); + } + } + } + for (DiskDef disk : disks) { String file = disk.getDiskPath(); if (file != null && file.equalsIgnoreCase(attachingDisk.getPath())) {