Commit Graph

848 Commits

Author SHA1 Message Date
Yonit Halperin
c83a608fb4 enable seamless migration and set migration protocol version 2012-08-27 09:13:14 +03:00
Yonit Halperin
c24276d941 inputs channel migration: don't send any msg after MSG_MIGRATE
Pending motion acks, and keyboard modifiers messages will be sent
by the destination after receiving the migration data.
2012-08-27 09:13:13 +03:00
Yonit Halperin
b18c6d4298 inputs_channel: send and handle migration data 2012-08-27 09:13:13 +03:00
Yonit Halperin
0f4bc12090 migration_protocol: add inputs channel migration data
Storing the motion count in uint16_t and not in uint32_t since
the exact count is not important, just its division in
SPICE_INPUT_MOTION_ACK_BUNCH (see the next 2 patches).
2012-08-27 09:13:13 +03:00
Yonit Halperin
115d095d46 main_channel: don't expect init msg in a seamless migration destination
If the server is a destination of seamless migration, send msgs to the client,
even though an init msg has not been sent to the client.
2012-08-27 09:13:12 +03:00
Yonit Halperin
e142bd9a61 red_channel: set send_data.last_sent_serial in red_channel_client_set_message_serial
red_channel_client_set_message_serial is called for setting
the serial of the display channel messages after migration (on the
destination side). The serial is retrieved from the migration data.
2012-08-27 09:13:12 +03:00
Yonit Halperin
26027036c0 red_channel: remove unused migrate flag from RedChannel
The relevant flags reside in RedChannelClient and RedClient
2012-08-27 09:13:12 +03:00
Yonit Halperin
934fb14ccc snd_worker: handling migration
The playback and record channel send SPICE_MSG_MIGRATE to the client.
Both playback and record channel does not have a state to restore:
while in the legacy migration implementation the record channel
used to restore the mode and start time, it looks unnecessary since
the client receives from the src MSG_RECORD_STOP before the migration
completion notification (when the vm is stopped). Afterwards, when the vm
starts on the dest side, the client receives MSG_RECORD_START.
2012-08-27 09:13:11 +03:00
Yonit Halperin
8874f3b259 snd_channel: fix double release
Due to the fix in the previous patch, snd_disconnect_channel can be
called both when there is write/read error in the channel, or from
red_client_destroy (which calls client_cbs.disconnect).
Multiple calls to snd_disconnect_channel resulted in calling
channel->cleanup(channel) more than once (double release).
2012-08-27 09:13:11 +03:00
Yonit Halperin
08d223beb3 red_channel (dummy): fix not adding dummy RedChannelClient to the client
snd channel wasn't added to be part of the client's channels list.
As a result, when the client was destroyed, or migrated, snd channel
client wasn't destroy, or its migration callback wasn't called.

However, due to adding dummy channels to the client, we need special
handling for calls to disconnecting dummy channel clients.

TODO: we need to refactor snd_worker to use red_channel
2012-08-27 09:13:11 +03:00
Yonit Halperin
8e7b22b786 display migration: restore destination state
Restoring display channel from migration data.
Not notifying client about changes that are artifacts of loading the vm.
Remove legacy migration code.
2012-08-27 09:13:10 +03:00
Yonit Halperin
29776c9216 display migration: marshall migration data 2012-08-27 09:13:10 +03:00
Yonit Halperin
558c4cbb4c display & cursor migration: send SPICE_MSG_MIGRATE 2012-08-27 09:13:10 +03:00
Yonit Halperin
6b74168871 migration_protocol: add display channel migration data 2012-08-27 09:13:09 +03:00
Yonit Halperin
35227cd11f inputs channel: use the default red_channel behaviour for client_cbs.migrate
The default callback sends SPICE_MSG_MIGRATE to the client.
2012-08-27 09:13:09 +03:00
Yonit Halperin
5aec370a7a inputs channel: fix using spice messages enums as pipe items type
A channel pipe item type must start from PIPE_ITEM_TYPE_CHANNEL_BASE.
SPICE_MSG_MIGRATE value eq. PIPE_ITEM_TYPE_SET_ACK. Setting a pipe item
type to SPICE_MSG_MIGRATE, leads to red_channel handling PIPE_ITEM_TYPE_SET_ACK.
2012-08-27 09:13:09 +03:00
Yonit Halperin
9c6a49c364 char_device: don't connect a migrated client if the state of the device might have changed since it was created
If reading/writing from the device have occured before migration data
has arrived, the migration data might no longer be relvant, and we
disconnect the client.
2012-08-27 09:13:08 +03:00
Yonit Halperin
a180fc5e0b main: restore state from migration data
Also removed old migration leftovers.
2012-08-27 09:13:08 +03:00
Yonit Halperin
fa9bfd01f1 main: send migration data
Also removed some unused definitions from reds that used to belong to
old agent and migration code.
2012-08-27 09:13:07 +03:00
Yonit Halperin
3af4b7235d main: send MSG_MIGRATE upon vm migration completion
Before sending the above msg, if there is a pending partial msg that
has been read from the agent, we send it to the client. The alternative
was to keep the msg as part of the migration data, and then
to send it to the destination server via the client and to wait there
for the msg chunk completion, before sending it to the client. Of
course, the latter is less efficient.
2012-08-27 09:13:07 +03:00
Yonit Halperin
c617379821 reds: s/HADER/HEADER 2012-08-27 09:13:07 +03:00
Yonit Halperin
443b2d4270 migration_protocol: add migration data for the main channel (mainly for the agent) 2012-08-27 09:13:06 +03:00
Yonit Halperin
d866114d90 main_channel: fix using spice messages enums as pipe items type
A channel pipe item type must start from PIPE_ITEM_TYPE_CHANNEL_BASE.
SPICE_MSG_MIGRATE value eq. PIPE_ITEM_TYPE_SET_ACK. Setting a pipe item
type to SPICE_MSG_MIGRATE, leads to red_channel handling PIPE_ITEM_TYPE_SET_ACK.

Also removed sending SPICE_MSG_MIGRATE. It will be handled in the next
patch.
2012-08-27 09:13:06 +03:00
Yonit Halperin
157d459d42 red_channel: introduce PIPE_ITEM_TYPE_EMPTY_MSG
The pipe item is used for sending messages that don't have body.
2012-08-27 09:13:06 +03:00
Yonit Halperin
fdab42cc41 smartcard: restore state after migration from migration data 2012-08-27 09:13:05 +03:00
Yonit Halperin
e07dd381ab smartcard migration: send migration data 2012-08-27 09:13:05 +03:00
Yonit Halperin
6ff73836cf migration_protocol: add migration data for smartcard 2012-08-27 09:13:05 +03:00
Yonit Halperin
2670fb9765 smartcard: send MSG_MIGRATE upon vm migration completion
The above is the default behaviour for red_channel_client, if
client_cbs.migrate is not registered as part of red_channel_register_client_cbs
2012-08-27 09:13:04 +03:00
Yonit Halperin
6c9d1330af smartcard: fix PIPE_ITEMs enum indexing
The enum should start from PIPE_ITEM_TYPE_CHANNEL_BASE, otherwise,
PIPE_ITEM_TYPE_ERROR is handled like PIPE_ITEM_TYPE_SET_ACK.
2012-08-27 09:13:04 +03:00
Yonit Halperin
b3c16d2ae7 smartcard: change the timing of attaching a client to SpiceCharDeviceState
Attach/detach a client to a SpiceCharDeviceState upon its
connection/disconnection, instead of upon reader_add/remove messages.
When the client is removed from a SpiceCharDeviceState, all the
messages from this client are removed from the device write queue.
This shouldn't happen when we only receive reader_remove and the
client is still connected.
2012-08-27 09:13:04 +03:00
Yonit Halperin
733a804c99 spicevmc migration: restore migration dest state from migration data 2012-08-27 09:13:04 +03:00
Yonit Halperin
ef44c5eff9 spicevmc migration: send migration data 2012-08-27 09:13:03 +03:00
Yonit Halperin
15fe69e06b spicevmc: send MSG_MIGRATE upon vm migration completion
The above is the default behaviour for red_channel_client, if
client_cbs.migrate is not registered as part of red_channel_register_client_cbs
2012-08-27 09:13:03 +03:00
Yonit Halperin
1f85f1de65 migration_protocol: add migration data for spicevmc 2012-08-27 09:13:03 +03:00
Yonit Halperin
99ea64ac5a char device migration: restore state at destination from migration data 2012-08-27 09:13:02 +03:00
Yonit Halperin
cb767a83fd char device migration: don't read or write from/to the device while waiting for migraion data 2012-08-27 09:13:02 +03:00
Yonit Halperin
b0264a5e37 char device migration: marshall migration data 2012-08-27 09:13:02 +03:00
Yonit Halperin
520e2cd4f4 char_device: variable token price for write buffers
When restoring migration data, we also restore data that is addressed to
the device, and that might have been originated from more than 1
message. When the write buffer that is assoicated with this data is
released, we need to free all the relevant tokens.
2012-08-27 09:13:01 +03:00
Yonit Halperin
1d2b071d15 migration_protocol: add migration data for char devices 2012-08-27 09:13:01 +03:00
Yonit Halperin
8875e1da45 replace some migration related spice_error calls with info/warning 2012-08-27 09:13:01 +03:00
Yonit Halperin
275e4312df seamless migration: migration completion on the destination side
Tracking the channels that wait for migration data. If there
is a new migration process pending, when all the channels have
restored their state, we begin the new migration.
2012-08-27 09:13:00 +03:00
Yonit Halperin
eb4c95b08b red_channel: handle sending SPICE_MSG_MIGRATE
The relevant code is common to all channels.

The patch also contains a fix to the return value for
handle_migrate_data callback: s/uint64_t/int
2012-08-27 09:13:00 +03:00
Yonit Halperin
4f551a3550 red_channel: fix pipe item leak 2012-08-27 09:12:59 +03:00
Yonit Halperin
bb8c90d8c2 seamleass migration: manage post migration phase in the src side
In semi-seamless, SPICE_MSG_MAIN_MIGRATE_END is sent.
In seamless, each channel migrates separately.

The src waits till all the clients are disconnected (or a timeout), and
then it notifies qemu that spice migration has completed.

The patch doesn't include the per-channel logic for seamless migration
(sending MSG_MIGRATE, MIGRATE_DATA, etc.).
2012-08-27 09:12:59 +03:00
Yonit Halperin
8e2576d5ab seamless migration: pre migration phase on the destination side
- handle SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS
- reply with SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK/NACK
- prepare the channels for migration according to the migration
   type (semi/seamless)

see spice-protocol for more details:
commit 3838ad140a046c4ddf42fef58c9727ecfdc09f9f
2012-08-27 09:12:50 +03:00
Yonit Halperin
43e0897da5 seamless migration: pre migration phase on the src side
sending SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS and handling
SPICE_MSGC_MAIN_MIGRATE_CONNECTED_SEAMLESS

The src side signals the client to establish a connection
to the destination.
In seamless migration, the client is also used to perform
a sort of handshake with the destination, for verifying
if seamless migration can be supported.

see spice-protocol for more details:
commit 3838ad140a046c4ddf42fef58c9727ecfdc09f9f
2012-08-27 09:12:03 +03:00
Yonit Halperin
35cf65a45e seamless-migration: update spice-common submodule
Also Update server and client according to the change of
SpiceMsgMainMigrationBegin: it now holds all the fields inside
SpiceMigrationDstInfo.
2012-08-27 09:10:53 +03:00
Yonit Halperin
70f820ded2 seamless-migration: add migration_protocol.h
The file will hold the declarations of the different migration
data messages (depending on the channel), that will be passed
from the src server to the dst server, via the client, using
SPICE_MSG_MIGRATE_DATA.
2012-08-27 09:04:52 +03:00
Yonit Halperin
92f3ee6ed8 bump version to 0.11.2
New api entries:
    spice_server_vm_start
    spice_server_vm_stop
    spice_server_set_seamless_migration
2012-08-27 09:04:52 +03:00
Yonit Halperin
f45fb9e1b6 spice.h: add spice_server_set_seamless_migration
This new call is used in order to identify whether qemu, or
the management (e.g. libvirt), support seamless migration.
If it is supported, qemu spice cmd-line configuration should have
seamless-migration=on.

In addition, we disable seamless migration support if multiple clients
are allowed. Currently, only one client is supported.
2012-08-27 09:04:52 +03:00