You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/05/21 07:24:44 UTC

[GitHub] rhtyd closed pull request #2655: Handle Ceph.

rhtyd closed pull request #2655: Handle Ceph.
URL: https://github.com/apache/cloudstack/pull/2655
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
index 67ec1b731af..067e77df3cf 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
@@ -45,6 +45,7 @@
 
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.libvirt.Connect;
 import org.libvirt.Domain;
@@ -332,9 +333,9 @@ private String replaceStorage(String xmlDesc, Map<String, MigrateCommand.Migrate
                     if ("disk".equals(deviceChildNode.getNodeName())) {
                         Node diskNode = deviceChildNode;
 
-                        String sourceFileDevText = getSourceFileDevText(diskNode);
+                        String sourceText = getSourceText(diskNode);
 
-                        String path = getPathFromSourceFileDevText(migrateStorage.keySet(), sourceFileDevText);
+                        String path = getPathFromSourceText(migrateStorage.keySet(), sourceText);
 
                         if (path != null) {
                             MigrateCommand.MigrateDiskInfo migrateDiskInfo = migrateStorage.remove(path);
@@ -383,10 +384,10 @@ private String replaceStorage(String xmlDesc, Map<String, MigrateCommand.Migrate
         return getXml(doc);
     }
 
-    private String getPathFromSourceFileDevText(Set<String> paths, String sourceFileDevText) {
-        if (paths != null && sourceFileDevText != null) {
+    private String getPathFromSourceText(Set<String> paths, String sourceText) {
+        if (paths != null && !StringUtils.isBlank(sourceText)) {
             for (String path : paths) {
-                if (sourceFileDevText.contains(path)) {
+                if (sourceText.contains(path)) {
                     return path;
                 }
             }
@@ -395,7 +396,7 @@ private String getPathFromSourceFileDevText(Set<String> paths, String sourceFile
         return null;
     }
 
-    private String getSourceFileDevText(Node diskNode) {
+    private String getSourceText(Node diskNode) {
         NodeList diskChildNodes = diskNode.getChildNodes();
 
         for (int i = 0; i < diskChildNodes.getLength(); i++) {
@@ -415,6 +416,20 @@ private String getSourceFileDevText(Node diskNode) {
                 if (diskNodeAttribute != null) {
                     return diskNodeAttribute.getTextContent();
                 }
+
+                diskNodeAttribute = diskNodeAttributes.getNamedItem("protocol");
+
+                if (diskNodeAttribute != null) {
+                    String textContent = diskNodeAttribute.getTextContent();
+
+                    if ("rbd".equalsIgnoreCase(textContent)) {
+                        diskNodeAttribute = diskNodeAttributes.getNamedItem("name");
+
+                        if (diskNodeAttribute != null) {
+                            return diskNodeAttribute.getTextContent();
+                        }
+                    }
+                }
             }
         }
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services