[pve-devel] [PATCH installer 3/3] low-level: install: check for already-existing `rpool` on install

Christoph Heiss c.heiss at proxmox.com
Mon Jul 8 17:16:48 CEST 2024


On Mon, Jul 08, 2024 at 04:16:23PM GMT, Aaron Lauterer wrote:
> On  2024-05-16  12:28, Christoph Heiss wrote:
> > [..]
> > +sub zfs_ask_existing_zpool_rename {
> > +    my ($pool_name) = @_;
> > +
> > +    # At this point, no pools should be imported/active
> > +    my $exported_pools = Proxmox::Sys::ZFS::get_exported_pools();
> > +
> > +    foreach (@$exported_pools) {
> > +	next if $_->{name} ne $pool_name || $_->{state} ne 'ONLINE';
> > +	my $renamed_pool = "$_->{name}-OLD-" . random_short_uid();
>
> since the pool already has a unigue numerical id, couln't we use that
> instead of generating a new one?

Good point, I will change that. Only thing I might have to look into is
the maximum pool name length, since the numerical IDs are quite long.
But in the worst case, they should still be unique enough even after
shortening to an appropriate length.

>
> we even have everything in place with $_->{id}.
>




More information about the pve-devel mailing list