mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7445: Number whitespaces in "rbd showmapped" command varies in plain format. Use regex in grep to workaround.
This commit is contained in:
parent
55983d47c0
commit
718fd5f39f
@ -947,7 +947,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||||||
if (resource.getHypervisorType() == Hypervisor.HypervisorType.LXC) {
|
if (resource.getHypervisorType() == Hypervisor.HypervisorType.LXC) {
|
||||||
String[] splitPoolImage = attachingDisk.getPath().split("/");
|
String[] splitPoolImage = attachingDisk.getPath().split("/");
|
||||||
//ToDo: rbd showmapped supports json and xml output. Use json/xml to get device
|
//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");
|
String device = Script.runSimpleBashScript("rbd showmapped | grep \""+splitPoolImage[0]+"[ ]*"+splitPoolImage[1]+"\" | grep -o \"[^ ]*[ ]*$\"");
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
s_logger.debug("RBD device on host is: "+device);
|
s_logger.debug("RBD device on host is: "+device);
|
||||||
attachingDisk.setPath(device);
|
attachingDisk.setPath(device);
|
||||||
@ -974,7 +974,7 @@ public class KVMStorageProcessor implements StorageProcessor {
|
|||||||
//Split pool and image details from disk path
|
//Split pool and image details from disk path
|
||||||
String[] splitPoolImage = attachingDisk.getPath().split("/");
|
String[] splitPoolImage = attachingDisk.getPath().split("/");
|
||||||
//ToDo: rbd showmapped supports json and xml output. Use json/xml to get device
|
//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");
|
String device = Script.runSimpleBashScript("rbd showmapped | grep \""+splitPoolImage[0]+"[ ]*"+splitPoolImage[1]+"\" | grep -o \"[^ ]*[ ]*$\"");
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
s_logger.debug("RBD device on host is: "+device);
|
s_logger.debug("RBD device on host is: "+device);
|
||||||
diskdef.defBlockBasedDisk(device, devId, DiskDef.diskBus.VIRTIO);
|
diskdef.defBlockBasedDisk(device, devId, DiskDef.diskBus.VIRTIO);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user