[PATCHv2 03/10] util: storage: Add support for host device backing specified via JSON

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

 



JSON pseudo protocol for qemu allows to explicitly specify devices.
Add convertor to the internal type.
---
 src/util/virstoragefile.c | 2 ++
 tests/virstoragetest.c    | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 763bec6..766ae28 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2545,6 +2545,8 @@ struct virStorageSourceJSONDriverParser {

 static const struct virStorageSourceJSONDriverParser jsonParsers[] = {
     {"file", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_FILE},
+    {"host_device", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
+    {"host_cdrom", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
 };


diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 04575f2..6873180 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -1370,6 +1370,12 @@ mymain(void)
                                         "}"
                             "}",
                        "<source file='/path/to/file'/>\n");
+    TEST_BACKING_PARSE("json:{\"file.driver\":\"host_device\", "
+                             "\"file.filename\":\"/path/to/dev\"}",
+                       "<source dev='/path/to/dev'/>\n");
+    TEST_BACKING_PARSE("json:{\"file.driver\":\"host_cdrom\", "
+                             "\"file.filename\":\"/path/to/cdrom\"}",
+                       "<source dev='/path/to/cdrom'/>\n");

  cleanup:
     /* Final cleanup */
-- 
2.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]