From: Juergen Gross <juergen.gross@ts.fujitsu.com>
To: "Xu, Jiajun" <jiajun.xu@intel.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: No sxputils module for xm command
Date: Mon, 26 Apr 2010 07:26:25 +0200 [thread overview]
Message-ID: <4BD52401.5020604@ts.fujitsu.com> (raw)
In-Reply-To: <D5AB6E638E5A3E4B8F4406B113A5A19A1D8CBB53@shsmsx501.ccr.corp.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]
On 04/23/2010 05:49 PM, Xu, Jiajun wrote:
> Hi,
> I found with latest xen, 'xm' command returns fail with following error:
>
> [root@vt-dp6 ~]# xm list
> Traceback (most recent call last):
> File "/usr/sbin/xm", line 5, in ?
> from xen.xm import main
> File "/usr/lib/python2.4/site-packages/xen/xm/main.py", line 59, in ?
> from xen.util.sxputils import sxp2map, map2sxp as map_to_sxp
> ImportError: No module named sxputils
>
> Could anyone help on this?
> Thanks a lot.
Sorry, the attched patch should correct that.
The module slipped through my cpupool patch (no hg add).
Now I've deleted all xen python modules on my test machine before doing a new
install. Seems to work now...
Juergen
--
Juergen Gross Principal Developer Operating Systems
TSP ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28 Internet: ts.fujitsu.com
D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html
[-- Attachment #2: sxputils.patch --]
[-- Type: text/x-patch, Size: 2557 bytes --]
Signed-off-by: juergen.gross@ts.fujitsu.com
diff -r c87ec146229a tools/python/xen/util/sxputils.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/python/xen/util/sxputils.py Mon Apr 26 07:14:28 2010 +0200
@@ -0,0 +1,64 @@
+#============================================================================
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#============================================================================
+# Copyright (c) 2009 Fujitsu Technology Solutions
+#============================================================================
+
+""" convert sxp to map / map to sxp.
+"""
+
+import types
+from xen.xend import sxp
+
+def map2sxp(map_val):
+ """ conversion of all key-value pairs of a map (recursively) to sxp.
+ @param map_val: map; if a value contains a list or dict it is also
+ converted to sxp
+ @type map_val: dict
+ @return sxp expr
+ @rtype: list
+ """
+ sxp_vals = []
+ for (k, v) in map_val.items():
+ if isinstance(v, types.DictionaryType):
+ sxp_vals += [[k] + map2sxp(v)]
+ elif isinstance(v, types.ListType):
+ sxp_vals += [[k] + v]
+ else:
+ sxp_vals += [[k, v]]
+ return sxp_vals
+
+def sxp2map( s ):
+ """ conversion of sxp to map.
+ @param s: sxp expr
+ @type s: list
+ @return: map
+ @rtype: dict
+ """
+ sxphash = {}
+
+ for child in sxp.children( s ):
+ if isinstance( child, types.ListType ) and len( child ) > 1:
+ if isinstance( child[1], types.ListType ) and len( child[1] ) > 1:
+ sxphash[ child[0] ] = sxp2map( child )
+ else:
+ childs = sxp.children(child)
+ if len(childs) > 1:
+ sxphash[ child[0] ] = childs
+ else:
+ sxphash[ child[0] ] = childs[0]
+
+ return sxphash
+
+
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next prev parent reply other threads:[~2010-04-26 5:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-23 15:49 No sxputils module for xm command Xu, Jiajun
2010-04-26 5:26 ` Juergen Gross [this message]
2010-04-26 5:36 ` Keir Fraser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BD52401.5020604@ts.fujitsu.com \
--to=juergen.gross@ts.fujitsu.com \
--cc=jiajun.xu@intel.com \
--cc=keir.fraser@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.