2011-01-31 10:47:03 +00:00
|
|
|
/*
|
|
|
|
* 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"
|
2011-07-19 00:27:30 +00:00
|
|
|
# include "qemu_domain.h"
|
2011-01-31 10:47:03 +00:00
|
|
|
|
2011-07-14 21:46:49 +00:00
|
|
|
/* 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 | \
|
2011-07-19 00:27:32 +00:00
|
|
|
VIR_MIGRATE_NON_SHARED_INC | \
|
2012-02-21 12:20:06 +00:00
|
|
|
VIR_MIGRATE_CHANGE_PROTECTION | \
|
|
|
|
VIR_MIGRATE_UNSAFE)
|
2011-01-31 10:47:03 +00:00
|
|
|
|
2011-07-19 00:27:30 +00:00
|
|
|
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;
|
|
|
|
|
2011-01-31 10:47:03 +00:00
|
|
|
int qemuMigrationSetOffline(struct qemud_driver *driver,
|
|
|
|
virDomainObjPtr vm);
|
|
|
|
|
2012-03-19 15:48:43 +00:00
|
|
|
virDomainObjPtr qemuMigrationCleanup(struct qemud_driver *driver,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
virConnectPtr conn);
|
|
|
|
|
2011-02-03 11:09:28 +00:00
|
|
|
char *qemuMigrationBegin(struct qemud_driver *driver,
|
|
|
|
virDomainObjPtr vm,
|
2011-05-18 09:26:30 +00:00
|
|
|
const char *xmlin,
|
2011-10-14 19:24:18 +00:00
|
|
|
const char *dname,
|
2011-02-03 11:09:28 +00:00
|
|
|
char **cookieout,
|
2012-02-21 12:20:06 +00:00
|
|
|
int *cookieoutlen,
|
|
|
|
unsigned long flags);
|
2011-02-03 11:09:28 +00:00
|
|
|
|
2011-01-31 10:47:03 +00:00
|
|
|
int qemuMigrationPrepareTunnel(struct qemud_driver *driver,
|
|
|
|
virConnectPtr dconn,
|
2011-01-24 18:06:16 +00:00
|
|
|
const char *cookiein,
|
|
|
|
int cookieinlen,
|
|
|
|
char **cookieout,
|
|
|
|
int *cookieoutlen,
|
2011-01-31 10:47:03 +00:00
|
|
|
virStreamPtr st,
|
|
|
|
const char *dname,
|
|
|
|
const char *dom_xml);
|
|
|
|
|
|
|
|
int qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
|
|
|
virConnectPtr dconn,
|
2011-01-24 18:06:16 +00:00
|
|
|
const char *cookiein,
|
|
|
|
int cookieinlen,
|
|
|
|
char **cookieout,
|
|
|
|
int *cookieoutlen,
|
2011-01-31 10:47:03 +00:00
|
|
|
const char *uri_in,
|
|
|
|
char **uri_out,
|
|
|
|
const char *dname,
|
|
|
|
const char *dom_xml);
|
|
|
|
|
|
|
|
int qemuMigrationPerform(struct qemud_driver *driver,
|
|
|
|
virConnectPtr conn,
|
|
|
|
virDomainObjPtr vm,
|
2011-05-18 09:26:30 +00:00
|
|
|
const char *xmlin,
|
Add a second URI parameter to virDomainMigratePerform3 method
The virDomainMigratePerform3 currently has a single URI parameter
whose meaning varies. It is either
- A QEMU migration URI (normal migration)
- A libvirtd connection URI (peer2peer migration)
Unfortunately when using peer2peer migration, without also
using tunnelled migration, it is possible that both URIs are
required.
This adds a second URI parameter to the virDomainMigratePerform3
method, to cope with this scenario. Each parameter how has a fixed
meaning.
NB, there is no way to actually take advantage of this yet,
since virDomainMigrate/virDomainMigrateToURI do not have any
way to provide the 2 separate URIs
* daemon/remote.c, src/remote/remote_driver.c,
src/remote/remote_protocol.x, src/remote_protocol-structs: Add
the second URI parameter to perform3 message
* src/driver.h, src/libvirt.c, src/libvirt_internal.h: Add
the second URI parameter to Perform3 method
* src/libvirt_internal.h, src/qemu/qemu_migration.c,
src/qemu/qemu_migration.h: Update to handle URIs correctly
2011-05-18 13:18:53 +00:00
|
|
|
const char *dconnuri,
|
2011-01-31 10:47:03 +00:00
|
|
|
const char *uri,
|
2011-01-24 18:06:16 +00:00
|
|
|
const char *cookiein,
|
|
|
|
int cookieinlen,
|
|
|
|
char **cookieout,
|
|
|
|
int *cookieoutlen,
|
2011-01-31 10:47:03 +00:00
|
|
|
unsigned long flags,
|
|
|
|
const char *dname,
|
2011-02-03 11:09:28 +00:00
|
|
|
unsigned long resource,
|
2011-05-23 12:50:11 +00:00
|
|
|
bool v3proto);
|
2011-01-31 10:47:03 +00:00
|
|
|
|
|
|
|
virDomainPtr qemuMigrationFinish(struct qemud_driver *driver,
|
|
|
|
virConnectPtr dconn,
|
|
|
|
virDomainObjPtr vm,
|
2011-01-24 18:06:16 +00:00
|
|
|
const char *cookiein,
|
|
|
|
int cookieinlen,
|
|
|
|
char **cookieout,
|
|
|
|
int *cookieoutlen,
|
2011-01-31 10:47:03 +00:00
|
|
|
unsigned long flags,
|
2011-05-23 12:50:11 +00:00
|
|
|
int retcode,
|
|
|
|
bool v3proto);
|
2011-01-31 10:47:03 +00:00
|
|
|
|
2011-02-03 11:09:28 +00:00
|
|
|
int qemuMigrationConfirm(struct qemud_driver *driver,
|
|
|
|
virConnectPtr conn,
|
|
|
|
virDomainObjPtr vm,
|
|
|
|
const char *cookiein,
|
|
|
|
int cookieinlen,
|
|
|
|
unsigned int flags,
|
2011-05-19 11:48:15 +00:00
|
|
|
int retcode);
|
2011-02-03 11:09:28 +00:00
|
|
|
|
2011-01-31 10:47:03 +00:00
|
|
|
|
2011-03-10 00:35:13 +00:00
|
|
|
int qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
|
|
|
|
int fd, off_t offset, const char *path,
|
|
|
|
const char *compressor,
|
2011-08-23 20:01:51 +00:00
|
|
|
bool bypassSecurityDriver,
|
qemu: fix crash when mixing sync and async monitor jobs
Currently, we attempt to run sync job and async job at the same time. It
means that the monitor commands for two jobs can be run in any order.
In the function qemuDomainObjEnterMonitorInternal():
if (priv->job.active == QEMU_JOB_NONE && priv->job.asyncJob) {
if (qemuDomainObjBeginNestedJob(driver, obj) < 0)
We check whether the caller is an async job by priv->job.active and
priv->job.asynJob. But when an async job is running, and a sync job is
also running at the time of the check, then priv->job.active is not
QEMU_JOB_NONE. So we cannot check whether the caller is an async job
in the function qemuDomainObjEnterMonitorInternal(), and must instead
put the burden on the caller to tell us when an async command wants
to do a nested job.
Once the burden is on the caller, then only async monitor enters need
to worry about whether the VM is still running; for sync monitor enter,
the internal return is always 0, so lots of ignore_value can be dropped.
* src/qemu/THREADS.txt: Reflect new rules.
* src/qemu/qemu_domain.h (qemuDomainObjEnterMonitorAsync): New
prototype.
* src/qemu/qemu_process.h (qemuProcessStartCPUs)
(qemuProcessStopCPUs): Add parameter.
* src/qemu/qemu_migration.h (qemuMigrationToFile): Likewise.
(qemuMigrationWaitForCompletion): Make static.
* src/qemu/qemu_domain.c (qemuDomainObjEnterMonitorInternal): Add
parameter.
(qemuDomainObjEnterMonitorAsync): New function.
(qemuDomainObjEnterMonitor, qemuDomainObjEnterMonitorWithDriver):
Update callers.
* src/qemu/qemu_driver.c (qemuDomainSaveInternal)
(qemudDomainCoreDump, doCoreDump, processWatchdogEvent)
(qemudDomainSuspend, qemudDomainResume, qemuDomainSaveImageStartVM)
(qemuDomainSnapshotCreateActive, qemuDomainRevertToSnapshot):
Likewise.
* src/qemu/qemu_process.c (qemuProcessStopCPUs)
(qemuProcessFakeReboot, qemuProcessRecoverMigration)
(qemuProcessRecoverJob, qemuProcessStart): Likewise.
* src/qemu/qemu_migration.c (qemuMigrationToFile)
(qemuMigrationWaitForCompletion, qemuMigrationUpdateJobStatus)
(qemuMigrationJobStart, qemuDomainMigrateGraphicsRelocate)
(doNativeMigrate, doTunnelMigrate, qemuMigrationPerformJob)
(qemuMigrationPerformPhase, qemuMigrationFinish)
(qemuMigrationConfirm): Likewise.
* src/qemu/qemu_hotplug.c: Drop unneeded ignore_value.
2011-07-28 23:18:24 +00:00
|
|
|
enum qemuDomainAsyncJob asyncJob)
|
2011-05-05 10:30:26 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
|
2011-03-10 00:35:13 +00:00
|
|
|
ATTRIBUTE_RETURN_CHECK;
|
|
|
|
|
2011-01-31 10:47:03 +00:00
|
|
|
#endif /* __QEMU_MIGRATION_H__ */
|