[pve-devel] [PATCH cluster] Add warning for pvecm commands if not part of cluster
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Mar 11 13:02:45 CET 2016
On 03/11/2016 12:41 PM, Fabian Grünbichler wrote:
> If the cluster config file is missing, pvecm status, nodes
> and expected will probably not work. Add a helpful warning
> because the corosync-quorumtool error message is not very
> descriptive here.
> ---
> Already saw a couple of forum posts where users were
> confused when pvecm status did not work after a fresh
> installation, I think this would improve the situation.
> Feel free to change the actual warning message if desired.
>
> data/PVE/CLI/pvecm.pm | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
> index 7fadb7d..a5952f7 100755
> --- a/data/PVE/CLI/pvecm.pm
> +++ b/data/PVE/CLI/pvecm.pm
> @@ -601,6 +601,9 @@ __PACKAGE__->register_method ({
> code => sub {
> my ($param) = @_;
>
> + warn "Corosync configuration '$clusterconf' not found - is this node part of a cluster?\n"
> + if !-f $clusterconf;
> +
Nitpicking, but why not factoring those three same lines of code out in
a method?
Would be even cooler to add it to the PVE::Cluster (or wherever it fits
better) class so we can use it if we want to check if a node is in a
cluster somewhere else.
> my $cmd = ['corosync-quorumtool', '-siH'];
>
> exec (@$cmd);
> @@ -622,6 +625,9 @@ __PACKAGE__->register_method ({
> code => sub {
> my ($param) = @_;
>
> + warn "Corosync configuration '$clusterconf' not found - is this node part of a cluster?\n"
> + if !-f $clusterconf;
> +
> my $cmd = ['corosync-quorumtool', '-l'];
>
> exec (@$cmd);
> @@ -649,6 +655,9 @@ __PACKAGE__->register_method ({
> code => sub {
> my ($param) = @_;
>
> + warn "Corosync configuration '$clusterconf' not found - is this node part of a cluster?\n"
> + if !-f $clusterconf;
> +
> my $cmd = ['corosync-quorumtool', '-e', $param->{expected}];
>
> exec (@$cmd);
More information about the pve-devel
mailing list