On Wed, Sep 24, 2014 at 15:06:57 +0200, Jiri Denemark wrote:
On Tue, Sep 23, 2014 at 16:09:59 +0200, Cristian Klein wrote:
> Signed-off-by: Cristian Klein <cristian.klein(a)cs.umu.se>
> ---
> src/qemu/qemu_driver.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> src/qemu/qemu_monitor.c | 19 +++++++++++++++++++
> src/qemu/qemu_monitor.h | 2 ++
> src/qemu/qemu_monitor_json.c | 18 ++++++++++++++++++
> src/qemu/qemu_monitor_json.h | 1 +
> src/qemu/qemu_monitor_text.c | 11 +++++++++++
> src/qemu/qemu_monitor_text.h | 2 ++
No need to touch qemu_monitor_text.[ch] since we will only use QMP with
any QEMU that supports post-copy migration.
> 7 files changed, 97 insertions(+)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index e73d4f9..02c9a3b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -11861,6 +11861,49 @@ qemuDomainGetJobStats(virDomainPtr dom,
> }
>
>
> +static int qemuMigrateStartPostCopy(virDomainPtr dom)
> +{
> + virQEMUDriverPtr driver = dom->conn->privateData;
> + virDomainObjPtr vm;
> + int ret = -1;
> + qemuDomainObjPrivatePtr priv;
> +
> + if (!(vm = qemuDomObjFromDomain(dom)))
> + goto cleanup;
> +
> + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
> + goto cleanup;
> +
> + if (!virDomainObjIsActive(vm)) {
> + virReportError(VIR_ERR_OPERATION_INVALID,
> + "%s", _("domain is not running"));
> + goto endjob;
> + }
> +
> + priv = vm->privateData;
> +
> + if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) {
> + virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> + _("post-copy can only be started "
> + "while migration is in progress"));
We forbid the use of tabs for indentation. Please, run make syntax-check
(in addition to make check) before sending patches to catch this type of
issues.
> + goto cleanup;
> + }
> +
> + VIR_DEBUG("Starting post-copy");
> + qemuDomainObjEnterMonitor(driver, vm);
> + ret = qemuMonitorMigrateStartPostCopy(priv->mon);
> + qemuDomainObjExitMonitor(driver, vm);
> +
> + endjob:
> + if (!qemuDomainObjEndJob(driver, vm))
> + vm = NULL;
> +
> + cleanup:
> + if (vm)
> + virObjectUnlock(vm);
> + return ret;
> +}
> +
> static int qemuDomainAbortJob(virDomainPtr dom)
> {
> virQEMUDriverPtr driver = dom->conn->privateData;
> @@ -18259,6 +18302,7 @@ static virDriver qemuDriver = {
> .nodeGetFreePages = qemuNodeGetFreePages, /* 1.2.6 */
> .connectGetDomainCapabilities = qemuConnectGetDomainCapabilities, /* 1.2.7 */
> .connectGetAllDomainStats = qemuConnectGetAllDomainStats, /* 1.2.8 */
> + .domainMigrateStartPostCopy = qemuMigrateStartPostCopy, /* 1.2.9 */
This will need to be updated.
and renamed as qemuDomainMigrateStartPostCopy.
Jirka