<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 04/21/2014 03:22 AM,
<a class="moz-txt-link-abbreviated" href="mailto:shaohef@linux.vnet.ibm.com">shaohef@linux.vnet.ibm.com</a> wrote:<br>
</div>
<blockquote
cite="mid:1398061379-23308-1-git-send-email-shaohef@linux.vnet.ibm.com"
type="cite">
<pre wrap="">From: ShaoHe Feng <a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
define domain just edit the persistent xml.
So we should get user and group from persistent xml instead of live xml
when domain is living.
Signed-off-by: ShaoHe Feng <a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
Signed-off-by: Royce Lv <a class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com"><lvroyce@linux.vnet.ibm.com></a>
---
src/kimchi/model/vms.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 90e9537..2b9bf56 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -258,9 +258,11 @@ class VMModel(object):
old_xml = new_xml = dom.XMLDesc(0)
+ meta_xml = (dom.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE)
+ if dom.isPersistent() else old_xml)</pre>
</blockquote>
<br>
From libvirt doc
(<a class="moz-txt-link-freetext" href="http://libvirt.org/html/libvirt-libvirt.html#virDomainGetXMLDesc">http://libvirt.org/html/libvirt-libvirt.html#virDomainGetXMLDesc</a>):<br>
<br>
"If @flags includes <a
href="http://libvirt.org/html/libvirt-libvirt.html#VIR_DOMAIN_XML_INACTIVE">VIR_DOMAIN_XML_INACTIVE</a>,
then the XML represents the configuration that will be <br>
used on the next boot of a persistent domain; otherwise, the
configuration represents the currently running domain"<br>
<br>
So you don't need to add the 'if' statement there (if
dom.isPersistent())<br>
<br>
And call direclty: <br>
<br>
meta_xml = (dom.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE)
<br>
<br>
<blockquote
cite="mid:1398061379-23308-1-git-send-email-shaohef@linux.vnet.ibm.com"
type="cite">
<pre wrap="">
metadata_xpath = "/domain/metadata/kimchi/access/%s"
- users = xpath_get_text(old_xml, metadata_xpath % "user")
- groups = xpath_get_text(old_xml, metadata_xpath % "group")
+ users = xpath_get_text(meta_xml, metadata_xpath % "user")
+ groups = xpath_get_text(meta_xml, metadata_xpath % "group")
for key, val in params.items():
if key == 'users':
</pre>
</blockquote>
<br>
</body>
</html>