You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/08/08 20:55:24 UTC
[36/43] git commit: kvm: Only select emulators which are x84_64
architecture
kvm: Only select emulators which are x84_64 architecture
Libvirt can also return a bunch of emulators for eg ARM and S390
We filter those out since we do not support these architectures.
This way we don't try to start a x86_64 instance with a S390 emulator
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/f1053f3e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/f1053f3e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/f1053f3e
Branch: refs/heads/vpc
Commit: f1053f3e3ede43522f5a58d76d3fdc59b3224a26
Parents: a1b9b52
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Tue Aug 7 23:16:22 2012 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Tue Aug 7 23:17:52 2012 +0200
----------------------------------------------------------------------
.../kvm/resource/LibvirtCapXMLParser.java | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f1053f3e/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java
index 4c12d35..aa0bfe2 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java
@@ -35,6 +35,7 @@ public class LibvirtCapXMLParser extends LibvirtXMLParser {
private boolean _osType = false;
private boolean _domainTypeKVM = false;
private boolean _emulatorFlag = false;
+ private boolean _archTypex86_64 = false;
private final StringBuffer _emulator = new StringBuffer();
private final StringBuffer _capXML = new StringBuffer();
private static final Logger s_logger = Logger
@@ -54,7 +55,8 @@ public class LibvirtCapXMLParser extends LibvirtXMLParser {
_domainTypeKVM = false;
} else if (qName.equalsIgnoreCase("emulator")) {
_emulatorFlag = false;
-
+ } else if (qName.equalsIgnoreCase("arch")) {
+ _archTypex86_64 = false;
} else if (_host) {
_capXML.append("<").append("/").append(qName).append(">");
}
@@ -68,6 +70,7 @@ public class LibvirtCapXMLParser extends LibvirtXMLParser {
} else if (_osType) {
guestOsTypes.add(new String(ch, start, length));
} else if (_emulatorFlag) {
+ s_logger.debug("Found " + new String(ch, start, length) + " as a suiteable emulator");
_emulator.append(ch, start, length);
}
}
@@ -83,6 +86,13 @@ public class LibvirtCapXMLParser extends LibvirtXMLParser {
if (_guest) {
_osType = true;
}
+ } else if (qName.equalsIgnoreCase("arch")) {
+ for (int i = 0; i < attributes.getLength(); i++) {
+ if (attributes.getQName(i).equalsIgnoreCase("name")
+ && attributes.getValue(i).equalsIgnoreCase("x86_64")) {
+ _archTypex86_64 = true;
+ }
+ }
} else if (qName.equalsIgnoreCase("domain")) {
for (int i = 0; i < attributes.getLength(); i++) {
if (attributes.getQName(i).equalsIgnoreCase("type")
@@ -90,7 +100,7 @@ public class LibvirtCapXMLParser extends LibvirtXMLParser {
_domainTypeKVM = true;
}
}
- } else if (qName.equalsIgnoreCase("emulator") && _domainTypeKVM) {
+ } else if (qName.equalsIgnoreCase("emulator") && _domainTypeKVM && _archTypex86_64) {
_emulatorFlag = true;
_emulator.delete(0, _emulator.length());
} else if (_host) {