public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] install: zfs: rename pre-existing `rpool` also if in degraded state
@ 2024-11-15 15:35 Christian Ebner
  2024-11-15 15:51 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Ebner @ 2024-11-15 15:35 UTC (permalink / raw)
  To: pve-devel

If a subset of disks associated with a pre-existing ZFS pool are
selected for installation, the pool might still be importable
(required for the rename) but will be in a `degraded` state.
Currently, only pools in `online` state will be considered for
renameing, leading a possibly clashing pool named `rpool` behind.
Therefore, a reboot after installation will fail because of the
duplicate names.

To partially fix this behaviour, also rename `rpool` in `degraded`
state.

Note:
This however does not cover the case when a pool can no longer be
imported because the number of required replicas is not available.
Renaming by zpool import is not possible for that case.

Partially-fixes: 43591049 ("low-level: install: check for already-existing `rpool` on install")
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 Proxmox/Install.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 2f9f28d..d409577 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -177,7 +177,10 @@ sub zfs_ask_existing_zpool_rename {
     my $exported_pools = Proxmox::Sys::ZFS::get_exported_pools();
 
     foreach (@$exported_pools) {
-	next if $_->{name} ne $pool_name || $_->{state} ne 'ONLINE';
+	# Pool will be in degraded state if a subset of the associated disks have been wiped by the
+	# installer, but the pool can still be imported (required for the rename).
+	next if $_->{name} ne $pool_name ||
+	    not ($_->{state} eq 'ONLINE' || $_->{state} eq 'DEGRADED');
 	my $renamed_pool = "$_->{name}-OLD-$_->{id}";
 
 	my $do_rename = Proxmox::Install::Config::get_existing_storage_auto_rename();
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH installer] install: zfs: rename pre-existing `rpool` also if in degraded state
  2024-11-15 15:35 [pve-devel] [PATCH installer] install: zfs: rename pre-existing `rpool` also if in degraded state Christian Ebner
@ 2024-11-15 15:51 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-11-15 15:51 UTC (permalink / raw)
  To: Proxmox VE development discussion, Christian Ebner

Am 15.11.24 um 16:35 schrieb Christian Ebner:
> If a subset of disks associated with a pre-existing ZFS pool are
> selected for installation, the pool might still be importable
> (required for the rename) but will be in a `degraded` state.
> Currently, only pools in `online` state will be considered for
> renameing, leading a possibly clashing pool named `rpool` behind.
> Therefore, a reboot after installation will fail because of the
> duplicate names.
> 
> To partially fix this behaviour, also rename `rpool` in `degraded`
> state.
> 
> Note:
> This however does not cover the case when a pool can no longer be
> imported because the number of required replicas is not available.
> Renaming by zpool import is not possible for that case.
> 
> Partially-fixes: 43591049 ("low-level: install: check for already-existing `rpool` on install")
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> ---
>  Proxmox/Install.pm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
>

applied, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-15 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-15 15:35 [pve-devel] [PATCH installer] install: zfs: rename pre-existing `rpool` also if in degraded state Christian Ebner
2024-11-15 15:51 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal