qemu_migration.h 6.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * qemu_migration.h: QEMU migration handling
 *
 * Copyright (C) 2006-2011 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library.  If not, see
O
Osier Yang 已提交
18
 * <http://www.gnu.org/licenses/>.
19 20 21 22 23 24 25
 *
 */

#ifndef __QEMU_MIGRATION_H__
# define __QEMU_MIGRATION_H__

# include "qemu_conf.h"
26
# include "qemu_domain.h"
27

28 29 30 31 32 33 34 35 36
/* All supported qemu migration flags.  */
# define QEMU_MIGRATION_FLAGS                   \
    (VIR_MIGRATE_LIVE |                         \
     VIR_MIGRATE_PEER2PEER |                    \
     VIR_MIGRATE_TUNNELLED |                    \
     VIR_MIGRATE_PERSIST_DEST |                 \
     VIR_MIGRATE_UNDEFINE_SOURCE |              \
     VIR_MIGRATE_PAUSED |                       \
     VIR_MIGRATE_NON_SHARED_DISK |              \
37
     VIR_MIGRATE_NON_SHARED_INC |               \
38
     VIR_MIGRATE_CHANGE_PROTECTION |            \
L
liguang 已提交
39 40
     VIR_MIGRATE_UNSAFE |                       \
     VIR_MIGRATE_OFFLINE)
41

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
enum qemuMigrationJobPhase {
    QEMU_MIGRATION_PHASE_NONE = 0,
    QEMU_MIGRATION_PHASE_PERFORM2,
    QEMU_MIGRATION_PHASE_BEGIN3,
    QEMU_MIGRATION_PHASE_PERFORM3,
    QEMU_MIGRATION_PHASE_PERFORM3_DONE,
    QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED,
    QEMU_MIGRATION_PHASE_CONFIRM3,
    QEMU_MIGRATION_PHASE_PREPARE,
    QEMU_MIGRATION_PHASE_FINISH2,
    QEMU_MIGRATION_PHASE_FINISH3,

    QEMU_MIGRATION_PHASE_LAST
};
VIR_ENUM_DECL(qemuMigrationJobPhase)

58
int qemuMigrationJobStart(virQEMUDriverPtr driver,
59 60 61
                          virDomainObjPtr vm,
                          enum qemuDomainAsyncJob job)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
62
void qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
63 64 65
                              virDomainObjPtr vm,
                              enum qemuMigrationJobPhase phase)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
66
void qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
67 68 69
                                virDomainObjPtr vm,
                                enum qemuMigrationJobPhase phase)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
70
bool qemuMigrationJobContinue(virDomainObjPtr obj)
71 72 73 74
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
bool qemuMigrationJobIsActive(virDomainObjPtr vm,
                              enum qemuDomainAsyncJob job)
    ATTRIBUTE_NONNULL(1);
75
bool qemuMigrationJobFinish(virQEMUDriverPtr driver, virDomainObjPtr obj)
76 77
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

78
int qemuMigrationSetOffline(virQEMUDriverPtr driver,
79 80
                            virDomainObjPtr vm);

81
virDomainObjPtr qemuMigrationCleanup(virQEMUDriverPtr driver,
82 83 84
                                     virDomainObjPtr vm,
                                     virConnectPtr conn);

85
char *qemuMigrationBegin(virQEMUDriverPtr driver,
86
                         virDomainObjPtr vm,
87
                         const char *xmlin,
88
                         const char *dname,
89
                         char **cookieout,
90 91
                         int *cookieoutlen,
                         unsigned long flags);
92

93
int qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
94
                               virConnectPtr dconn,
95 96 97 98
                               const char *cookiein,
                               int cookieinlen,
                               char **cookieout,
                               int *cookieoutlen,
99 100
                               virStreamPtr st,
                               const char *dname,
L
liguang 已提交
101 102
                               const char *dom_xml,
                               unsigned long flags);
103

104
int qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
105
                               virConnectPtr dconn,
106 107 108 109
                               const char *cookiein,
                               int cookieinlen,
                               char **cookieout,
                               int *cookieoutlen,
110 111 112
                               const char *uri_in,
                               char **uri_out,
                               const char *dname,
L
liguang 已提交
113 114
                               const char *dom_xml,
                               unsigned long flags);
115

116
int qemuMigrationPerform(virQEMUDriverPtr driver,
117 118
                         virConnectPtr conn,
                         virDomainObjPtr vm,
119
                         const char *xmlin,
120
                         const char *dconnuri,
121
                         const char *uri,
122 123 124 125
                         const char *cookiein,
                         int cookieinlen,
                         char **cookieout,
                         int *cookieoutlen,
126 127
                         unsigned long flags,
                         const char *dname,
128
                         unsigned long resource,
129
                         bool v3proto);
130

131
virDomainPtr qemuMigrationFinish(virQEMUDriverPtr driver,
132 133
                                 virConnectPtr dconn,
                                 virDomainObjPtr vm,
134 135 136 137
                                 const char *cookiein,
                                 int cookieinlen,
                                 char **cookieout,
                                 int *cookieoutlen,
138
                                 unsigned long flags,
139 140
                                 int retcode,
                                 bool v3proto);
141

142
int qemuMigrationConfirm(virQEMUDriverPtr driver,
143 144 145 146 147
                         virConnectPtr conn,
                         virDomainObjPtr vm,
                         const char *cookiein,
                         int cookieinlen,
                         unsigned int flags,
148
                         int retcode);
149

150

151
int qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
152 153
                        int fd, off_t offset, const char *path,
                        const char *compressor,
E
Eric Blake 已提交
154
                        bool bypassSecurityDriver,
155
                        enum qemuDomainAsyncJob asyncJob)
156
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
157 158
    ATTRIBUTE_RETURN_CHECK;

159
#endif /* __QEMU_MIGRATION_H__ */