|
|
c401cc |
From bdc4fc23246048aa8c740db5b8b2e37521e1278b Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <bdc4fc23246048aa8c740db5b8b2e37521e1278b@dist-git>
|
|
|
c401cc |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
c401cc |
Date: Wed, 26 Feb 2014 14:55:20 +0100
|
|
|
c401cc |
Subject: [PATCH] qemu: snapshot: Forbid snapshots when backing is a scsi
|
|
|
c401cc |
passthrough disk
|
|
|
c401cc |
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=1034993
|
|
|
c401cc |
|
|
|
c401cc |
SCSI passthrough disks (<disk .. device="lun">) can't be used as backing
|
|
|
c401cc |
for snapshots. Currently with upstream qemu the vm crashes on such
|
|
|
c401cc |
attempt.
|
|
|
c401cc |
|
|
|
c401cc |
This patch adds a early check to catch an attempt to do such a snapshot
|
|
|
c401cc |
and rejects it right away. qemu will fix the issue but this will let us
|
|
|
c401cc |
control the error message.
|
|
|
c401cc |
|
|
|
c401cc |
(cherry picked from commit 3d1e9e47794f95b9862a3f75d268380b7b700687)
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
src/qemu/qemu_driver.c | 24 ++++++++++++++++++++++--
|
|
|
c401cc |
1 file changed, 22 insertions(+), 2 deletions(-)
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
c401cc |
index fe55fed..1c9b190 100644
|
|
|
c401cc |
--- a/src/qemu/qemu_driver.c
|
|
|
c401cc |
+++ b/src/qemu/qemu_driver.c
|
|
|
c401cc |
@@ -12141,7 +12141,7 @@ endjob:
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
static int
|
|
|
c401cc |
-qemuDomainSnapshotPrepareDiskExternalBacking(virDomainDiskDefPtr disk)
|
|
|
c401cc |
+qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
|
|
|
c401cc |
{
|
|
|
c401cc |
int actualType = qemuDiskGetActualType(disk);
|
|
|
c401cc |
|
|
|
c401cc |
@@ -12180,6 +12180,23 @@ qemuDomainSnapshotPrepareDiskExternalBacking(virDomainDiskDefPtr disk)
|
|
|
c401cc |
|
|
|
c401cc |
|
|
|
c401cc |
static int
|
|
|
c401cc |
+qemuDomainSnapshotPrepareDiskExternalBackingActive(virDomainDiskDefPtr disk)
|
|
|
c401cc |
+{
|
|
|
c401cc |
+ int actualType = qemuDiskGetActualType(disk);
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (actualType == VIR_DOMAIN_DISK_TYPE_BLOCK &&
|
|
|
c401cc |
+ disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
c401cc |
+ _("external active snapshots are not supported on scsi "
|
|
|
c401cc |
+ "passthrough devices"));
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
+ return 0;
|
|
|
c401cc |
+}
|
|
|
c401cc |
+
|
|
|
c401cc |
+
|
|
|
c401cc |
+static int
|
|
|
c401cc |
qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr disk)
|
|
|
c401cc |
{
|
|
|
c401cc |
int actualType = qemuSnapshotDiskGetActualType(disk);
|
|
|
c401cc |
@@ -12245,12 +12262,15 @@ qemuDomainSnapshotPrepareDiskExternal(virConnectPtr conn,
|
|
|
c401cc |
if (qemuTranslateDiskSourcePool(conn, disk) < 0)
|
|
|
c401cc |
return -1;
|
|
|
c401cc |
|
|
|
c401cc |
- if (qemuDomainSnapshotPrepareDiskExternalBacking(disk) < 0)
|
|
|
c401cc |
+ if (qemuDomainSnapshotPrepareDiskExternalBackingInactive(disk) < 0)
|
|
|
c401cc |
return -1;
|
|
|
c401cc |
|
|
|
c401cc |
if (qemuDomainSnapshotPrepareDiskExternalOverlayInactive(snapdisk) < 0)
|
|
|
c401cc |
return -1;
|
|
|
c401cc |
} else {
|
|
|
c401cc |
+ if (qemuDomainSnapshotPrepareDiskExternalBackingActive(disk) < 0)
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+
|
|
|
c401cc |
if (qemuDomainSnapshotPrepareDiskExternalOverlayActive(snapdisk) < 0)
|
|
|
c401cc |
return -1;
|
|
|
c401cc |
}
|
|
|
c401cc |
--
|
|
|
c401cc |
1.9.0
|
|
|
c401cc |
|