Blame SOURCES/libvirt-cim-0.6.3-7e164fbd.patch

c55d09
From 7e164fbdac05e955fe21c5bacc4aeee171821fd5 Mon Sep 17 00:00:00 2001
c55d09
From: Michal Privoznik <mprivozn@redhat.com>
c55d09
Date: Tue, 6 Aug 2013 14:41:33 +0200
c55d09
Subject: [PATCH 02/48] get_dominfo: Use VIR_DOMAIN_XML_SECURE more wisely
c55d09
c55d09
Currently, even if we are connected RO to the libvirtd, we try to dump
c55d09
domain XML with secure information (VIR_DOMAIN_XML_SECURE flag). This
c55d09
is, however, forbidden in libvirt. With RO connection, we should not use
c55d09
the SECURE flag at all.
c55d09
c55d09
Signed-off-by: John Ferlan <jferlan@redhat.com>
c55d09
---
c55d09
 libxkutil/device_parsing.c | 9 +++++++--
c55d09
 libxkutil/misc_util.c      | 2 +-
c55d09
 libxkutil/misc_util.h      | 1 +
c55d09
 3 files changed, 9 insertions(+), 3 deletions(-)
c55d09
c55d09
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
c55d09
index 7900e06..ffdf682 100644
c55d09
--- a/libxkutil/device_parsing.c
c55d09
+++ b/libxkutil/device_parsing.c
c55d09
@@ -31,6 +31,7 @@
c55d09
 #include <libcmpiutil/libcmpiutil.h>
c55d09
 
c55d09
 #include "device_parsing.h"
c55d09
+#include "misc_util.h"
c55d09
 #include "xmlgen.h"
c55d09
 #include "../src/svpc_types.h"
c55d09
 
c55d09
@@ -1283,8 +1284,12 @@ int get_dominfo(virDomainPtr dom, struct domain **dominfo)
c55d09
         char *xml;
c55d09
         int ret = 0;
c55d09
         int start;
c55d09
-        xml = virDomainGetXMLDesc(dom,
c55d09
-                VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE);
c55d09
+        int flags = VIR_DOMAIN_XML_INACTIVE;
c55d09
+
c55d09
+        if (!is_read_only())
c55d09
+            flags |= VIR_DOMAIN_XML_SECURE;
c55d09
+
c55d09
+        xml = virDomainGetXMLDesc(dom, flags);
c55d09
 
c55d09
         if (xml == NULL) {
c55d09
                 CU_DEBUG("Failed to get dom xml with libvirt API.");
c55d09
diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c
c55d09
index 9e7e0d5..2164dd0 100644
c55d09
--- a/libxkutil/misc_util.c
c55d09
+++ b/libxkutil/misc_util.c
c55d09
@@ -219,7 +219,7 @@ static int libvirt_cim_config_get(LibvirtcimConfigProperty *prop)
c55d09
 }
c55d09
 #endif
c55d09
 
c55d09
-static int is_read_only(void)
c55d09
+int is_read_only(void)
c55d09
 {
c55d09
         static LibvirtcimConfigProperty prop = {
c55d09
                                        "readonly", CONFIG_BOOL, {0}, 0};
c55d09
diff --git a/libxkutil/misc_util.h b/libxkutil/misc_util.h
c55d09
index fd4f191..056c327 100644
c55d09
--- a/libxkutil/misc_util.h
c55d09
+++ b/libxkutil/misc_util.h
c55d09
@@ -153,6 +153,7 @@ int virt_set_status(const CMPIBroker *broker,
c55d09
 #define REF2STR(r) CMGetCharPtr(CMObjectPathToString(r, NULL))
c55d09
 
c55d09
 /* get libvirt-cim config */
c55d09
+int is_read_only(void);
c55d09
 const char *get_mig_ssh_tmp_key(void);
c55d09
 bool get_disable_kvm(void);
c55d09
 const char *get_lldptool_query_options(void);
c55d09
-- 
c55d09
1.8.5.3
c55d09