[pve-devel] [PATCH installer 2/3] low-level: install: split out random disk uid generation
Christoph Heiss
c.heiss at proxmox.com
Thu May 16 12:28:34 CEST 2024
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
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
More information about the pve-devel
mailing list