[pve-devel] [PATCH installer 5/6] ask for renaming of existing pmg/pve VGs early

Stoiko Ivanov s.ivanov at proxmox.com
Fri Nov 29 11:53:47 CET 2019


instead of asking the user whether they want to rename an existing VG
named 'pve' or 'pmg' after running through the installer and partitioning
the disks, do so directly on the hd-selection view.

Additionally refactor ask_existing_vg_rename_or_abort to reuse the
dialog generation from ask_existing_diskconfig_or_abort.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 proxinstall | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/proxinstall b/proxinstall
index d2abdcd..7eddafb 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1042,11 +1042,8 @@ sub ask_existing_vg_rename_or_abort {
     }
     $message .= "or cancel the installation?";
 
-    my $dialog = Gtk3::MessageDialog->new($window, 'modal', 'question', 'ok-cancel', $message);
-    my $response = $dialog->run();
-    $dialog->destroy();
+    my $rename_vgs = sub {
 
-    if ($response eq 'ok') {
 	for my $vg_uuid (keys %$duplicate_vgs) {
 	    my $vg = $duplicate_vgs->{$vg_uuid};
 	    my $new_vgname = $vg->{new_vgname};
@@ -1054,11 +1051,9 @@ sub ask_existing_vg_rename_or_abort {
 	    syscmd("vgrename $vg_uuid $new_vgname") == 0 ||
 		die "could not rename VG from '$vg->{pvs}' ($vg_uuid) to '$new_vgname'!\n";
 	}
-    } else {
-	set_next("_Reboot", sub { exit (0); } );
-	display_html("fail.htm");
-	die "Cancled installation by user, due to already existing volume group '$vgname'\n";
-    }
+    };
+
+    ask_existing_diskconfig_or_abort($message, "existing volume group '$vgname'", $rename_vgs);
 }
 
 sub create_lvm_volumes {
@@ -1066,8 +1061,6 @@ sub create_lvm_volumes {
 
     my $vgname = $setup->{product};
 
-    ask_existing_vg_rename_or_abort($vgname);
-
     my $rootdev = "/dev/$vgname/root";
     my $datadev = "/dev/$vgname/data";
     my $swapfile;
@@ -3343,6 +3336,10 @@ sub create_hdsel_view {
 	    }
 	    $config_options->{target_hds} = [ $target_hd ];
 	    $unused = get_unused_bdevs($config_options->{target_hds});
+
+	    my $vgname = $setup->{product};
+	    ask_existing_vg_rename_or_abort($vgname);
+
 	}
 
 	warn_existing_esp_ignore_or_abort($unused);
-- 
2.20.1





More information about the pve-devel mailing list