After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685377 - Handle topology node missing from libvirt capabilities
Handle topology node missing from libvirt capabilities
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-10-03 11:39 UTC by Christophe Fergeau
Modified: 2016-03-31 13:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Handle topology node missing from libvirt capabilities (1.49 KB, patch)
2012-10-03 11:39 UTC, Christophe Fergeau
accepted-commit_now Details | Review
Handle topology node missing from libvirt capabilities (1.48 KB, patch)
2012-10-03 15:07 UTC, Christophe Fergeau
accepted-commit_now Details | Review

Description Christophe Fergeau 2012-10-03 11:39:36 UTC
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
creating a VM with 1 vcpu and no topology when this happens. With
this change, I can successfully create a box when Boxes is running
in a VM.
Comment 1 Christophe Fergeau 2012-10-03 11:39:39 UTC
Created attachment 225675 [details] [review]
Handle topology node missing from libvirt capabilities
Comment 2 Zeeshan Ali 2012-10-03 14:31:51 UTC
Review of attachment 225675 [details] [review]:

Assuming the setting of vcpus in the domain is mandatory, ACK!
Comment 3 Christophe Fergeau 2012-10-03 15:07:25 UTC
Created attachment 225687 [details] [review]
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.
Comment 4 Zeeshan Ali 2012-10-03 22:40:47 UTC
Review of attachment 225687 [details] [review]:

ACK with this minor nitpick corrected.

::: src/vm-configurator.vala
@@ +165,3 @@
         var topology = caps.get_host ().get_cpu ().get_topology ();
 
+        if (topology == null) {

coding-style nitpick: no '{' needed.