mirror of https://github.com/apache/cloudstack.git
Set mapped device path while detaching rbd disk
This commit is contained in:
parent
4bf321bd03
commit
7d3f381d94
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -91,4 +91,9 @@ public class KVMPhysicalDisk {
|
|||
public KVMStoragePool getPool() {
|
||||
return this.pool;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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())) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue