5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-08 21:18:06 +03:00

esxi: deactivate storage if config gets updated

to ensure that the next access actually uses the updated config for
accessing the remote ESXi, for both manifest API and FUSE mount.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-03-12 18:34:33 +01:00
parent 68f3ec3f8b
commit 0a2f75ffd6

View File

@ -314,12 +314,22 @@ sub on_add_hook {
sub on_update_hook {
my ($class, $storeid, $scfg, %sensitive) = @_;
return if !exists($sensitive{password});
# FIXME: allow to actually determine this, e.g., through new $changed hash passed to the hook
my $connection_detail_changed = 1;
if (defined($sensitive{password})) {
esxi_set_credentials($sensitive{password}, $storeid);
} else {
esxi_delete_credentials($storeid);
if (exists($sensitive{password})) {
$connection_detail_changed = 1;
if (defined($sensitive{password})) {
esxi_set_credentials($sensitive{password}, $storeid);
} else {
esxi_delete_credentials($storeid);
}
}
if ($connection_detail_changed) {
# best-effort deactivate storage so that it can get re-mounted with updated params
eval { $class->deactivate_storage($storeid, $scfg) };
warn $@ if $@;
}
return;