[pve-devel] [PATCH cluster 3/3] corosync: die in check_conf_exists if !$silent
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Nov 19 08:52:18 CET 2019
On November 18, 2019 4:05 pm, Stefan Reiter wrote:
> Commit 3df092f977c2f592ba4e402f0d99b53a6603d969 (fix #1380: pvecm
> status: add general cluster information) broke "pvecm status" on
> non-cluster nodes (well, it made the error look worse, ofc it didn't
> "work" before either) because it tries to access a totem that cannot
> exist without a corosync.conf.
>
> pvecm status/nodes/expected already fail without a cluster, so it makes
> more sense to fail early. But instead of copying the way the qdevice API
> handles it, move the die to check_conf_exists directly, which makes
> more sense then a warn anyway IMHO.
>
> check_conf_exists is never called without $silent = 1 outside of
> pvecm.pm, so this change does not require any versioned depends/breaks.
>
> Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
> ---
> data/PVE/CLI/pvecm.pm | 6 ++----
> data/PVE/Corosync.pm | 2 +-
> 2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
> index 86c5ce5..172ef8c 100755
> --- a/data/PVE/CLI/pvecm.pm
> +++ b/data/PVE/CLI/pvecm.pm
> @@ -109,8 +109,7 @@ __PACKAGE__->register_method ({
> code => sub {
> my ($param) = @_;
>
> - die "Node not in a cluster. Aborting.\n"
> - if !PVE::Corosync::check_conf_exists(1);
> + PVE::Corosync::check_conf_exists();
>
> my $members = PVE::Cluster::get_members();
> foreach my $node (sort keys %$members) {
> @@ -266,8 +265,7 @@ __PACKAGE__->register_method ({
> code => sub {
> my ($param) = @_;
>
> - die "Node not in a cluster. Aborting.\n"
> - if !PVE::Corosync::check_conf_exists(1);
> + PVE::Corosync::check_conf_exists();
>
> my $members = PVE::Cluster::get_members();
> foreach my $node (sort keys %$members) {
> diff --git a/data/PVE/Corosync.pm b/data/PVE/Corosync.pm
> index d1b85dc..447f8fd 100644
> --- a/data/PVE/Corosync.pm
> +++ b/data/PVE/Corosync.pm
> @@ -187,7 +187,7 @@ sub check_conf_exists {
>
> my $exists = -f "$basedir/corosync.conf";
>
> - warn "Corosync config '$basedir/corosync.conf' does not exist - is this node part of a cluster?\n"
> + die "Error: Corosync config '$basedir/corosync.conf' does not exist - is this node part of a cluster?\n"
> if !$silent && !$exists;
please change $silent to $noerr!
>
> return $exists;
> --
> 2.20.1
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list