Revision b5d17adb

b/migration.c
54 54
        fprintf(stderr, "unknown migration protocol: %s\n", uri);
55 55
}
56 56

  
57
void do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
57
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
58 58
{
59 59
    MigrationState *s = NULL;
60 60
    const char *p;
......
64 64
    if (current_migration &&
65 65
        current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) {
66 66
        monitor_printf(mon, "migration already in progress\n");
67
        return;
67
        return -1;
68 68
    }
69 69

  
70
    if (strstart(uri, "tcp:", &p))
70
    if (strstart(uri, "tcp:", &p)) {
71 71
        s = tcp_start_outgoing_migration(mon, p, max_throttle, detach,
72 72
                                         (int)qdict_get_int(qdict, "blk"), 
73 73
                                         (int)qdict_get_int(qdict, "inc"));
74 74
#if !defined(WIN32)
75
    else if (strstart(uri, "exec:", &p))
75
    } else if (strstart(uri, "exec:", &p)) {
76 76
        s = exec_start_outgoing_migration(mon, p, max_throttle, detach,
77 77
                                          (int)qdict_get_int(qdict, "blk"), 
78 78
                                          (int)qdict_get_int(qdict, "inc"));
79
    else if (strstart(uri, "unix:", &p))
79
    } else if (strstart(uri, "unix:", &p)) {
80 80
        s = unix_start_outgoing_migration(mon, p, max_throttle, detach,
81 81
					  (int)qdict_get_int(qdict, "blk"), 
82 82
                                          (int)qdict_get_int(qdict, "inc"));
83
    else if (strstart(uri, "fd:", &p))
83
    } else if (strstart(uri, "fd:", &p)) {
84 84
        s = fd_start_outgoing_migration(mon, p, max_throttle, detach, 
85 85
                                        (int)qdict_get_int(qdict, "blk"), 
86 86
                                        (int)qdict_get_int(qdict, "inc"));
87 87
#endif
88
    else
88
    } else {
89 89
        monitor_printf(mon, "unknown migration protocol: %s\n", uri);
90
        return -1;
91
    }
90 92

  
91
    if (s == NULL)
93
    if (s == NULL) {
92 94
        monitor_printf(mon, "migration failed\n");
93
    else {
94
        if (current_migration)
95
            current_migration->release(current_migration);
95
        return -1;
96
    }
96 97

  
97
        current_migration = s;
98
    if (current_migration) {
99
        current_migration->release(current_migration);
98 100
    }
101

  
102
    current_migration = s;
103
    return 0;
99 104
}
100 105

  
101 106
int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data)
b/migration.h
52 52

  
53 53
void qemu_start_incoming_migration(const char *uri);
54 54

  
55
void do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
55
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data);
56 56

  
57 57
int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data);
58 58

  
b/qemu-monitor.hx
773 773
		      "shared storage with incremental copy of disk "
774 774
		      "(base image shared between src and destination)",
775 775
        .user_print = monitor_user_noop,	
776
	.mhandler.cmd_new = do_migrate,
776
	.cmd_new_ret = do_migrate,
777 777
    },
778 778

  
779 779

  

Also available in: Unified diff