[gnome-boxes] LibvirtBroker: Add & use update_existing_domain
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] LibvirtBroker: Add & use update_existing_domain
- Date: Mon, 15 Sep 2014 19:22:50 +0000 (UTC)
commit aa60b14395c726c70c3ac187ebdc133baab460bc
Author: Timm Bäder <mail baedert org>
Date: Fri Sep 12 18:00:58 2014 +0200
LibvirtBroker: Add & use update_existing_domain
This function will be responsible for updating configuration of
existing/old domains that were created by Boxes. For now it only updates
the "host-passthrough" CPU model using configurations to use custom CPU
model instead (just like we do for new domains now).
LibvirtBroker calls this function on all domains on the default
(session) libvirt connection.
This enables snapshots for existing/old domains that are still using
"host-passthrough".
https://bugzilla.gnome.org/show_bug.cgi?id=735685
src/libvirt-broker.vala | 12 ++++++++++++
src/vm-configurator.vala | 13 +++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/libvirt-broker.vala b/src/libvirt-broker.vala
index a5bdb7b..c366c1a 100644
--- a/src/libvirt-broker.vala
+++ b/src/libvirt-broker.vala
@@ -35,6 +35,18 @@ private class Boxes.LibvirtBroker : Boxes.Broker {
App.app.collection.add_item (machine);
domain.set_data<LibvirtMachine> ("machine", machine);
+ if (source.name != App.DEFAULT_SOURCE_NAME)
+ return machine;
+
+
+ try {
+ var config = machine.domain.get_config (0);
+ yield VMConfigurator.update_existing_domain (config, connection);
+ machine.domain.set_config (config);
+ } catch (GLib.Error e) {
+ warning ("Failed to update domain '%s': %s", domain.get_name (), e.message);
+ }
+
return machine;
}
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 57ad212..11dd170 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -226,6 +226,19 @@ private class Boxes.VMConfigurator {
domain.set_cpu (cpu);
}
+ public static async void update_existing_domain (Domain domain,
+ GVir.Connection connection) {
+ try {
+ if (domain.get_cpu ().get_mode () == DomainCpuMode.HOST_PASSTHROUGH &&
+ is_boxes_installed (domain)) {
+ var capabilities = yield connection.get_capabilities_async (null);
+ set_cpu_config (domain, capabilities);
+ }
+ } catch (GLib.Error e) {
+ warning ("Failed to update CPU config for '%s': %s", domain.name, e.message);
+ }
+ }
+
private static void set_target_media_config (Domain domain, string target_path, InstallerMedia
install_media) {
var disk = new DomainDisk ();
disk.set_type (DomainDiskType.FILE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]