|
|
6ae9ed |
From 73fc27c0ac5b2c8eedf2c92ba5fd4a473ca14f1c Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <73fc27c0ac5b2c8eedf2c92ba5fd4a473ca14f1c@dist-git>
|
|
|
6ae9ed |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
6ae9ed |
Date: Tue, 2 Aug 2016 13:41:49 +0200
|
|
|
6ae9ed |
Subject: [PATCH] util: storage: Add support for host device backing specified
|
|
|
6ae9ed |
via JSON
|
|
|
6ae9ed |
|
|
|
6ae9ed |
JSON pseudo protocol for qemu allows to explicitly specify devices.
|
|
|
6ae9ed |
Add convertor to the internal type.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
(cherry picked from commit 47f292dd35c4f2163d4a5f6d8673128c74e91a48)
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1134878 [JSON backing]
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1247521 [gluster multi-host]
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/util/virstoragefile.c | 2 ++
|
|
|
6ae9ed |
tests/virstoragetest.c | 6 ++++++
|
|
|
6ae9ed |
2 files changed, 8 insertions(+)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
|
|
|
6ae9ed |
index 25f363d..45266c5 100644
|
|
|
6ae9ed |
--- a/src/util/virstoragefile.c
|
|
|
6ae9ed |
+++ b/src/util/virstoragefile.c
|
|
|
6ae9ed |
@@ -2554,6 +2554,8 @@ struct virStorageSourceJSONDriverParser {
|
|
|
6ae9ed |
|
|
|
6ae9ed |
static const struct virStorageSourceJSONDriverParser jsonParsers[] = {
|
|
|
6ae9ed |
{"file", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_FILE},
|
|
|
6ae9ed |
+ {"host_device", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
|
|
|
6ae9ed |
+ {"host_cdrom", virStorageSourceParseBackingJSONPath, VIR_STORAGE_TYPE_BLOCK},
|
|
|
6ae9ed |
};
|
|
|
6ae9ed |
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
|
|
|
6ae9ed |
index 04575f2..6873180 100644
|
|
|
6ae9ed |
--- a/tests/virstoragetest.c
|
|
|
6ae9ed |
+++ b/tests/virstoragetest.c
|
|
|
6ae9ed |
@@ -1370,6 +1370,12 @@ mymain(void)
|
|
|
6ae9ed |
"}"
|
|
|
6ae9ed |
"}",
|
|
|
6ae9ed |
"<source file='/path/to/file'/>\n");
|
|
|
6ae9ed |
+ TEST_BACKING_PARSE("json:{\"file.driver\":\"host_device\", "
|
|
|
6ae9ed |
+ "\"file.filename\":\"/path/to/dev\"}",
|
|
|
6ae9ed |
+ "<source dev='/path/to/dev'/>\n");
|
|
|
6ae9ed |
+ TEST_BACKING_PARSE("json:{\"file.driver\":\"host_cdrom\", "
|
|
|
6ae9ed |
+ "\"file.filename\":\"/path/to/cdrom\"}",
|
|
|
6ae9ed |
+ "<source dev='/path/to/cdrom'/>\n");
|
|
|
6ae9ed |
|
|
|
6ae9ed |
cleanup:
|
|
|
6ae9ed |
/* Final cleanup */
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.9.2
|
|
|
6ae9ed |
|