[pve-devel] [PATCH storage] plugin: hooks: add explicit returns
Fabian Ebner
f.ebner at proxmox.com
Fri Nov 27 10:35:44 CET 2020
to avoid returning something unexpected. Finish what
afeda182566292be15413d9b874720876eac14c9 already started for all the other
plugins. At least for ZFS's on_add_hook this is necessary (adding a ZFS storage
currently fails as reported here [0]), but it cannot hurt
in the other places either as the only hooks we expect to return something
currently are PBS's on_add_hook and on_update_hook.
[0]: https://forum.proxmox.com/threads/gui-add-zfs-storage-verification-failed-400-config-type-check-object-failed.79734/
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
PVE/Storage/CIFSPlugin.pm | 6 ++++++
PVE/Storage/CephFSPlugin.pm | 4 ++++
PVE/Storage/LVMPlugin.pm | 2 ++
PVE/Storage/PBSPlugin.pm | 2 ++
PVE/Storage/RBDPlugin.pm | 4 ++++
PVE/Storage/ZFSPoolPlugin.pm | 2 ++
6 files changed, 20 insertions(+)
diff --git a/PVE/Storage/CIFSPlugin.pm b/PVE/Storage/CIFSPlugin.pm
index 7ec7164..36339db 100644
--- a/PVE/Storage/CIFSPlugin.pm
+++ b/PVE/Storage/CIFSPlugin.pm
@@ -168,6 +168,8 @@ sub on_add_hook {
} else {
cifs_delete_credentials($storeid);
}
+
+ return;
}
sub on_update_hook {
@@ -183,12 +185,16 @@ sub on_update_hook {
} else {
cifs_delete_credentials($storeid);
}
+
+ return;
}
sub on_delete_hook {
my ($class, $storeid, $scfg) = @_;
cifs_delete_credentials($storeid);
+
+ return;
}
sub status {
diff --git a/PVE/Storage/CephFSPlugin.pm b/PVE/Storage/CephFSPlugin.pm
index 880ec05..8eb7c70 100644
--- a/PVE/Storage/CephFSPlugin.pm
+++ b/PVE/Storage/CephFSPlugin.pm
@@ -170,6 +170,8 @@ sub on_add_hook {
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
PVE::CephConfig::ceph_create_keyfile($scfg->{type}, $storeid);
+
+ return;
}
sub on_delete_hook {
@@ -178,6 +180,8 @@ sub on_delete_hook {
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
PVE::CephConfig::ceph_remove_keyfile($scfg->{type}, $storeid);
+
+ return;
}
sub status {
diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm
index c0740d4..73e8e48 100644
--- a/PVE/Storage/LVMPlugin.pm
+++ b/PVE/Storage/LVMPlugin.pm
@@ -269,6 +269,8 @@ sub on_add_hook {
lvm_create_volume_group($path, $scfg->{vgname}, $scfg->{shared});
}
+
+ return;
}
sub parse_volname {
diff --git a/PVE/Storage/PBSPlugin.pm b/PVE/Storage/PBSPlugin.pm
index d1db4a9..380c976 100644
--- a/PVE/Storage/PBSPlugin.pm
+++ b/PVE/Storage/PBSPlugin.pm
@@ -452,6 +452,8 @@ sub on_delete_hook {
pbs_delete_password($scfg, $storeid);
pbs_delete_encryption_key($scfg, $storeid);
+
+ return;
}
sub parse_volname {
diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 94df89d..fab6d57 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -317,6 +317,8 @@ sub on_add_hook {
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
PVE::CephConfig::ceph_create_keyfile($scfg->{type}, $storeid);
+
+ return;
}
sub on_delete_hook {
@@ -325,6 +327,8 @@ sub on_delete_hook {
return if defined($scfg->{monhost}); # nothing to do if not pve managed ceph
PVE::CephConfig::ceph_remove_keyfile($scfg->{type}, $storeid);
+
+ return;
}
sub parse_volname {
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 2f0a80a..3054331 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -133,6 +133,8 @@ sub on_add_hook {
} else {
$scfg->{mountpoint} = $mountpoint;
}
+
+ return;
}
sub path {
--
2.20.1
More information about the pve-devel
mailing list