mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-17 21:26:13 -07:00
migration: Refactor MigrationState creation
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
22f00a4445
commit
0edda1c42a
6 changed files with 32 additions and 70 deletions
|
|
@ -89,21 +89,12 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon,
|
|||
if (parse_host_port(&addr, host_port) < 0)
|
||||
return NULL;
|
||||
|
||||
s = g_malloc0(sizeof(*s));
|
||||
s = migrate_new(mon, bandwidth_limit, detach, blk, inc);
|
||||
|
||||
s->get_error = socket_errno;
|
||||
s->write = socket_write;
|
||||
s->close = tcp_close;
|
||||
s->cancel = migrate_fd_cancel;
|
||||
s->get_status = migrate_fd_get_status;
|
||||
s->release = migrate_fd_release;
|
||||
|
||||
s->blk = blk;
|
||||
s->shared = inc;
|
||||
|
||||
s->state = MIG_STATE_ACTIVE;
|
||||
s->mon = NULL;
|
||||
s->bandwidth_limit = bandwidth_limit;
|
||||
s->fd = qemu_socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (s->fd == -1) {
|
||||
g_free(s);
|
||||
|
|
@ -112,10 +103,6 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon,
|
|||
|
||||
socket_set_nonblock(s->fd);
|
||||
|
||||
if (!detach) {
|
||||
migrate_fd_monitor_suspend(s, mon);
|
||||
}
|
||||
|
||||
do {
|
||||
ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr));
|
||||
if (ret == -1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue