start: send state to legacy lxc-monitord state server even if no state clients registered

This pr https://github.com/lxc/lxc/pull/1618 kill lxc-monitord, for backwards compatibility,
we also send state to legacy lxc-monitord state server in function `lxc_set_state`.

we should also send state if there is no state clients registered, otherwise `lxc-monitor` client will
not get state change event if container changed state to `STARTING` or `RUNNING`.

Signed-off-by: 0x0916 <w@laoqinren.net>
This commit is contained in:
0x0916 2017-07-01 13:44:41 +08:00
parent 066e9fe8b5
commit 65ee1673f6

View File

@ -359,6 +359,7 @@ int lxc_set_state(const char *name, struct lxc_handler *handler,
if (lxc_list_empty(&handler->state_clients)) { if (lxc_list_empty(&handler->state_clients)) {
TRACE("no state clients registered"); TRACE("no state clients registered");
process_unlock(); process_unlock();
lxc_monitor_send_state(name, state, handler->lxcpath);
return 0; return 0;
} }