[PATCH 21/22] qemuBlockStorageSourceGetBackendProps: Remove unused logic for (auto-)read-only flags

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

 



The code was refactored to format the 'read-only' and 'auto-read-only'
flags via the common helper, so the logic determining their values can
be removed.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c | 36 +++---------------------------------
 1 file changed, 3 insertions(+), 33 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 5c8d107257..a625e72a5d 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -806,9 +806,7 @@ qemuBlockStorageSourceGetSshProps(virStorageSource *src)

 static virJSONValue *
 qemuBlockStorageSourceGetFileProps(virStorageSource *src,
-                                   bool onlytarget,
-                                   virTristateBool *autoReadOnly,
-                                   virTristateBool *readOnly)
+                                   bool onlytarget)
 {
     const char *path = src->path;
     const char *iomode = NULL;
@@ -824,25 +822,8 @@ qemuBlockStorageSourceGetFileProps(virStorageSource *src,
         if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
             iomode = virDomainDiskIoTypeToString(src->iomode);

-        if (srcpriv && srcpriv->fdpass) {
+        if (srcpriv && srcpriv->fdpass)
             path = qemuFDPassGetPath(srcpriv->fdpass);
-
-            /* when passing a FD to qemu via the /dev/fdset mechanism qemu
-             * fetches the appropriate FD from the fdset by checking that it has
-             * the correct accessmode. Now with 'auto-read-only' in effect qemu
-             * wants to use a read-only FD first. If the user didn't pass multiple
-             * FDs the feature will not work regardless, so we'll disable it. */
-            if (src->fdtuple->nfds == 1) {
-                *autoReadOnly = VIR_TRISTATE_BOOL_ABSENT;
-
-                /* now we setup the normal readonly flag. If user requested write
-                 * access honour it */
-                if (src->fdtuple->writable)
-                    *readOnly = VIR_TRISTATE_BOOL_NO;
-                else
-                    *readOnly = virTristateBoolFromBool(src->readonly);
-            }
-        }
     }

     ignore_value(virJSONValueObjectAdd(&ret,
@@ -1043,20 +1024,9 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src,
     virStorageType actualType = virStorageSourceGetActualType(src);
     g_autoptr(virJSONValue) fileprops = NULL;
     const char *driver = NULL;
-    virTristateBool aro = VIR_TRISTATE_BOOL_ABSENT;
-    virTristateBool ro = VIR_TRISTATE_BOOL_ABSENT;
     bool onlytarget = flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY;
     bool legacy = flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY;

-    if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY) {
-        aro = VIR_TRISTATE_BOOL_YES;
-    } else {
-        if (src->readonly)
-            ro = VIR_TRISTATE_BOOL_YES;
-        else
-            ro = VIR_TRISTATE_BOOL_NO;
-    }
-
     switch (actualType) {
     case VIR_STORAGE_TYPE_BLOCK:
     case VIR_STORAGE_TYPE_FILE:
@@ -1069,7 +1039,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src,
             driver = "file";
         }

-        if (!(fileprops = qemuBlockStorageSourceGetFileProps(src, onlytarget, &aro, &ro)))
+        if (!(fileprops = qemuBlockStorageSourceGetFileProps(src, onlytarget)))
             return NULL;
         break;

-- 
2.41.0




[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