[gnome-boxes/dont-delete-vms-when-installer-media-is-gone] vm-creator: Don't delete VMs automatically
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/dont-delete-vms-when-installer-media-is-gone] vm-creator: Don't delete VMs automatically
- Date: Fri, 7 Feb 2020 11:06:07 +0000 (UTC)
commit 0d1f007188dfbf1ce9e52e7d18d41eae7808ded6
Author: Felipe Borges <felipeborges gnome org>
Date: Fri Feb 7 12:02:49 2020 +0100
vm-creator: Don't delete VMs automatically
Boxes used to delete VMs automatically once the installer media
is nowhere to be found. That is problematic because it can lead
to users losing important data.
We now attempt to launch a file chooser enabling users to add a
installer media to replace the missing one.
In case the user dismisses the dialog (e.g. doesn't provide an
alternative installer media), we leave the VM in a broken state.
Users could still attempt to recover it by adding a CDROM/ISO in
"Devices & Share" Properties, and booting through it.
Fixes #227
src/vm-creator.vala | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index be52bc3b..4e9b9e42 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -97,11 +97,25 @@ protected virtual async void continue_installation (LibvirtMachine machine) {
}
if (!FileUtils.test (install_media.device_file, FileTest.EXISTS)) {
- warning ("Source installer media '%s' no longer exists. Deleting machine '%s'..",
- install_media.device_file,
- machine.name);
- App.app.delete_machine (machine);
- return;
+ Notification.OKFunc add_installer_media = () => {
+ var file_chooser = new Gtk.FileChooserNative (_("Select a device or ISO file"),
+ machine.window,
+ Gtk.FileChooserAction.OPEN,
+ _("Select"), _("Cancel"));
+ if (file_chooser.run () == Gtk.ResponseType.ACCEPT) {
+ install_media.device_file = file_chooser.get_filename ();
+ } else {
+ install_media.device_file = null;
+ }
+ };
+
+ var message = _("Source installer media '%s' no longer exists").printf
(install_media.device_file);
+ machine.window.notificationbar.display_for_action (message,
+ _("Add installer media"),
+ (owned) add_installer_media,
+ null);
+ if (install_media.device_file == null)
+ return;
}
install_media.prepare_to_continue_installation (name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]