diff options
| author | Daniil Fedotov <dfedotov@pivotal.io> | 2017-08-01 14:54:11 +0100 |
|---|---|---|
| committer | Daniil Fedotov <dfedotov@pivotal.io> | 2017-08-01 14:54:11 +0100 |
| commit | 97abfaccbefbbb2a97d37696aed3ef2a6ffbdd3c (patch) | |
| tree | 36d7ebba13a3f2d2e942255446c488bc4f667b2c | |
| parent | c58a15e7893bae019418c486d971046e879e0385 (diff) | |
| download | rabbitmq-server-git-97abfaccbefbbb2a97d37696aed3ef2a6ffbdd3c.tar.gz | |
Change the `state` field in vhost info to `cluster_state`.
Vhost supervisor status can be different on different nodes.
Reporting just the current node state doesn't make much sense for
both management and the CLI.
| -rw-r--r-- | src/rabbit_vhost.erl | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl index 30557fc7be..5cbb057a42 100644 --- a/src/rabbit_vhost.erl +++ b/src/rabbit_vhost.erl @@ -75,7 +75,7 @@ recover(VHost) -> %%---------------------------------------------------------------------------- --define(INFO_KEYS, [name, tracing, state]). +-define(INFO_KEYS, [name, tracing, cluster_state]). add(VHostPath, ActingUser) -> rabbit_log:info("Adding vhost '~s'~n", [VHostPath]), @@ -261,10 +261,19 @@ infos(Items, X) -> [{Item, i(Item, X)} || Item <- Items]. i(name, VHost) -> VHost; i(tracing, VHost) -> rabbit_trace:enabled(VHost); -i(state, VHost) -> case rabbit_vhost_sup_sup:is_vhost_alive(VHost) of - true -> running; - false -> down - end; +i(cluster_state, VHost) -> + Nodes = rabbit_nodes:all_running(), + lists:map(fun(Node) -> + State = case rabbit_misc:rpc_call(Node, + rabbit_vhost_sup_sup, is_vhost_alive, + [VHost]) of + {badrpc, nodedown} -> nodedown; + true -> running; + false -> down + end, + {Node, State} + end, + Nodes); i(Item, _) -> throw({bad_argument, Item}). info(VHost) -> infos(?INFO_KEYS, VHost). |
