SRV_MIGRATE_STATE is an event that is triggered whenever the migration state has transitioned to SRV_MIG_READY or SRV_MIG_FAILED, the transition being a result of a migration message from a client. The SRV_MIGRATE_STATE event handler is invoked in these situations:
SRV_T_MIGRATE_ STATE |
Situation |
Possible application action |
|---|---|---|
SRV_MIG_READY |
The client has sent a message to the server indicating that it has detected the request and is ready to migrate. The server determines whether to continue the migration or not. |
One of the following:
|
SRV_MIG_FAILED |
The client has sent a message to the server indicating that the migration failed. |
One of the following:
|
This is an example of a SRV_MIGRATE_STATE event handler:
/*
** Simple migrate-state event handler
*/
CS_RETCODE CS_PUBLIC
migrate_state_handler(SRV_PROC *sp)
{
SRV_MIG_STATE migration_state;
ret = srv_thread_props(sp, CS_GET,
SRV_T_MIGRATE_STATE, &migration_state,
sizeof (migration_state), NULL);
...
switch(migration_state)
{
case SRV_MIG_READY:
...
case SRV_MIG_FAILED:
...
}
}
...
/*
** Install the migrate-state change event handler
*/
srv_handle(server, SRV_MIGRATE_STATE, migrate_state_handler);
...
When working with the SRV_MIGRATE_STATE event handler:
If the client thread cancels the migration from inside the SRV_MIGRATE_STATE event handler, your application must make sure that the context is consistent. For instance, you cannot expect a different server to use the context your application has created.
If a new migration request is sent from within the SRV_MIGRATE_STATE event handler, this handler is called again when the client is ready to start with the new requested migration.