[libvirt] [PATCH 11/12] qemu: block: Add node-names to JSON backing storage strings

Peter Krempa posted 12 patches 7 years, 6 months ago
[libvirt] [PATCH 11/12] qemu: block: Add node-names to JSON backing storage strings
Posted by Peter Krempa 7 years, 6 months ago
Format out the node-name if it was assigned for JSON-based storage
specification.
---
 src/qemu/qemu_block.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 6f6d294bf..6df0dc0fb 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1005,5 +1005,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
         break;
     }

+    if (virJSONValueObjectAdd(fileprops, "S:node-name", src->nodestorage, NULL) < 0) {
+        virJSONValueFree(fileprops);
+        return NULL;
+    }
+
     return fileprops;
 }
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 11/12] qemu: block: Add node-names to JSON backing storage strings
Posted by John Ferlan 7 years, 6 months ago

On 11/03/2017 10:29 AM, Peter Krempa wrote:
> Format out the node-name if it was assigned for JSON-based storage
> specification.
> ---
>  src/qemu/qemu_block.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 

And Coverity also notes that for virStorageType) actualType ==
VIR_STORAGE_TYPE_VOLUME ((NONE and LAST, too), that fileprops will be
NULL and thus the virJSONValueObjectAdd won't be happy...

John

> diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
> index 6f6d294bf..6df0dc0fb 100644
> --- a/src/qemu/qemu_block.c
> +++ b/src/qemu/qemu_block.c
> @@ -1005,5 +1005,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
>          break;
>      }
> 
> +    if (virJSONValueObjectAdd(fileprops, "S:node-name", src->nodestorage, NULL) < 0) {
> +        virJSONValueFree(fileprops);
> +        return NULL;
> +    }
> +
>      return fileprops;
>  }
> 

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