fbe740
From e551ad605fd99e92a85acdab53bc52efaa6facb2 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <e551ad605fd99e92a85acdab53bc52efaa6facb2@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Wed, 19 Feb 2020 15:10:08 +0100
fbe740
Subject: [PATCH] virStorageSourceJSONDriverParser: annotate 'format' drivers
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
The parser was originally designed only for protocol parsers. Since
fbe740
we already have 'raw' format driver in the list we'll need to be able
fbe740
to parse it too. In later patches this will be used to prevent parsing
fbe740
nested format drivers.
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
(cherry picked from commit 7e13ff8dc016dda5ffd50ff5c059f01c76486c82)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
fbe740
Message-Id: <ef05c98383c79aa7487ea97c7e1cbfb384c80440.1582120424.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/util/virstoragefile.c | 33 +++++++++++++++++----------------
fbe740
 1 file changed, 17 insertions(+), 16 deletions(-)
fbe740
fbe740
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
fbe740
index c97a3a9d6e..b6749b150c 100644
fbe740
--- a/src/util/virstoragefile.c
fbe740
+++ b/src/util/virstoragefile.c
fbe740
@@ -3563,6 +3563,7 @@ virStorageSourceParseBackingJSONVxHS(virStorageSourcePtr src,
fbe740
 
fbe740
 struct virStorageSourceJSONDriverParser {
fbe740
     const char *drvname;
fbe740
+    bool formatdriver;
fbe740
     /**
fbe740
      * The callback gets a pre-allocated storage source @src and the JSON
fbe740
      * object to parse. The callback shall return -1 on error and report error
fbe740
@@ -3575,22 +3576,22 @@ struct virStorageSourceJSONDriverParser {
fbe740
 };
fbe740
 
fbe740
 static const struct virStorageSourceJSONDriverParser jsonParsers[] = {
fbe740
-    {"file", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_FILE},
fbe740
-    {"host_device", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
fbe740
-    {"host_cdrom", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
fbe740
-    {"http", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_HTTP},
fbe740
-    {"https", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_HTTPS},
fbe740
-    {"ftp", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_FTP},
fbe740
-    {"ftps", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_FTPS},
fbe740
-    {"tftp", virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_TFTP},
fbe740
-    {"gluster", virStorageSourceParseBackingJSONGluster, 0},
fbe740
-    {"iscsi", virStorageSourceParseBackingJSONiSCSI, 0},
fbe740
-    {"nbd", virStorageSourceParseBackingJSONNbd, 0},
fbe740
-    {"sheepdog", virStorageSourceParseBackingJSONSheepdog, 0},
fbe740
-    {"ssh", virStorageSourceParseBackingJSONSSH, 0},
fbe740
-    {"rbd", virStorageSourceParseBackingJSONRBD, 0},
fbe740
-    {"raw", virStorageSourceParseBackingJSONRaw, 0},
fbe740
-    {"vxhs", virStorageSourceParseBackingJSONVxHS, 0},
fbe740
+    {"file", false, virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_FILE},
fbe740
+    {"host_device", false, virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
fbe740
+    {"host_cdrom", false, virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
fbe740
+    {"http", false, virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_HTTP},
fbe740
+    {"https", false, virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_HTTPS},
fbe740
+    {"ftp", false, virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_FTP},
fbe740
+    {"ftps", false, virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_FTPS},
fbe740
+    {"tftp", false, virStorageSourceParseBackingJSONUri, VIR_STORAGE_NET_PROTOCOL_TFTP},
fbe740
+    {"gluster", false, virStorageSourceParseBackingJSONGluster, 0},
fbe740
+    {"iscsi", false, virStorageSourceParseBackingJSONiSCSI, 0},
fbe740
+    {"nbd", false, virStorageSourceParseBackingJSONNbd, 0},
fbe740
+    {"sheepdog", false, virStorageSourceParseBackingJSONSheepdog, 0},
fbe740
+    {"ssh", false, virStorageSourceParseBackingJSONSSH, 0},
fbe740
+    {"rbd", false, virStorageSourceParseBackingJSONRBD, 0},
fbe740
+    {"raw", true, virStorageSourceParseBackingJSONRaw, 0},
fbe740
+    {"vxhs", false, virStorageSourceParseBackingJSONVxHS, 0},
fbe740
 };
fbe740
 
fbe740
 
fbe740
-- 
fbe740
2.25.0
fbe740