898951
From b0a82f4abc9f4de3db965c84b926322846588278 Mon Sep 17 00:00:00 2001
898951
Message-Id: <b0a82f4abc9f4de3db965c84b926322846588278@dist-git>
898951
From: Peter Krempa <pkrempa@redhat.com>
898951
Date: Thu, 22 Jan 2015 15:53:47 +0100
898951
Subject: [PATCH] lib: Don't force the key argument when deleting metadata
898951
898951
https://bugzilla.redhat.com/show_bug.cgi?id=1184929
898951
898951
virDomainSetMetadata when operating on the metadata element was
898951
requesting the @key argument to be passed even if @metadata was NULL
898951
used to delete the corresponding metadata element. This is not needed as
898951
the key is only used when adding the element and matching is done via
898951
the XML namespace.
898951
898951
(cherry picked from commit 3b6784d119074e3be8861cc4c30630f299bde121)
898951
898951
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
898951
---
898951
 src/libvirt.c | 3 ++-
898951
 1 file changed, 2 insertions(+), 1 deletion(-)
898951
898951
diff --git a/src/libvirt.c b/src/libvirt.c
898951
index cbcc24b..874304f 100644
898951
--- a/src/libvirt.c
898951
+++ b/src/libvirt.c
898951
@@ -10812,7 +10812,8 @@ virDomainSetMetadata(virDomainPtr domain,
898951
         break;
898951
     case VIR_DOMAIN_METADATA_ELEMENT:
898951
         virCheckNonNullArgGoto(uri, error);
898951
-        virCheckNonNullArgGoto(key, error);
898951
+        if (metadata)
898951
+            virCheckNonNullArgGoto(key, error);
898951
         break;
898951
     default:
898951
         /* For future expansion */
898951
-- 
898951
2.2.1
898951