[pve-devel] [PATCH installer 4/6] warn on existing rpool if installing on ZFS
Thomas Lamprecht
t.lamprecht at proxmox.com
Wed Dec 11 16:31:05 CET 2019
On 11/29/19 11:53 AM, Stoiko Ivanov wrote:
> Having two pools named rpool leads to an unbootable system.
> This can happen if reusing an old diks, which is not selected during the
> initial installation.
>
> Warn the user accordingly and give them the option to abort the installation.
> The pool is not renamed (as we do for the LVM-case with VGs named pve), since
> this would fail if the pool is not importable (e.g. user added only one old
> disk from a RAIDZ install to that system.
> The alternative of running `zpool labelclear` would potentially destroy data.
That why you ask people. I want a way out. "Ignore or abort" has the same
use as now, i.e., you cannot install PVE/PMG successfully, so no real value
gained. Either:
* ask if the existing labels should be renamed, i.e., "rpool-old", as I
did for VGs
* ask to just clear them
* add the wipe disk option to the HD selector, that selector could show if
there are remainings, or old data on the disks, and thus an user could
decide there what to wipe or not.
I'd prefer the first now, the latter in the longer run - as it will
need a bit more rework to give good UX.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
> proxinstall | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/proxinstall b/proxinstall
> index 47faa09..d2abdcd 100755
> --- a/proxinstall
> +++ b/proxinstall
> @@ -3326,6 +3326,7 @@ sub create_hdsel_view {
> }
> $config_options->{target_hds} = [ map { $_->[1] } @$devlist ];
> $unused = get_unused_bdevs($config_options->{target_hds});
> + warn_existing_rpool_ignore_or_abort($unused);
> } elsif ($config_options->{filesys} =~ m/btrfs/) {
> my ($devlist) = eval { get_btrfs_raid_setup() };
> if (my $err = $@) {
> @@ -3393,6 +3394,32 @@ EOF
> ask_existing_diskconfig_or_abort($message, "existing ESPs");
> }
>
> +sub warn_existing_rpool_ignore_or_abort {
> + my ($unused_devs) = @_;
> +
> + my $is_rpool = sub {
> + my ($bdev) = $_;
> + if (($bdev->{parttype} eq '6a898cc3-1dd2-11b2-99a6-080020736631') &&
> + ($bdev->{label} eq 'rpool')) {
> + return ( $bdev->{path} );
> + }
> + return ();
> + };
> +
> + my @rpools = map { $is_rpool->($_) } @$unused_devs;
> + return if !scalar(@rpools);
> +
> + my $message = "Detected existing ZFS Pool(s) named rpool:\n- " . join("\n- ", @rpools);
> + $message .= <<'EOF';
> +
> +
> +This could prevent correct booting!
> +Do you want to ignore or cancel the installation?
> +EOF
> +
> + ask_existing_diskconfig_or_abort($message, "existing rpools");
> +}
> +
> sub ask_existing_diskconfig_or_abort {
> my ($message, $fail_reason, $ok_action) = @_;
>
>
More information about the pve-devel
mailing list