Revision 026f773f

b/ui/spice-core.c
288 288
#endif
289 289
};
290 290

  
291
#ifdef SPICE_INTERFACE_MIGRATION
292
typedef struct SpiceMigration {
293
    SpiceMigrateInstance sin;
294
    struct {
295
        MonitorCompletion *cb;
296
        void *opaque;
297
    } connect_complete;
298
} SpiceMigration;
299

  
300
static void migrate_connect_complete_cb(SpiceMigrateInstance *sin);
301

  
302
static const SpiceMigrateInterface migrate_interface = {
303
    .base.type = SPICE_INTERFACE_MIGRATION,
304
    .base.description = "migration",
305
    .base.major_version = SPICE_INTERFACE_MIGRATION_MAJOR,
306
    .base.minor_version = SPICE_INTERFACE_MIGRATION_MINOR,
307
    .migrate_connect_complete = migrate_connect_complete_cb,
308
    .migrate_end_complete = NULL,
309
};
310

  
311
static SpiceMigration spice_migrate;
312

  
313
static void migrate_connect_complete_cb(SpiceMigrateInstance *sin)
314
{
315
    SpiceMigration *sm = container_of(sin, SpiceMigration, sin);
316
    if (sm->connect_complete.cb) {
317
        sm->connect_complete.cb(sm->connect_complete.opaque, NULL);
318
    }
319
    sm->connect_complete.cb = NULL;
320
}
321
#endif
322

  
291 323
/* config string parsing */
292 324

  
293 325
static int name2enum(const char *string, const char *table[], int entries)
......
449 481
{
450 482
    MigrationState *s = data;
451 483

  
452
    if (migration_has_finished(s)) {
484
    if (migration_is_active(s)) {
485
#ifdef SPICE_INTERFACE_MIGRATION
486
        spice_server_migrate_start(spice_server);
487
#endif
488
    } else if (migration_has_finished(s)) {
453 489
#if SPICE_SERVER_VERSION >= 0x000701 /* 0.7.1 */
490
#ifndef SPICE_INTERFACE_MIGRATION
454 491
        spice_server_migrate_switch(spice_server);
492
#else
493
        spice_server_migrate_end(spice_server, true);
494
    } else if (migration_has_failed(s)) {
495
        spice_server_migrate_end(spice_server, false);
496
#endif
455 497
#endif
456 498
    }
457 499
}
......
461 503
                            MonitorCompletion *cb, void *opaque)
462 504
{
463 505
    int ret;
506
#ifdef SPICE_INTERFACE_MIGRATION
507
    spice_migrate.connect_complete.cb = cb;
508
    spice_migrate.connect_complete.opaque = opaque;
509
    ret = spice_server_migrate_connect(spice_server, hostname,
510
                                       port, tls_port, subject);
511
#else
464 512
    ret = spice_server_migrate_info(spice_server, hostname,
465 513
                                    port, tls_port, subject);
466 514
    cb(opaque, NULL);
515
#endif
467 516
    return ret;
468 517
}
469 518

  
......
654 703

  
655 704
    migration_state.notify = migration_state_notifier;
656 705
    add_migration_state_change_notifier(&migration_state);
706
#ifdef SPICE_INTERFACE_MIGRATION
707
    spice_migrate.sin.base.sif = &migrate_interface.base;
708
    spice_migrate.connect_complete.cb = NULL;
709
    qemu_spice_add_interface(&spice_migrate.sin.base);
710
#endif
657 711

  
658 712
    qemu_spice_input_init();
659 713
    qemu_spice_audio_init();

Also available in: Unified diff