[gnome-boxes/wip/system-libvirt-import2: 5/13] vm-creator: Refactor config creation code
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/system-libvirt-import2: 5/13] vm-creator: Refactor config creation code
- Date: Sat, 16 Nov 2013 19:39:02 +0000 (UTC)
commit 7fd26e0bad756b730a4022af4d44da1367b335b2
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Sat Nov 2 17:23:33 2013 +0000
vm-creator: Refactor config creation code
Put config creation code into a separate method: create_domain_config.
We keep it protected and virtual cause in a later patch we'll override
this from a new subclass.
src/vm-creator.vala | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index ad0d7c3..e1f72ab 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -49,12 +49,9 @@ private class Boxes.VMCreator {
debug("Disabling unattended installation: %s", error.message);
}
- var volume = yield create_target_volume (name, install_media.resources.storage);
- var caps = yield connection.get_capabilities_async (cancellable);
- var config = VMConfigurator.create_domain_config (install_media, volume.get_path (), caps);
- config.name = name;
- config.title = title;
+ var volume = yield create_target_volume (name, install_media.resources.storage);
+ var config = yield create_domain_config (name, title, volume, cancellable);
var domain = connection.create_domain (config);
var machine = LibvirtBroker.get_default ().add_domain (App.app.default_source,
@@ -208,6 +205,18 @@ private class Boxes.VMCreator {
return pool;
}
+ protected virtual async GVirConfig.Domain create_domain_config (string name,
+ string title,
+ StorageVol volume,
+ Cancellable? cancellable) throws
GLib.Error {
+ var caps = yield connection.get_capabilities_async (cancellable);
+ var config = VMConfigurator.create_domain_config (install_media, volume.get_path (), caps);
+ config.name = name;
+ config.title = title;
+
+ return config;
+ }
+
private void increment_num_reboots (LibvirtMachine machine) {
num_reboots++;
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]