cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 7ac8b98c5873a6c69a73a2a1c03518137024efb8 Mon Sep 17 00:00:00 2001
9ae3a8
From: Jeffrey Cody <jcody@redhat.com>
9ae3a8
Date: Wed, 6 Nov 2013 19:01:09 +0100
9ae3a8
Subject: [PATCH 79/81] block: vhdx - add migration blocker
9ae3a8
9ae3a8
RH-Author: Jeffrey Cody <jcody@redhat.com>
9ae3a8
Message-id: <92e2ff0b02d3cfe596589be909331fd83e66667b.1383763969.git.jcody@redhat.com>
9ae3a8
Patchwork-id: 55578
9ae3a8
O-Subject: [RHEL7 qemu-kvm PATCH 1/3] block: vhdx - add migration blocker
9ae3a8
Bugzilla: 1007176
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
This blocks migration for VHDX image files, until the
9ae3a8
functionality can be supported.
9ae3a8
9ae3a8
Signed-off-by: Jeff Cody <jcody@redhat.com>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 5641bf405608cc89578fafed8ec689a19046285a)
9ae3a8
---
9ae3a8
 block/vhdx.c | 10 ++++++++++
9ae3a8
 1 file changed, 10 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/vhdx.c |   10 ++++++++++
9ae3a8
 1 files changed, 10 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/vhdx.c b/block/vhdx.c
9ae3a8
index e9704b1..11d923f 100644
9ae3a8
--- a/block/vhdx.c
9ae3a8
+++ b/block/vhdx.c
9ae3a8
@@ -20,6 +20,7 @@
9ae3a8
 #include "qemu/module.h"
9ae3a8
 #include "qemu/crc32c.h"
9ae3a8
 #include "block/vhdx.h"
9ae3a8
+#include "migration/migration.h"
9ae3a8
 
9ae3a8
 
9ae3a8
 /* Several metadata and region table data entries are identified by
9ae3a8
@@ -159,6 +160,7 @@ typedef struct BDRVVHDXState {
9ae3a8
     VHDXParentLocatorHeader parent_header;
9ae3a8
     VHDXParentLocatorEntry *parent_entries;
9ae3a8
 
9ae3a8
+    Error *migration_blocker;
9ae3a8
 } BDRVVHDXState;
9ae3a8
 
9ae3a8
 uint32_t vhdx_checksum_calc(uint32_t crc, uint8_t *buf, size_t size,
9ae3a8
@@ -805,6 +807,12 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags)
9ae3a8
 
9ae3a8
     /* TODO: differencing files, write */
9ae3a8
 
9ae3a8
+    /* Disable migration when VHDX images are used */
9ae3a8
+    error_set(&s->migration_blocker,
9ae3a8
+            QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
9ae3a8
+            "vhdx", bs->device_name, "live migration");
9ae3a8
+    migrate_add_blocker(s->migration_blocker);
9ae3a8
+
9ae3a8
     return 0;
9ae3a8
 fail:
9ae3a8
     qemu_vfree(s->headers[0]);
9ae3a8
@@ -951,6 +959,8 @@ static void vhdx_close(BlockDriverState *bs)
9ae3a8
     qemu_vfree(s->headers[1]);
9ae3a8
     qemu_vfree(s->bat);
9ae3a8
     qemu_vfree(s->parent_entries);
9ae3a8
+    migrate_del_blocker(s->migration_blocker);
9ae3a8
+    error_free(s->migration_blocker);
9ae3a8
 }
9ae3a8
 
9ae3a8
 static BlockDriver bdrv_vhdx = {
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8