[gnome-boxes/ensure-volume-creation-for-clones: 8/8] libvirt-machine, vm-creator: Ensure volume creation for clones
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/ensure-volume-creation-for-clones: 8/8] libvirt-machine, vm-creator: Ensure volume creation for clones
- Date: Tue, 16 Aug 2022 11:04:31 +0000 (UTC)
commit e68a8ae99e88d20e579b4c9727b6ad8074576528
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Aug 16 12:04:16 2022 +0200
libvirt-machine, vm-creator: Ensure volume creation for clones
This is a bit ugly, but we will eventually pay our technical debt
by reworking the little monster that VM creation/cloning/imported
has become over the years due to the excess of abstraction.
src/libvirt-machine.vala | 2 +-
src/vm-creator.vala | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index df5f39a6..052c4644 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -573,7 +573,7 @@ public override async void clone () {
var media = new LibvirtClonedMedia (storage_volume.get_path (), config);
var vm_cloner = media.get_vm_creator ();
- var clone_machine = yield vm_cloner.create_vm (null);
+ var clone_machine = yield vm_cloner.create_vm (null, true);
vm_cloner.launch_vm (clone_machine, this.config.access_last_time, true);
ulong under_construct_id = 0;
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 1f41758b..4d84bf18 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -36,7 +36,7 @@ public VMCreator (InstallerMedia install_media) {
continue_installation.begin (machine);
}
- public async LibvirtMachine create_vm (Cancellable? cancellable) throws GLib.Error {
+ public async LibvirtMachine create_vm (Cancellable? cancellable, bool clone = false) throws GLib.Error {
if (connection == null) {
// Wait for needed libvirt connection
ulong handler = 0;
@@ -53,7 +53,7 @@ public async LibvirtMachine create_vm (Cancellable? cancellable) throws GLib.Err
yield install_media.prepare_for_installation (name, cancellable);
string? volume_path = null;
- if (install_media.skip_import) {
+ if (install_media.skip_import && !clone) {
volume_path = install_media.device_file;
debug ("Skiping import. Using '%s' as target volume", volume_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]