[gnome-boxes/improve-storage-management-ux: 3/7] vm-creator/configurator: Don't create new StorageVol for existing qcow2
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/improve-storage-management-ux: 3/7] vm-creator/configurator: Don't create new StorageVol for existing qcow2
- Date: Mon, 13 Dec 2021 15:06:42 +0000 (UTC)
commit 8e7cb01a387a159b4b82d91689b3162b278ef38c
Author: Felipe Borges <felipeborges gnome org>
Date: Mon Dec 13 12:32:11 2021 +0100
vm-creator/configurator: Don't create new StorageVol for existing qcow2
If the source media is a .qcow2 file we don't need to create an
additional volume for it.
src/vm-configurator.vala | 4 ----
src/vm-creator.vala | 14 ++++++++++++--
2 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 9687fda7..75008cc1 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -87,10 +87,6 @@ public static Domain create_domain_config (InstallerMedia install_media, string
clock.add_timer (timer);
domain.set_clock (clock);
- if (install_media is InstalledMedia && install_media.device_file.has_suffix ("qcow2")) {
- target_path = install_media.device_file;
- }
-
set_target_media_config (domain, target_path, install_media);
install_media.setup_domain_config (domain);
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 9d4a5e1b..a193d9b8 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -52,8 +52,18 @@ public async LibvirtMachine create_vm (Cancellable? cancellable) throws GLib.Err
yield create_domain_name_and_title_from_media (out name, out title);
yield install_media.prepare_for_installation (name, cancellable);
- var volume = yield create_target_volume (name, install_media.resources.storage);
- var config = yield create_domain_config (name, title, volume.get_path (), cancellable);
+ string? volume_path = null;
+ if (install_media.skip_import) {
+ volume_path = install_media.device_file;
+
+ debug ("Skiping import. Using '%s' as target volume", volume_path);
+ } else {
+ var volume = yield create_target_volume (name, install_media.resources.storage);
+
+ volume_path = volume.get_path ();
+ }
+
+ var config = yield create_domain_config (name, title, volume_path, cancellable);
var domain = connection.create_domain (config);
var machine = yield LibvirtBroker.get_default ().add_domain (App.app.default_source,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]