[gnome-boxes] Handle topology node missing from libvirt capabilities
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Handle topology node missing from libvirt capabilities
- Date: Thu, 4 Oct 2012 09:22:25 +0000 (UTC)
commit 58d5ee3d21e4c307ff1e81f28ba033e4d3bd75a8
Author: Christophe Fergeau <cfergeau redhat com>
Date: Tue Oct 2 17:46:27 2012 +0200
Handle topology node missing from libvirt capabilities
The <topology> node is not always present in libvirt capabilities
XML (happened to me when running virsh capabilities in a F18 VM
running on a F18 host). Boxes does not handle this situation, and
tries to use the NULL capabilities pointer, which causes it to
try to create a box with 0 vcpus, which is rejected by libvirt.
This patch checks for NULL capabilities pointers, and falls back to
not setting vcpu count nor topology when this happens as both attributes
are optional. With this change, I can successfully create a box when Boxes
is running in a VM.
https://bugzilla.gnome.org/show_bug.cgi?id=685377
src/vm-configurator.vala | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index de8b356..b7d74d0 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -164,6 +164,9 @@ private class Boxes.VMConfigurator {
private static void set_cpu_config (Domain domain, Capabilities caps) {
var topology = caps.get_host ().get_cpu ().get_topology ();
+ if (topology == null)
+ return;
+
domain.vcpu = topology.get_sockets () * topology.get_cores () * topology.get_threads ();
var cpu = new DomainCpu ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]