* [pve-devel] [PATCH storage] plugin: hooks: add explicit returns
@ 2020-11-27 9:35 Fabian Ebner
2020-11-27 9:55 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2020-11-27 9:35 UTC (permalink / raw)
To: pve-devel
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@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-27 9:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 9:35 [pve-devel] [PATCH storage] plugin: hooks: add explicit returns Fabian Ebner
2020-11-27 9:55 ` [pve-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox