Revision 511c0231
b/migration-exec.c | ||
---|---|---|
121 | 121 |
static void exec_accept_incoming_migration(void *opaque) |
122 | 122 |
{ |
123 | 123 |
QEMUFile *f = opaque; |
124 |
int ret; |
|
125 | 124 |
|
126 |
ret = qemu_loadvm_state(f); |
|
127 |
if (ret < 0) { |
|
128 |
fprintf(stderr, "load of migration failed\n"); |
|
129 |
goto err; |
|
130 |
} |
|
131 |
qemu_announce_self(); |
|
132 |
DPRINTF("successfully loaded vm state\n"); |
|
133 |
|
|
134 |
if (autostart) |
|
135 |
vm_start(); |
|
136 |
|
|
137 |
err: |
|
125 |
process_incoming_migration(f); |
|
138 | 126 |
qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); |
139 | 127 |
qemu_fclose(f); |
140 | 128 |
} |
b/migration-fd.c | ||
---|---|---|
104 | 104 |
static void fd_accept_incoming_migration(void *opaque) |
105 | 105 |
{ |
106 | 106 |
QEMUFile *f = opaque; |
107 |
int ret; |
|
108 | 107 |
|
109 |
ret = qemu_loadvm_state(f); |
|
110 |
if (ret < 0) { |
|
111 |
fprintf(stderr, "load of migration failed\n"); |
|
112 |
goto err; |
|
113 |
} |
|
114 |
qemu_announce_self(); |
|
115 |
DPRINTF("successfully loaded vm state\n"); |
|
116 |
|
|
117 |
if (autostart) |
|
118 |
vm_start(); |
|
119 |
|
|
120 |
err: |
|
108 |
process_incoming_migration(f); |
|
121 | 109 |
qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL); |
122 | 110 |
qemu_fclose(f); |
123 | 111 |
} |
b/migration-tcp.c | ||
---|---|---|
141 | 141 |
socklen_t addrlen = sizeof(addr); |
142 | 142 |
int s = (unsigned long)opaque; |
143 | 143 |
QEMUFile *f; |
144 |
int c, ret;
|
|
144 |
int c; |
|
145 | 145 |
|
146 | 146 |
do { |
147 | 147 |
c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); |
... | ... | |
160 | 160 |
goto out; |
161 | 161 |
} |
162 | 162 |
|
163 |
ret = qemu_loadvm_state(f); |
|
164 |
if (ret < 0) { |
|
165 |
fprintf(stderr, "load of migration failed\n"); |
|
166 |
goto out_fopen; |
|
167 |
} |
|
168 |
qemu_announce_self(); |
|
169 |
DPRINTF("successfully loaded vm state\n"); |
|
170 |
|
|
171 |
if (autostart) |
|
172 |
vm_start(); |
|
173 |
|
|
174 |
out_fopen: |
|
163 |
process_incoming_migration(f); |
|
175 | 164 |
qemu_fclose(f); |
176 | 165 |
out: |
177 | 166 |
qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); |
b/migration-unix.c | ||
---|---|---|
149 | 149 |
socklen_t addrlen = sizeof(addr); |
150 | 150 |
int s = (unsigned long)opaque; |
151 | 151 |
QEMUFile *f; |
152 |
int c, ret;
|
|
152 |
int c; |
|
153 | 153 |
|
154 | 154 |
do { |
155 | 155 |
c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); |
... | ... | |
168 | 168 |
goto out; |
169 | 169 |
} |
170 | 170 |
|
171 |
ret = qemu_loadvm_state(f); |
|
172 |
if (ret < 0) { |
|
173 |
fprintf(stderr, "load of migration failed\n"); |
|
174 |
goto out_fopen; |
|
175 |
} |
|
176 |
qemu_announce_self(); |
|
177 |
DPRINTF("successfully loaded vm state\n"); |
|
178 |
|
|
179 |
if (autostart) |
|
180 |
vm_start(); |
|
181 |
|
|
182 |
out_fopen: |
|
171 |
process_incoming_migration(f); |
|
183 | 172 |
qemu_fclose(f); |
184 | 173 |
out: |
185 | 174 |
qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); |
b/migration.c | ||
---|---|---|
58 | 58 |
return ret; |
59 | 59 |
} |
60 | 60 |
|
61 |
void process_incoming_migration(QEMUFile *f) |
|
62 |
{ |
|
63 |
if (qemu_loadvm_state(f) < 0) { |
|
64 |
fprintf(stderr, "load of migration failed\n"); |
|
65 |
exit(0); |
|
66 |
} |
|
67 |
qemu_announce_self(); |
|
68 |
DPRINTF("successfully loaded vm state\n"); |
|
69 |
|
|
70 |
if (autostart) |
|
71 |
vm_start(); |
|
72 |
} |
|
73 |
|
|
61 | 74 |
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) |
62 | 75 |
{ |
63 | 76 |
MigrationState *s = NULL; |
b/migration.h | ||
---|---|---|
50 | 50 |
void *opaque; |
51 | 51 |
}; |
52 | 52 |
|
53 |
void process_incoming_migration(QEMUFile *f); |
|
54 |
|
|
53 | 55 |
int qemu_start_incoming_migration(const char *uri); |
54 | 56 |
|
55 | 57 |
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data); |
Also available in: Unified diff