From 47f292dd35c4f2163d4a5f6d8673128c74e91a48 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 14 Jul 2016 13:58:26 +0200 Subject: [PATCH] util: storage: Add support for host device backing specified via JSON 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 763bec6cae..766ae28562 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 04575f210f..6873180db2 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1370,6 +1370,12 @@ mymain(void) "}" "}", "\n"); + TEST_BACKING_PARSE("json:{\"file.driver\":\"host_device\", " + "\"file.filename\":\"/path/to/dev\"}", + "\n"); + TEST_BACKING_PARSE("json:{\"file.driver\":\"host_cdrom\", " + "\"file.filename\":\"/path/to/cdrom\"}", + "\n"); cleanup: /* Final cleanup */ -- 2.47.2