https://bugzilla.redhat.com/show_bug.cgi?id=1034993
SCSI passthrough disks (<disk .. device="lun">) can't be used as
backing
for snapshots. Currently with upstream qemu the vm crashes on such
attempt.
This patch adds a early check to catch an attempt to do such a snapshot
and rejects it right away. qemu will fix the issue but this will let us
control the error message.
---
Notes:
You need a domain with a similar disk config to test this patch:
<disk type='block' device='lun'>
<driver name='qemu' type='raw'/>
<source
dev='/dev/disk/by-path/ip-192.168.122.223:3260-iscsi-iqn.2011-03.org.example.istgt:test-lun-0'/>
<target dev='sda' bus='scsi'/>
<address type='drive' controller='0' bus='0'
target='0' unit='0'/>
</disk>
<controller type='scsi' index='0'
model='virtio-scsi'>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x07' function='0x0'/>
</controller>
src/qemu/qemu_driver.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b101d77..bc29714 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12206,7 +12206,7 @@ endjob:
}
static int
-qemuDomainSnapshotPrepareDiskExternalBacking(virDomainDiskDefPtr disk)
+qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
{
int actualType = qemuDiskGetActualType(disk);
@@ -12250,6 +12250,23 @@ qemuDomainSnapshotPrepareDiskExternalBacking(virDomainDiskDefPtr
disk)
static int
+qemuDomainSnapshotPrepareDiskExternalBackingActive(virDomainDiskDefPtr disk)
+{
+ int actualType = qemuDiskGetActualType(disk);
+
+ if (actualType == VIR_DOMAIN_DISK_TYPE_BLOCK &&
+ disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("external active snapshots are not supported on scsi
"
+ "passthrough devices"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
+static int
qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr disk)
{
int actualType = qemuSnapshotDiskGetActualType(disk);
@@ -12315,12 +12332,15 @@ qemuDomainSnapshotPrepareDiskExternal(virConnectPtr conn,
if (qemuTranslateDiskSourcePool(conn, disk) < 0)
return -1;
- if (qemuDomainSnapshotPrepareDiskExternalBacking(disk) < 0)
+ if (qemuDomainSnapshotPrepareDiskExternalBackingInactive(disk) < 0)
return -1;
if (qemuDomainSnapshotPrepareDiskExternalOverlayInactive(snapdisk) < 0)
return -1;
} else {
+ if (qemuDomainSnapshotPrepareDiskExternalBackingActive(disk) < 0)
+ return -1;
+
if (qemuDomainSnapshotPrepareDiskExternalOverlayActive(snapdisk) < 0)
return -1;
}
--
1.8.5.3