cryptospore / rpms / qemu-kvm

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