~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to migration-exec.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include "migration.h"
19
19
#include "qemu-char.h"
20
20
#include "sysemu.h"
21
 
#include "console.h"
22
21
#include "buffered_file.h"
23
22
#include "block.h"
24
23
 
55
54
 
56
55
MigrationState *exec_start_outgoing_migration(const char *command,
57
56
                                             int64_t bandwidth_limit,
58
 
                                             int async)
 
57
                                             int detach)
59
58
{
60
59
    FdMigrationState *s;
61
60
    FILE *f;
89
88
    s->mig_state.release = migrate_fd_release;
90
89
 
91
90
    s->state = MIG_STATE_ACTIVE;
92
 
    s->detach = !async;
 
91
    s->mon_resume = NULL;
93
92
    s->bandwidth_limit = bandwidth_limit;
94
93
 
95
 
    if (s->detach == 1) {
96
 
        dprintf("detaching from monitor\n");
97
 
        monitor_suspend();
98
 
        s->detach = 2;
99
 
    }
 
94
    if (!detach)
 
95
        migrate_fd_monitor_suspend(s);
100
96
 
101
97
    migrate_fd_connect(s);
102
98
    return &s->mig_state;
108
104
    return NULL;
109
105
}
110
106
 
111
 
int exec_start_incoming_migration(const char *command)
 
107
static void exec_accept_incoming_migration(void *opaque)
112
108
{
 
109
    QEMUFile *f = opaque;
113
110
    int ret;
114
 
    QEMUFile *f;
115
111
 
116
 
    dprintf("Attempting to start an incoming migration\n");
117
 
    f = qemu_popen_cmd(command, "r");
118
 
    if(f == NULL) {
119
 
        dprintf("Unable to apply qemu wrapper to popen file\n");
120
 
        return -errno;
121
 
    }
122
 
    vm_stop(0); /* just in case */
123
112
    ret = qemu_loadvm_state(f);
124
113
    if (ret < 0) {
125
114
        fprintf(stderr, "load of migration failed\n");
127
116
    }
128
117
    qemu_announce_self();
129
118
    dprintf("successfully loaded vm state\n");
130
 
    vm_start();
131
 
    qemu_fclose(f);
132
 
    return 0;
 
119
    /* we've successfully migrated, close the fd */
 
120
    qemu_set_fd_handler2(qemu_popen_fd(f), NULL, NULL, NULL, NULL);
133
121
 
134
122
err:
135
123
    qemu_fclose(f);
136
 
    return -errno;
 
124
}
 
125
 
 
126
int exec_start_incoming_migration(const char *command)
 
127
{
 
128
    QEMUFile *f;
 
129
 
 
130
    dprintf("Attempting to start an incoming migration\n");
 
131
    f = qemu_popen_cmd(command, "r");
 
132
    if(f == NULL) {
 
133
        dprintf("Unable to apply qemu wrapper to popen file\n");
 
134
        return -errno;
 
135
    }
 
136
 
 
137
    qemu_set_fd_handler2(qemu_popen_fd(f), NULL,
 
138
                         exec_accept_incoming_migration, NULL,
 
139
                         (void *)(unsigned long)f);
 
140
 
 
141
    return 0;
137
142
}