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