[gnome-boxes] vm-configurator: Handle "no cpu" case gracefully
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] vm-configurator: Handle "no cpu" case gracefully
- Date: Fri, 10 Apr 2015 20:33:58 +0000 (UTC)
commit a6970ac521e783e142ff4a294d7c828380a0bdbf
Author: Christophe Fergeau <cfergeau redhat com>
Date: Mon Mar 23 16:55:03 2015 +0100
vm-configurator: Handle "no cpu" case gracefully
A domain config can contain no CPU node (for example if it was removed
using virsh edit). Such a domain triggers a warning on Boxes startup:
(gnome-boxes:15373): Libvirt.GConfig-CRITICAL **: gvir_config_domain_cpu_get_mode: assertion
'GVIR_CONFIG_IS_DOMAIN_CPU(cpu)' failed
This commit makes sure we got a non-null GVirConfigDomainCpu before
attempting to call get_mode() on it.
https://bugzilla.gnome.org/show_bug.cgi?id=746656
src/vm-configurator.vala | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 2b42a6c..f3978c5 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -234,9 +234,10 @@ private class Boxes.VMConfigurator {
public static async void update_existing_domain (Domain domain,
GVir.Connection connection) {
try {
- var mode = domain.get_cpu ().get_mode ();
- if ((mode == DomainCpuMode.HOST_PASSTHROUGH ||
- mode == DomainCpuMode.HOST_MODEL) &&
+ var cpu = domain.get_cpu ();
+ if (cpu != null &&
+ (cpu.get_mode () == DomainCpuMode.HOST_PASSTHROUGH ||
+ cpu.get_mode() == DomainCpuMode.HOST_MODEL) &&
is_boxes_installed (domain)) {
var capabilities = yield connection.get_capabilities_async (null);
set_cpu_config (domain, capabilities);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]