On Wed, Feb 22, 2012 at 14:57:00 +0000, Daniel P. Berrange wrote:
On Wed, Feb 22, 2012 at 03:51:11PM +0100, Jiri Denemark wrote:
> Migrating domains with disks using cache != none is unsafe unless the
> disk images are stored on coherent clustered filesystem. Thus we forbid
> migrating such domains unless VIR_MIGRATE_UNSAFE flags is used.
> ---
> Notes:
> Version 2:
> - use virStorageFileIsClusterFS
>
> src/qemu/qemu_driver.c | 3 ++-
> src/qemu/qemu_migration.c | 39 +++++++++++++++++++++++++++++++++++----
> src/qemu/qemu_migration.h | 6 ++++--
> 3 files changed, 41 insertions(+), 7 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 717bdf1..63a0703 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -8767,7 +8767,8 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
> goto endjob;
>
> if (!(xml = qemuMigrationBegin(driver, vm, xmlin, dname,
> - cookieout, cookieoutlen)))
> + cookieout, cookieoutlen,
> + flags)))
> goto endjob;
>
> if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) {
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index f0af494..09494d6 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -45,6 +45,7 @@
> #include "virtime.h"
> #include "locking/domain_lock.h"
> #include "rpc/virnetsocket.h"
> +#include "storage_file.h"
>
>
> #define VIR_FROM_THIS VIR_FROM_QEMU
> @@ -817,6 +818,29 @@ qemuMigrationIsAllowed(struct qemud_driver *driver,
virDomainObjPtr vm,
> return true;
> }
>
> +static bool
> +qemuMigrationIsSafe(virDomainDefPtr def)
> +{
> + int i;
> +
> + for (i = 0 ; i < def->ndisks ; i++) {
> + virDomainDiskDefPtr disk = def->disks[i];
> +
> + /* shared && !readonly implies cache=none */
> + if (disk->src &&
> + disk->cachemode != VIR_DOMAIN_DISK_CACHE_DISABLE &&
> + (disk->cachemode || !disk->shared || disk->readonly)
&&
> + virStorageFileIsClusterFS(disk->src) == 1) {
Isn't this test reversed. ie, we want to deny migration if *not* a
cluster FS, eg == 0 surely ?
Eh, sure. Thanks.
Jirka