From a1d1b87d1d574f7bfbd95681cb8e456cec18b33b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 15 Dec 2014 08:55:12 +0000
Subject: [PATCH] v2v: Get passwords in domain XML (RHBZ#1174123).
Thanks: Tingting Zheng
(cherry picked from commit dfded7c94118e8888dec38f11c2af62d8156a59e)
---
v2v/domainxml-c.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/v2v/domainxml-c.c b/v2v/domainxml-c.c
index b57440c..c9ed8c5 100644
--- a/v2v/domainxml-c.c
+++ b/v2v/domainxml-c.c
@@ -138,7 +138,10 @@ v2v_dumpxml (value passwordv, value connv, value domnamev)
authdata.cb = libvirt_auth_default_wrapper;
authdata.cbdata = (void *) password;
- conn = virConnectOpenAuth (conn_uri, &authdata, VIR_CONNECT_RO);
+ /* Note this cannot be a read-only connection since we need to use
+ * the VIR_DOMAIN_XML_SECURE flag below.
+ */
+ conn = virConnectOpenAuth (conn_uri, &authdata, 0);
if (conn == NULL) {
if (conn_uri)
snprintf (errmsg, sizeof errmsg,
@@ -188,7 +191,8 @@ v2v_dumpxml (value passwordv, value connv, value domnamev)
}
}
- xml = virDomainGetXMLDesc (dom, 0);
+ /* Use VIR_DOMAIN_XML_SECURE to get passwords (RHBZ#1174123). */
+ xml = virDomainGetXMLDesc (dom, VIR_DOMAIN_XML_SECURE);
if (xml == NULL) {
err = virGetLastError ();
snprintf (errmsg, sizeof errmsg,
--
1.8.3.1