diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 07669ded44687cdaf63a118049834676bfee11de..5b803f106b66e3bba774b2254516eba3badfc7a6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2089,7 +2089,8 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd, g_autofree char *copyOnReadPropsStr = NULL; size_t i; - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) && + !qemuDiskBusIsSD(disk->bus)) { if (virStorageSourceIsEmpty(disk->src)) return 0; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bbc292d0a1a2e3bb208d69bedee726b36dd4ee63..b6806f017bfaf5361601a434afaea37a5e4065bd 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8212,6 +8212,8 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, virStorageSourcePtr src; /* iterator for the backing chain declared in XML */ virStorageSourcePtr n; /* iterator for the backing chain detected from disk */ qemuDomainObjPrivatePtr priv = vm->privateData; + bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); + bool isSD = qemuDiskBusIsSD(disk->bus); uid_t uid; gid_t gid; @@ -8294,13 +8296,14 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, if (n->format == VIR_STORAGE_FILE_ISO) n->format = VIR_STORAGE_FILE_RAW; - if (qemuDomainValidateStorageSource(n, priv->qemuCaps, false) < 0) + /* mask-out blockdev for 'sd' disks */ + if (qemuDomainValidateStorageSource(n, priv->qemuCaps, isSD) < 0) return -1; qemuDomainPrepareStorageSourceConfig(n, cfg, priv->qemuCaps); qemuDomainPrepareDiskSourceData(disk, n); - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + if (blockdev && !isSD && qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0) return -1; } @@ -8358,7 +8361,8 @@ qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk, { *backendAlias = NULL; - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) || + qemuDiskBusIsSD(disk->bus)) { if (!(*backendAlias = qemuAliasDiskDriveFromDisk(disk))) return -1; @@ -13234,7 +13238,8 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, disk->src->format = VIR_STORAGE_FILE_RAW; } - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + !qemuDiskBusIsSD(disk->bus)) { if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0) return -1; } else { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1617f79d34a6b07233c98fdf0996f327a92c4204..63b4a49c3c6ea32030500b253fd04c994d577670 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10808,7 +10808,8 @@ qemuDomainBlockResize(virDomainPtr dom, disk->src->format == VIR_STORAGE_FILE_QED) size = VIR_ROUND_UP(size, 512); - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) && + !qemuDiskBusIsSD(disk->bus)) { if (virStorageSourceIsEmpty(disk->src) || disk->src->readonly) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("can't resize empty or readonly disk '%s'"), diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f1b2fbb1a86199519a82acadf8c59ab89999ca81..ab5a7aef84dbcc9bde072273c5c5bb1686633fe5 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4270,7 +4270,8 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, disk->info.alias, vm, vm->def->name); - if (blockdev) { + if (blockdev && + !qemuDiskBusIsSD(disk->bus)) { corAlias = g_strdup(diskPriv->nodeCopyOnRead); if (diskPriv->blockjob) { diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index fe2ac2dcfe4d61aca6cf507c1d12ef2063a13ddf..b1751d4b52743481c08f29e93ab432d00cdd5b66 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6405,7 +6405,7 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driver, continue; /* backing chain needs to be redetected if we aren't using blockdev */ - if (!blockdev) + if (!blockdev || qemuDiskBusIsSD(disk->bus)) virStorageSourceBackingStoreClear(disk->src); /* @@ -6634,6 +6634,10 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriverPtr driver, virDomainDiskDefPtr disk = vm->def->disks[i]; qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk); + /* sd-cards are instantiated via -drive */ + if (qemuDiskBusIsSD(disk->bus)) + continue; + if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) continue; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f49181b639674d0c00535a7cfab9736f72ed0df0..2cde678ca0631f514b9915b83d87bc57828faff1 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2259,6 +2259,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, virQEMUCapsPtr qemuCaps) { const char *driverName = virDomainDiskGetDriver(disk); + bool isSD = qemuDiskBusIsSD(disk->bus); virStorageSourcePtr n; int idx; int partition; @@ -2298,7 +2299,8 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk, } for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) { - if (qemuDomainValidateStorageSource(n, qemuCaps, false) < 0) + /* blockdev support is masked out for 'sd' disks */ + if (qemuDomainValidateStorageSource(n, qemuCaps, isSD) < 0) return -1; }