[PATCH 14/20] qemuDomainValidateStorageSource: Allow masking out blockdev support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case of 'sd' cards we'll use pre-blockdev code also if qemu supports
blockdev. In that specific case we'll need to mask out blockdev support
for 'sd' disks. Plumb in a boolean to allow it.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c   | 12 ++++++++----
 src/qemu/qemu_domain.h   |  3 ++-
 src/qemu/qemu_validate.c |  2 +-
 tests/qemublocktest.c    |  4 ++--
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e76a76021e..01f2792401 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5137,11 +5137,15 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net,

 int
 qemuDomainValidateStorageSource(virStorageSourcePtr src,
-                                virQEMUCapsPtr qemuCaps)
+                                virQEMUCapsPtr qemuCaps,
+                                bool maskBlockdev)
 {
     int actualType = virStorageSourceGetActualType(src);
     bool blockdev = virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV);

+    if (maskBlockdev)
+        blockdev = false;
+
     if (src->format == VIR_STORAGE_FILE_COW) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                       _("'cow' storage format is not supported"));
@@ -8294,7 +8298,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
         if (n->format == VIR_STORAGE_FILE_ISO)
             n->format = VIR_STORAGE_FILE_RAW;

-        if (qemuDomainValidateStorageSource(n, priv->qemuCaps) < 0)
+        if (qemuDomainValidateStorageSource(n, priv->qemuCaps, false) < 0)
             return -1;

         qemuDomainPrepareStorageSourceConfig(n, cfg, priv->qemuCaps);
@@ -13137,7 +13141,7 @@ qemuDomainPrepareDiskSourceLegacy(virDomainDiskDefPtr disk,
                                   qemuDomainObjPrivatePtr priv,
                                   virQEMUDriverConfigPtr cfg)
 {
-    if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0)
+    if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps, true) < 0)
         return -1;

     qemuDomainPrepareStorageSourceConfig(disk->src, cfg, priv->qemuCaps);
@@ -13173,7 +13177,7 @@ qemuDomainPrepareStorageSourceBlockdev(virDomainDiskDefPtr disk,
     if (qemuBlockStorageSourceNeedsStorageSliceLayer(src))
         src->sliceStorage->nodename = g_strdup_printf("libvirt-%u-slice-sto", src->id);

-    if (qemuDomainValidateStorageSource(src, priv->qemuCaps) < 0)
+    if (qemuDomainValidateStorageSource(src, priv->qemuCaps, false) < 0)
         return -1;

     qemuDomainPrepareStorageSourceConfig(src, cfg, priv->qemuCaps);
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 639d27d8a5..ea0fce64a8 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1237,7 +1237,8 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,

 int
 qemuDomainValidateStorageSource(virStorageSourcePtr src,
-                                virQEMUCapsPtr qemuCaps);
+                                virQEMUCapsPtr qemuCaps,
+                                bool maskBlockdev);


 int
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 63cde01762..a7c918e5fd 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2297,7 +2297,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDef *disk,
     }

     for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
-        if (qemuDomainValidateStorageSource(n, qemuCaps) < 0)
+        if (qemuDomainValidateStorageSource(n, qemuCaps, false) < 0)
             return -1;
     }

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index b80ee2ae6c..82c11311e2 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -294,7 +294,7 @@ testQemuDiskXMLToProps(const void *opaque)
         if (testQemuDiskXMLToJSONFakeSecrets(n) < 0)
             return -1;

-        if (qemuDomainValidateStorageSource(n, data->qemuCaps) < 0)
+        if (qemuDomainValidateStorageSource(n, data->qemuCaps, false) < 0)
             return -1;

         qemuDomainPrepareDiskSourceData(disk, n);
@@ -529,7 +529,7 @@ testQemuImageCreate(const void *opaque)
     src->capacity = UINT_MAX * 2ULL;
     src->physical = UINT_MAX + 1ULL;

-    if (qemuDomainValidateStorageSource(src, data->qemuCaps) < 0)
+    if (qemuDomainValidateStorageSource(src, data->qemuCaps, false) < 0)
         return -1;

     if (qemuBlockStorageSourceCreateGetStorageProps(src, &protocolprops) < 0)
-- 
2.26.2





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux