From: Peter Krempa Date: Thu, 14 Jul 2016 11:58:26 +0000 (+0200) Subject: util: storage: Add support for host device backing specified via JSON X-Git-Tag: v2.1.0-rc1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47f292dd35c4f2163d4a5f6d8673128c74e91a48;p=thirdparty%2Flibvirt.git 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. --- 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 */