[PATCH 07/31] qemu: block: Use proper accessors for image formatting/creation code

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

 



Use 'qemuBlockStorageSourceGetEffectiveStorageNodename' in all the JSON
props formatters for setting up a 'blockdev-create' job of a format
layer.

In case of the blockjob name designator we're okay to use just the
storage layer nodename as that serves only to find the appropriate
entry.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c    | 10 +++++-----
 src/qemu/qemu_blockjob.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 0c9460f678..a98caa330e 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -2078,7 +2078,7 @@ qemuBlockStorageSourceCreateGetFormatPropsGeneric(virStorageSource *src,

     if (virJSONValueObjectAdd(&props,
                               "s:driver", driver,
-                              "s:file", src->nodestorage,
+                              "s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
                               "U:size", src->capacity,
                               NULL) < 0)
         return -1;
@@ -2143,7 +2143,7 @@ qemuBlockStorageSourceCreateGetFormatPropsLUKS(virStorageSource *src,

     if (virJSONValueObjectAdd(&luksprops,
                               "s:driver", "luks",
-                              "s:file", src->nodestorage,
+                              "s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
                               "U:size", src->capacity,
                               NULL) < 0)
         return -1;
@@ -2200,7 +2200,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow2(virStorageSource *src,

     if (virJSONValueObjectAdd(&qcow2props,
                               "s:driver", "qcow2",
-                              "s:file", src->nodestorage,
+                              "s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
                               "U:size", src->capacity,
                               "S:version", qcow2version,
                               "P:cluster-size", src->clusterSize,
@@ -2226,7 +2226,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow(virStorageSource *src,

     if (virJSONValueObjectAdd(&qcowprops,
                               "s:driver", "qcow",
-                              "s:file", src->nodestorage,
+                              "s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
                               "U:size", src->capacity,
                               NULL) < 0)
         return -1;
@@ -2249,7 +2249,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQed(virStorageSource *src,

     if (virJSONValueObjectAdd(&qedprops,
                               "s:driver", "qed",
-                              "s:file", src->nodestorage,
+                              "s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
                               "U:size", src->capacity,
                               NULL) < 0)
         return -1;
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index f1d22df59f..25ac74d6c4 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -312,7 +312,7 @@ qemuBlockJobNewCreate(virDomainObj *vm,
     const char *nodename = src->nodeformat;

     if (storage)
-        nodename = src->nodestorage;
+        nodename = qemuBlockStorageSourceGetStorageNodename(src);

     jobname = g_strdup_printf("create-%s", nodename);

-- 
2.41.0




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

  Powered by Linux