all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage] plugin: hooks: add explicit returns
Date: Fri, 27 Nov 2020 10:35:44 +0100	[thread overview]
Message-ID: <20201127093544.17667-1-f.ebner@proxmox.com> (raw)

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





             reply	other threads:[~2020-11-27  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-27  9:35 Fabian Ebner [this message]
2020-11-27  9:55 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201127093544.17667-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal