mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
kvm: Fix RBD primary storage host port null error (#4565)
Add RBD main storage through UI, it will fail when there is no host port parameter; Because when we created the pool, we did not add the port target in the xml
This commit is contained in:
parent
b482da8c91
commit
c9a1d300cb
@ -84,7 +84,11 @@ public class LibvirtDomainXMLParser {
|
||||
String authUserName = getAttrValue("auth", "username", disk);
|
||||
String poolUuid = getAttrValue("secret", "uuid", disk);
|
||||
String host = getAttrValue("host", "name", disk);
|
||||
int port = Integer.parseInt(getAttrValue("host", "port", disk));
|
||||
int port = 0;
|
||||
String xmlPort = getAttrValue("host", "port", disk);
|
||||
if (StringUtils.isNotBlank(xmlPort)) {
|
||||
port = Integer.parseInt(xmlPort);
|
||||
}
|
||||
String diskLabel = getAttrValue("target", "dev", disk);
|
||||
String bus = getAttrValue("target", "bus", disk);
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
@ -55,7 +56,11 @@ public class LibvirtStoragePoolXMLParser {
|
||||
String format = getAttrValue("format", "type", source);
|
||||
|
||||
if (type.equalsIgnoreCase("rbd")) {
|
||||
int port = Integer.parseInt(getAttrValue("host", "port", source));
|
||||
int port = 0;
|
||||
String xmlPort = getAttrValue("host", "port", source);
|
||||
if (StringUtils.isNotBlank(xmlPort)) {
|
||||
port = Integer.parseInt(xmlPort);
|
||||
}
|
||||
String pool = getTagValue("name", source);
|
||||
|
||||
Element auth = (Element)source.getElementsByTagName("auth").item(0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user