On Wed, Sep 24, 2014 at 14:45:02 +0200, Jiri Denemark wrote:
On Tue, Sep 23, 2014 at 16:09:58 +0200, Cristian Klein wrote:
> The user first start migration using the `VIR_MIGRATE_POSTCOPY` flag,
> then calls `virDomainMigrateStartPostCopy` asynchronously to switch from
> pre-copy to post-copy.
>
> Signed-off-by: Cristian Klein <cristian.klein(a)cs.umu.se>
> ---
> include/libvirt/libvirt.h.in | 2 ++
> src/driver.h | 4 ++++
> src/libvirt.c | 37 +++++++++++++++++++++++++++++++++++++
> src/libvirt_public.syms | 5 +++++
> 4 files changed, 48 insertions(+)
>
> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
> index bdc33c6..eabedfa 100644
> --- a/include/libvirt/libvirt.h.in
> +++ b/include/libvirt/libvirt.h.in
> @@ -1346,6 +1346,8 @@ int virDomainMigrateToURI3(virDomainPtr domain,
> unsigned int nparams,
> unsigned int flags);
>
> +int virDomainMigrateStartPostCopy (virDomainPtr domain);
> +
> int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
> unsigned long long downtime,
> unsigned int flags);
> diff --git a/src/driver.h b/src/driver.h
> index bb748c4..6866ccd 100644
> --- a/src/driver.h
> +++ b/src/driver.h
> @@ -1212,6 +1212,9 @@ typedef int
> virDomainStatsRecordPtr **retStats,
> unsigned int flags);
>
> +typedef int
> +(*virDrvDomainMigrateStartPostCopy)(virDomainPtr domain);
> +
> typedef struct _virDriver virDriver;
> typedef virDriver *virDriverPtr;
>
> @@ -1435,6 +1438,7 @@ struct _virDriver {
> virDrvNodeGetFreePages nodeGetFreePages;
> virDrvConnectGetDomainCapabilities connectGetDomainCapabilities;
> virDrvConnectGetAllDomainStats connectGetAllDomainStats;
> + virDrvDomainMigrateStartPostCopy domainMigrateStartPostCopy;
> };
>
>
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 33aeafa..e685da2 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -17803,6 +17803,43 @@ virDomainMigrateSetCompressionCache(virDomainPtr domain,
>
>
> /**
> + * virDomainMigrateStartPostCopy:
> + * @domain: a domain object
> + *
> + * Starts post-copy migration. This function has to be called while
> + * migration (initially pre-copy) is in progress. The migration operation
> + * must be called with the VIR_MIGRATE_POSTCOPY flag.
> + *
> + * Returns 0 in case of success, -1 otherwise.
> + */
> +int
> +virDomainMigrateStartPostCopy(virDomainPtr domain)
Oops, I forgot to mention we should add unsigned int flags parameter for
this API just in case we need it in the future.
Jirka