status: Display number of currently connected clients, and whether new clients are allowed

These will be useful for migration status monitoring - replaces "is pass == 7?"
This commit is contained in:
nick
2013-09-23 13:38:19 +01:00
parent a6c175ed1d
commit 0f2225becf
3 changed files with 161 additions and 102 deletions

View File

@@ -12,6 +12,9 @@ struct status * status_create( struct server * serve )
status->size = serve->size;
status->has_control = serve->success;
status->clients_allowed = serve->allow_new_clients;
status->num_clients = server_count_clients( serve );
server_lock_start_mirror( serve );
status->is_mirroring = NULL != serve->mirror;
@@ -51,6 +54,8 @@ int status_write( struct status * status, int fd )
PRINT_INT( pid );
PRINT_UINT64( size );
PRINT_BOOL( is_mirroring );
PRINT_BOOL( clients_allowed );
PRINT_INT( num_clients );
PRINT_BOOL( has_control );
if ( status->is_mirroring ) {

View File

@@ -30,6 +30,14 @@
* If the server is started in "serve" mode, this will never be
* false.
*
* clients_allowed:
* This will be false if the server is not currently allowing new
* connections, for instance, if we're in the migration endgame.
*
* num_clients:
* This tells us how many clients are currently running. If we're in the
* migration endgame, it should be 0
*
* is_migrating:
* This will be false when the server is started in either "listen"
* or "serve" mode. It will become true when a server in "serve"
@@ -73,6 +81,8 @@ struct status {
pid_t pid;
uint64_t size;
int has_control;
int clients_allowed;
int num_clients;
int is_mirroring;
int migration_pass;
uint64_t pass_dirty_bytes;