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