From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D1C5F1FF38C for ; Thu, 16 May 2024 12:29:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DCA3A34F21; Thu, 16 May 2024 12:29:20 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Thu, 16 May 2024 12:28:34 +0200 Message-ID: <20240516102837.422278-3-c.heiss@proxmox.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240516102837.422278-1-c.heiss@proxmox.com> References: <20240516102837.422278-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.006 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH installer 2/3] low-level: install: split out random disk uid generation X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Christoph Heiss --- Proxmox/Install.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm index c0f8955..c86a574 100644 --- a/Proxmox/Install.pm +++ b/Proxmox/Install.pm @@ -169,6 +169,13 @@ sub btrfs_create { syscmd($cmd); } +# no high randomnes properties, but this is only for the cases where +# we either have multiple volume groups or zpools from multiple old PVE disks, +# or we have a disk with both a "$vgname" and "$vgname-old" ... +sub random_short_uid { + return sprintf "%08X", rand(0xffffffff); +} + sub zfs_create_rpool { my ($vdev, $pool_name, $root_volume_name) = @_; @@ -376,12 +383,7 @@ sub ask_existing_vg_rename_or_abort { for my $vg_uuid (keys %$duplicate_vgs) { my $vg = $duplicate_vgs->{$vg_uuid}; - - # no high randomnes properties, but this is only for the cases where - # we either have multiple "$vgname" vgs from multiple old PVE disks, or - # we have a disk with both a "$vgname" and "$vgname-old"... - my $short_uid = sprintf "%08X", rand(0xffffffff); - $vg->{new_vgname} = "$vgname-OLD-$short_uid"; + $vg->{new_vgname} = "$vgname-OLD-" . random_short_uid(); } my $response_ok = Proxmox::Install::Config::get_lvm_auto_rename(); -- 2.44.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel