]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBlockStorageSourceGetBackendProps: Remove unnecessary indent for non-nbdkit code...
authorPeter Krempa <pkrempa@redhat.com>
Wed, 18 Oct 2023 07:38:56 +0000 (09:38 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 26 Oct 2023 07:02:23 +0000 (09:02 +0200)
Formatting of the 'nbdkit' driven backend breaks out of the switch
statement so we don't need to have an unnecessary block and indentation
level for the case when nbdkit is not in use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_block.c

index e706bb7369272c9f84c3911173ee07c915c30d86..3be12b47e33e5c58da79c3765c0d0b5eb640d1b8 100644 (file)
@@ -1028,75 +1028,75 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src,
         return NULL;
 
     case VIR_STORAGE_TYPE_NETWORK:
-        /* prefer using nbdkit for sources that are supported */
+        /* prefer using nbdkit if configured for sources that are supported */
         if ((fileprops = qemuBlockStorageSourceGetNbdkitProps(src))) {
             driver = "nbd";
             break;
-        } else {
-            switch ((virStorageNetProtocol) src->protocol) {
-                case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
-                    driver = "gluster";
-                    if (!(fileprops = qemuBlockStorageSourceGetGlusterProps(src, onlytarget)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_VXHS:
-                    driver = "vxhs";
-                    if (!(fileprops = qemuBlockStorageSourceGetVxHSProps(src, onlytarget)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_HTTP:
-                case VIR_STORAGE_NET_PROTOCOL_HTTPS:
-                case VIR_STORAGE_NET_PROTOCOL_FTP:
-                case VIR_STORAGE_NET_PROTOCOL_FTPS:
-                case VIR_STORAGE_NET_PROTOCOL_TFTP:
-                    driver = virStorageNetProtocolTypeToString(src->protocol);
-                    if (!(fileprops = qemuBlockStorageSourceGetCURLProps(src, onlytarget)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_ISCSI:
-                    driver = "iscsi";
-                    if (!(fileprops = qemuBlockStorageSourceGetISCSIProps(src, onlytarget)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_NBD:
-                    driver = "nbd";
-                    if (!(fileprops = qemuBlockStorageSourceGetNBDProps(src, onlytarget)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_RBD:
-                    driver = "rbd";
-                    if (!(fileprops = qemuBlockStorageSourceGetRBDProps(src, onlytarget)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
-                    driver = "sheepdog";
-                    if (!(fileprops = qemuBlockStorageSourceGetSheepdogProps(src)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_SSH:
-                    driver = "ssh";
-                    if (!(fileprops = qemuBlockStorageSourceGetSshProps(src)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_NFS:
-                    driver = "nfs";
-                    if (!(fileprops = qemuBlockStorageSourceGetNFSProps(src)))
-                        return NULL;
-                    break;
-
-                case VIR_STORAGE_NET_PROTOCOL_NONE:
-                case VIR_STORAGE_NET_PROTOCOL_LAST:
-                    virReportEnumRangeError(virStorageNetProtocol, src->protocol);
-                    return NULL;
-            }
+        }
+
+        switch ((virStorageNetProtocol) src->protocol) {
+        case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
+            driver = "gluster";
+            if (!(fileprops = qemuBlockStorageSourceGetGlusterProps(src, onlytarget)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_VXHS:
+            driver = "vxhs";
+            if (!(fileprops = qemuBlockStorageSourceGetVxHSProps(src, onlytarget)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_HTTP:
+        case VIR_STORAGE_NET_PROTOCOL_HTTPS:
+        case VIR_STORAGE_NET_PROTOCOL_FTP:
+        case VIR_STORAGE_NET_PROTOCOL_FTPS:
+        case VIR_STORAGE_NET_PROTOCOL_TFTP:
+            driver = virStorageNetProtocolTypeToString(src->protocol);
+            if (!(fileprops = qemuBlockStorageSourceGetCURLProps(src, onlytarget)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_ISCSI:
+            driver = "iscsi";
+            if (!(fileprops = qemuBlockStorageSourceGetISCSIProps(src, onlytarget)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_NBD:
+            driver = "nbd";
+            if (!(fileprops = qemuBlockStorageSourceGetNBDProps(src, onlytarget)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_RBD:
+            driver = "rbd";
+            if (!(fileprops = qemuBlockStorageSourceGetRBDProps(src, onlytarget)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
+            driver = "sheepdog";
+            if (!(fileprops = qemuBlockStorageSourceGetSheepdogProps(src)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_SSH:
+            driver = "ssh";
+            if (!(fileprops = qemuBlockStorageSourceGetSshProps(src)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_NFS:
+            driver = "nfs";
+            if (!(fileprops = qemuBlockStorageSourceGetNFSProps(src)))
+                return NULL;
+            break;
+
+        case VIR_STORAGE_NET_PROTOCOL_NONE:
+        case VIR_STORAGE_NET_PROTOCOL_LAST:
+            virReportEnumRangeError(virStorageNetProtocol, src->protocol);
+            return NULL;
         }
         break;
     }