diff options
| author | Michael Klishin <michael@novemberain.com> | 2018-01-25 03:29:53 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-25 03:29:53 +0300 |
| commit | 7429f0c854eb7f5245246b0748aa70457754ef6d (patch) | |
| tree | 496c555d8a04d632baa348552b3901aece5ad296 | |
| parent | 5b2c9bebf06c877bc07656be18dfec85dcf68166 (diff) | |
| parent | 8a602070022c414366ef1ecba1cc23481b6643bd (diff) | |
| download | rabbitmq-server-git-3.7.3.tar.gz | |
Merge pull request #1482 from rabbitmq/rabbitmq-server-vhost-sup-sup-badargv3.7.3-rc.2v3.7.3
Only call vhost status for fully started nodes
| -rw-r--r-- | src/rabbit_vhost_sup_sup.erl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/rabbit_vhost_sup_sup.erl b/src/rabbit_vhost_sup_sup.erl index 19d7cf61b7..558648400a 100644 --- a/src/rabbit_vhost_sup_sup.erl +++ b/src/rabbit_vhost_sup_sup.erl @@ -183,7 +183,13 @@ start_vhost(VHost, Node) -> start_vhost(VHost) -> case rabbit_vhost:exists(VHost) of false -> {error, {no_such_vhost, VHost}}; - true -> supervisor2:start_child(?MODULE, [VHost]) + true -> + case whereis(?MODULE) of + Pid when is_pid(Pid) -> + supervisor2:start_child(?MODULE, [VHost]); + undefined -> + {error, rabbit_vhost_sup_sup_not_running} + end end. -spec is_vhost_alive(rabbit_types:vhost()) -> boolean(). @@ -221,9 +227,13 @@ save_vhost_process(VHost, VHostProcessPid) -> -spec lookup_vhost_sup_record(rabbit_types:vhost()) -> #vhost_sup{} | not_found. lookup_vhost_sup_record(VHost) -> - case ets:lookup(?MODULE, VHost) of - [] -> not_found; - [#vhost_sup{} = VHostSup] -> VHostSup + case ets:info(?MODULE, name) of + ?MODULE -> + case ets:lookup(?MODULE, VHost) of + [] -> not_found; + [#vhost_sup{} = VHostSup] -> VHostSup + end; + undefined -> not_found end. -spec vhost_sup_pid(rabbit_types:vhost()) -> no_pid | {ok, pid()}. |
