qemu_migration.h 6.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * 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
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 */

#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 38
     VIR_MIGRATE_NON_SHARED_INC |               \
     VIR_MIGRATE_CHANGE_PROTECTION)
39

40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
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)

int qemuMigrationJobStart(struct qemud_driver *driver,
                          virDomainObjPtr vm,
                          enum qemuDomainAsyncJob job)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
void qemuMigrationJobSetPhase(struct qemud_driver *driver,
                              virDomainObjPtr vm,
                              enum qemuMigrationJobPhase phase)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void qemuMigrationJobStartPhase(struct qemud_driver *driver,
                                virDomainObjPtr vm,
                                enum qemuMigrationJobPhase phase)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuMigrationJobContinue(virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
bool qemuMigrationJobIsActive(virDomainObjPtr vm,
                              enum qemuDomainAsyncJob job)
    ATTRIBUTE_NONNULL(1);
int qemuMigrationJobFinish(struct qemud_driver *driver, virDomainObjPtr obj)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

76 77 78 79 80
bool qemuMigrationIsAllowed(virDomainDefPtr def)
    ATTRIBUTE_NONNULL(1);
int qemuMigrationSetOffline(struct qemud_driver *driver,
                            virDomainObjPtr vm);

81 82
char *qemuMigrationBegin(struct qemud_driver *driver,
                         virDomainObjPtr vm,
83
                         const char *xmlin,
84 85 86
                         char **cookieout,
                         int *cookieoutlen);

87 88
int qemuMigrationPrepareTunnel(struct qemud_driver *driver,
                               virConnectPtr dconn,
89 90 91 92
                               const char *cookiein,
                               int cookieinlen,
                               char **cookieout,
                               int *cookieoutlen,
93 94 95 96 97 98
                               virStreamPtr st,
                               const char *dname,
                               const char *dom_xml);

int qemuMigrationPrepareDirect(struct qemud_driver *driver,
                               virConnectPtr dconn,
99 100 101 102
                               const char *cookiein,
                               int cookieinlen,
                               char **cookieout,
                               int *cookieoutlen,
103 104 105 106 107 108 109 110
                               const char *uri_in,
                               char **uri_out,
                               const char *dname,
                               const char *dom_xml);

int qemuMigrationPerform(struct qemud_driver *driver,
                         virConnectPtr conn,
                         virDomainObjPtr vm,
111
                         const char *xmlin,
112
                         const char *dconnuri,
113
                         const char *uri,
114 115 116 117
                         const char *cookiein,
                         int cookieinlen,
                         char **cookieout,
                         int *cookieoutlen,
118 119
                         unsigned long flags,
                         const char *dname,
120
                         unsigned long resource,
121
                         bool v3proto);
122 123 124 125

virDomainPtr qemuMigrationFinish(struct qemud_driver *driver,
                                 virConnectPtr dconn,
                                 virDomainObjPtr vm,
126 127 128 129
                                 const char *cookiein,
                                 int cookieinlen,
                                 char **cookieout,
                                 int *cookieoutlen,
130
                                 unsigned long flags,
131 132
                                 int retcode,
                                 bool v3proto);
133

134 135 136 137 138 139
int qemuMigrationConfirm(struct qemud_driver *driver,
                         virConnectPtr conn,
                         virDomainObjPtr vm,
                         const char *cookiein,
                         int cookieinlen,
                         unsigned int flags,
140
                         int retcode);
141

142

143 144 145
int qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
                        int fd, off_t offset, const char *path,
                        const char *compressor,
E
Eric Blake 已提交
146
                        bool bypassSecurityDriver,
147
                        enum qemuDomainAsyncJob asyncJob)
148
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
149 150
    ATTRIBUTE_RETURN_CHECK;

151
#endif /* __QEMU_MIGRATION_H__ */