Commit Graph

853 Commits

Author SHA1 Message Date
Yonit Halperin
4b2bf4d88c client: support semi-seamless migration between spice servers with different protocols.
It can't actually happen right now, since switch-host migration scheme will take
place if the src/target server has protocol 1.
2011-09-26 12:18:00 +03:00
Yonit Halperin
010b22cd77 client: display channel - destroy all surfaces on disconnect
Fix not destroying surfaces and other data (e.g., streams) upon disconnection.
2011-09-26 12:17:59 +03:00
Yonit Halperin
cad3c58544 client: display channel migration 2011-09-26 12:17:59 +03:00
Yonit Halperin
d3ed9d5e9d client: playback/record channels: implement on_disconnect 2011-09-26 12:17:59 +03:00
Yonit Halperin
f91d202eb3 client: main channel migration: do partial cleanup when switching hosts
Implement on_disconnect_mig_src and on_connect_mig_target in order to avoid
unnecessary cleanups done in on_(disconnet|connect).
In addition, do not request guest display settings changes after migration.
2011-09-26 12:17:58 +03:00
Yonit Halperin
510a4ff7c4 client: handle SPICE_MSG_MAIN_MIGRATE_END
(1) disconnect all channels from the migration src
(2) after all channels are disconnected, clean global resources
(3) send SPICE_MSGC_MAIN_MIGRATE_END to migration target
(4) wait for SPICE_MSG_MAIN_INIT
(4) switch all channels to migration target
2011-09-26 12:17:58 +03:00
Yonit Halperin
31ed2519a7 client: handle SpiceMsgMainMigrationBegin for 0.8.2
RHBZ 725009, 738270
2011-09-26 12:17:58 +03:00
Yonit Halperin
59e55605cc client: RedPeer::HostAuthOptions::set_cert_subject 2011-09-26 12:17:58 +03:00
Yonit Halperin
fcb3b4ce52 client: rewrite surfaces cache
use std::map instead of a specific template (CHash).
There is no need for special template. Moreover, using
std::map will allow easy iteration over the surfaces.
2011-09-26 12:17:57 +03:00
Yonit Halperin
f29dc9b620 server: fix not calling migrate_connect completion callback
When the server is a migration target and spice_server_migrate_connect
is called before SPICE_MSGC_MIGRATE_END has been received, we start
the mig_timer. We handle the migrate_connect only when receiving SPICE_MSGC_MIGRATE_END.
If the mig_timer expires before that, we dismiss the request, and should call the
migrate_connect completion callback. Since reds->mig_inprogress
wasn't set appropriately, it wasn't called.
2011-09-26 12:17:57 +03:00
Yonit Halperin
524fcb3aa4 server: fall back to switch host scheme in case semi-seamless connection to target fails 2011-09-26 12:17:56 +03:00
Yonit Halperin
b821316771 server: turn spice_server_migrate_start into a valid call
We will add a qemu call to spice_server_migrate_start when migration starts.
For now, it does nothing, but we may need this notification in the future.
2011-09-25 15:04:08 +03:00
Yonit Halperin
ddf1188b30 server: call migrate_connect_complete callback when no client is connected 2011-09-25 15:04:08 +03:00
Yonit Halperin
4568f2dbbe server: handling semi-seamless migration in the target side
(1) not sending anything to the client till we recieve SPICE_MSGC_MIGRATE_END
(2) start a new migration (handle client_migrate_info) only after SPICE_MSGC_MIGRATE_END
    from the previous migration has been received
(3) use the correct ticket

Note: we assume the same channles are linked before and ater migration. i.e.,
SPICE_MSGC_MAIN_ATTACH_CHANNELS is not sent from the client.
2011-09-25 15:04:08 +03:00
Yonit Halperin
0e57df1dd1 server: move the linking of channels to a separate routine 2011-09-25 15:04:08 +03:00
Yonit Halperin
1081d8ccf0 server: move SPICE_MSG_MAIN_INIT sending code to a separate routine 2011-09-25 15:04:07 +03:00
Yonit Halperin
4b82580fc3 server: send SPICE_MSG_MAIN_MIGRATE_END on spice_server_migrate_end 2011-09-25 15:04:07 +03:00
Yonit Halperin
cfbd077105 spice.proto: add SPICE_MSG_MAIN_MIGRATE_END & SPICE_MSGC_MAIN_MIGRATE_END 2011-09-25 15:04:06 +03:00
Yonit Halperin
5560c56ef0 server,proto: tell the client to connect to the migration target before migraton starts
(1) send SPICE_MSG_MAIN_MIGRATE_BEGIN upon spice_server_migrate_connect
(2) wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR), or a timeout, in order
    to complete client_migrate_info monitor command
2011-09-25 15:04:05 +03:00
Yonit Halperin
55ccc022ec configure: spice-protocol >= 0.8.2 (semi-seamless migration protocol) 2011-09-25 15:04:05 +03:00
Yonit Halperin
3ac0075cda server: handle migration interface addition 2011-09-25 15:04:05 +03:00
Yonit Halperin
6e56bea67c server/spice.h: semi-seamless migration interface, RHBZ #738266
semi-seamless migration details:

migration source side
---------------------
(1) spice_server_migrate_connect (*): tell client to link
    to the target side - send SPICE_MSG_MAIN_MIGRATE_BEGIN.
    This should be called upon client_migrate_info cmd.
    client_migrate_info is asynchronous.
(2) Complete spice_server_migrate_connect only when the client has been connected
    to the target - wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) or a timeout.
(3) spice_server_migrate_end: tell client migration it can switch to the target - send
    SPICE_MSG_MAIN_MIGRATE_END.
(4) client cleans up all data related to the connection to the source and switches to the target.
    It sends SPICE_MSGC_MAIN_MIGRATE_END.

migration target side
---------------------
(1) the server identifies itself as a migraiton target since the client is linked with (connection_id != 0)
(2) server doesn't start the channels' logic (channel->link) till it receives SPICE_MSGC_MAIN_MIGRATE_END
    from the client.

*   After migration starts, the target qemu is blocked and cannot accept new spice client
    connections. Thus, we trigger the connection to the target upon client_migrate_info
    command.
2011-09-25 15:04:04 +03:00
Christophe Fergeau
b353c8e04f client: don't crash when booting a Xinerama setup
In a Xinerama setup, when X starts up and creates one of the
secondary screens, first a non-primary surface is created on the
secondary screen, and then the primary surface for this screen is
created.
This causes a crash when the guest uses Xinerama and the client
is attached to the VM before X starts (ie while the guest is
booting).
This happens because DisplayChannel::create_canvas (which is called
when creating a non-primary surface) assumes a screen has already been
set for the DisplayChannel while this only happens upon primary surface
creation. However, it uses the screen for non important stuff, so we
can test if screen() is non NULL before using it. This is what is done
in other parts of this file.

Fixes rhbz #732423
2011-09-20 16:12:30 +02:00
Marc-André Lureau
d8e7839054 fix infinite loop in resolution change
After hours of investigation, I am a bit clueless.. It seems XRR is sending
us spurious ScreenChangeNotify in a loop. So we keep calling
init_monitors(), which creates new platform_win etc.. Although none of the
clients seems to be resetting the screen (checked all XRRSet..). The fact
that we create many platform_win looks like a bug to me, and indeed, it
seems to help if we reuse the same platform_win over the various
init_monitors() calls.

Fixes rhbz #692833
2011-09-20 16:08:30 +02:00
Christophe Fergeau
d27a6708b0 fix 2 X11 related leaks 2011-09-20 16:08:30 +02:00
Christophe Fergeau
2cf6022100 channel: fix EVP_PKEY leak 2011-09-20 16:08:30 +02:00
Christophe Fergeau
97ebbc1c0b always set VDAgentDisplayConfig::depth
Even if VDAgentDisplayConfig::depth will be unused if the
VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH isn't set, it's
better to initialize it anyway to avoid warnings from valgrind.
2011-09-20 16:08:30 +02:00
Christophe Fergeau
ff8c54d766 fix integer marshalling helpers on big endian
They were trying to convert the destination pointer to an integer before
trying to dereference it. The initial conversion was meant to be a cast
to a pointer of the right size, not to an integer.
2011-09-20 16:08:30 +02:00
Christophe Fergeau
3c03489a27 fix typo in big endian code path
uint63_t should be uint64_t
2011-09-20 16:08:30 +02:00
Alon Levy
506f035682 server/smartcard: fix smartcard_channel_send_error
It was sending the wrong data, the memory right after the VCSMsgHeader
which was actually not where the data was.

Fixed by having the header and data (VSCError, 4 bytes of the error code)
embedded in the ErrorItem pipe item.
2011-09-20 16:08:30 +02:00
Yonit Halperin
11fe46f139 client: setting monitors resolution before resizing screens, RHBZ #728252
fix for "client: fix endless recursion in rearrange_monitors, RHBZ #692976"
2011-08-25 15:04:27 +03:00
Alon Levy
6862c810f3 client/red_client: fix broken switch host migration (RHBZ 727969)
3f8d7e59db introduced a regression, after
sending one attach_channels message we never send another one.
Fix by resetting on disconnect.
2011-08-03 23:02:03 +03:00
Alon Levy
13e38cdba6 server/red_dispatcher: fix wrong resolution set for tablet
when changing resolutions due to the new async code paths the surface
creation command was kept by reference, and later, when the red_worker
signaled completion by calling async_complete the mouse mode was updated
using the reference. This caused the wrong values to be read resulting in wrong
resolutions set and a non working mouse pointer. Fix this by keeping a copy of
the surface creation command instead of a reference.

No bz. Found in testing.
2011-07-31 17:49:47 +03:00
Christophe Fergeau
0c8438c7ff client: fix 30s timeout regression
Changelog from Arnon Gilboa, patch from me:

Commit eb6f554094 caused the following regression:

When client runs without the auto-conf or disable-effects options
(either from CLI or controller), which is the case when using Spice
from Admin Portal, the client will unecessarily wait for 30sec before
connecting to a Windows guest with an agent running (this won't happen
with linux guests or without an agent running).

The mentioned patch assumed that on_agent_reply() of
VD_AGENT_DISPLAY_CONFIG will call send_main_attach_channels() and
connect. However, when auto-conf or disable-effects are not used,
on_agent_reply() will ignore the reply and not call
send_main_attach_channels(). Therefore, send_main_attach_channels()
will only be called on agent timeout.

The solution is to activate agent timer only if auto-conf or
disable-effects. Otherwise, simply call send_main_attach_channels().

Fixes rhbz #726441
2011-07-31 13:32:49 +03:00
Hans de Goede
54c660470a Drop unnecessary X11 and alsa requires from spice-server.pc 2011-07-27 02:07:01 +02:00
Yonit Halperin
c8d63ceb2f server: not reading command rings before RED_WORKER_MESSAGE_START, RHBZ #718713
On migration, destroy_surfaces is called from qxl (qxl_hard_reset), before the device was loaded (on destination).
handle_dev_destroy_surfaces led to red_process_commands, which read the qxl command ring
(which appeared to be not empty), and then when processing the command
it accessed unmapped memory.
2011-07-24 12:25:58 +03:00
Alon Levy
f0e5a3cb77 Release 0.8.2 2011-07-22 16:37:02 +03:00
Alon Levy
0b6a490110 distcheck: add --enable-smartcard --with-sasl 2011-07-22 16:24:04 +03:00
Christophe Fergeau
aab6aa419c fix make distcheck 2011-07-22 16:24:04 +03:00
Christophe Fergeau
ebe1cf76d4 client: don't die if initial agent timeout triggers
When the client connects to a spice VM, if an agent is detected,
there will be a few messages exchanged to exchange capabilities,
display resolutions, ... This exchange has a timeout in case
something goes wrong. However, when it fires, the client dies.
This commit changes this and lets the client connects to the
guest when the timeout happens.
rhbz #673973
2011-07-22 16:24:04 +03:00
Christophe Fergeau
3f8d7e59db client: only send one SPICE_MSGC_MAIN_ATTACH_CHANNELS messages
492f7a9b fixed unwanted timeouts during initial client startup,
but it also caused a bad regression when connecting to
RHEL6+agent guests: the SPICE_MSGS_MAIN_ATTACH_CHANNELS message
was sent multiple times, once in RedClient::handle_init, then
once again in RedClient::on_agent_announce_capabilities (which
can even be triggered multiple times). Sending this message multiple
times is a big NO and causes the server to close the client connection,
and the client to die. Add a _msg_attach_message_sent boolean to
make sure we only send this message once.

rhbz #712938
2011-07-21 19:02:10 +03:00
Yonit Halperin
858596bb48 client: fix endless recursion in rearrange_monitors, RHBZ #692976
I changed RedScreen::resize not to call rearrange_monitors. Instead,
the monitor should be configured correctly from Application, before
calling resize.
In addition, I made some cleanups to allow reusing rearrange_monitors code.
2011-07-21 15:09:30 +03:00
Yonit Halperin
3bc4fd4621 server/red_worker: send surface images to client on-demand after S3/4 wakeup
When surfaces are being reloaded to the worker, we
will send them to the client only if and when it needs them.
(cherry picked from commit 51628f5124)
2011-07-21 15:09:30 +03:00
Alon Levy
1024d3ec3d server/spice.h: bump QXL_MINOR because of QXLWorker and QXLInterface changes
(cherry picked from commit 3be08d68c0)
2011-07-21 15:09:30 +03:00
Alon Levy
32d2817ef0 server: add QXLWorker.flush_surfaces_async for S3/S4 support
This does the following, all to remove any referenced memory on the pci bars:
    flush_all_qxl_commands(worker);
    flush_all_surfaces(worker);
    red_wait_outgoing_item((RedChannel *)worker->display_channel);
    red_wait_outgoing_item((RedChannel *)worker->cursor_channel);

The added api is specifically async, i.e. it calls async_complete
when done.
(cherry picked from commit 2a4d97fb78)
2011-07-21 15:09:29 +03:00
Alon Levy
c72dc24756 server: add QXLInterface::update_area_complete callback
when update_area_async is called update_area_complete will be called with
the surfaces dirty rectangle list.
(cherry picked from commit b26f0532c1)
2011-07-21 15:09:29 +03:00
Alon Levy
deea6ac96b server/red_worker: handle_dev_input: reuse write_ready introduced for async
(cherry picked from commit f300de20d9)
2011-07-21 15:09:29 +03:00
Alon Levy
b233761b91 server: add async io support
The new _ASYNC io's in qxl_dev listed at the end get six new api
functions, and an additional callback function "async_complete". When
the async version of a specific io is used, completion is notified by
calling async_complete, and no READY message is written or expected by
the dispatcher.

update_area has been changed to push QXLRects to the worker thread, where
the conversion to SpiceRect takes place.

A cookie has been added to each async call to QXLWorker, and is passed back via
async_complete.

Added api:

QXLWorker:
    update_area_async
    add_memslot_async
    destroy_surfaces_async
    destroy_primary_surface_async
    create_primary_surface_async
    destroy_surface_wait_async

QXLInterface:
    async_complete

(cherry picked from commit 096f49afbf)
2011-07-21 15:09:29 +03:00
Yonit Halperin
84ff23cd2b server: replace redundant code with red_cursor_reset
In addition (1) make handle_dev_destroy_surfaces call red_release_cursor
(2) call red_wait_outgoing_item(cursor_channel) only after adding msgs to pipe

[3d3066b175 cherry-pick with modifications]
2011-07-21 15:09:29 +03:00
Christophe Fergeau
7db7212c3a use foo(void) instead of foo() in prototypes
In C, the latter isn't a prototype for a function with no arg,
but declares a function with an undefined number of args.

[picked from master with changes since no main_channel, spice_common,
 and a bunch of functions aren't there yet]
2011-07-21 15:09:29 +03:00