diff options
Diffstat (limited to 'vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm')
-rw-r--r-- | vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm b/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm index 894ab7feca4..5461c50ee30 100644 --- a/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm +++ b/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm @@ -31,6 +31,7 @@ sub setNodeState { # (Command line arguments) &handleCommandLine($argsref); detectClusterController(); &showSettings(); + &maybeRequireClusterSelection(); &execute(); } @@ -78,6 +79,23 @@ sub showSettings { # () Yahoo::Vespa::ClusterController::showSettings(); } +sub maybeRequireClusterSelection +{ + return if Yahoo::Vespa::ContentNodeSelection::hasClusterSelection(); + my %clusters; + VespaModel::visitServices(sub { + my ($info) = @_; + if ($$info{'type'} =~ /^(?:distributor|storage|storagenode)$/ ) { + $clusters{$$info{'cluster'}} = 1; + } + }); + my $clusterCount = scalar keys %clusters; + if ($clusterCount > 1) { + printWarning "More than one cluster is present but no cluster is selected\n"; + exitApplication(1); + } +} + # Sets the node state sub execute { # () $success = 1; |