# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 84ab93e1ee05015bcc1c3218fac5b3cfd9fb2ffb
# Parent aaee260ce02cc002f6c4f1cb4ca3258ce5528c4f
Cleanup domain listing.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r aaee260ce02c -r 84ab93e1ee05 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Thu Sep 1 09:57:20 2005
+++ b/tools/python/xen/xend/XendDomain.py Thu Sep 1 10:08:53 2005
@@ -75,8 +75,26 @@
@return: domain objects
"""
+ self.refresh()
return self.domains.values()
-
+
+ def list_sorted(self):
+ """Get list of domain objects, sorted by name.
+
+ @return: domain objects
+ """
+ doms = self.list()
+ doms.sort(lambda x, y: cmp(x.name, y.name))
+ return doms
+
+ def list_names(self):
+ """Get list of domain names.
+
+ @return: domain names
+ """
+ doms = self.list_sorted()
+ return map(lambda x: x.name, doms)
+
def onVirq(self, event, val):
"""Event handler for virq.
"""
@@ -265,24 +283,6 @@
else:
self._delete_domain(id)
- def domain_ls(self):
- """Get list of domain names.
-
- @return: domain names
- """
- self.refresh()
- doms = self.domains.values()
- doms.sort(lambda x, y: cmp(x.name, y.name))
- return map(lambda x: x.name, doms)
-
- def domain_ls_ids(self):
- """Get list of domain ids.
-
- @return: domain names
- """
- self.refresh()
- return self.domains.keys()
-
def domain_create(self, config):
"""Create a domain from a configuration.
diff -r aaee260ce02c -r 84ab93e1ee05
tools/python/xen/xend/server/SrvDomainDir.py
--- a/tools/python/xen/xend/server/SrvDomainDir.py Thu Sep 1 09:57:20 2005
+++ b/tools/python/xen/xend/server/SrvDomainDir.py Thu Sep 1 10:08:53 2005
@@ -146,11 +146,10 @@
if not url.endswith('/'):
url += '/'
if use_sxp:
- domains = self.xd.domain_ls()
+ domains = self.xd.list_names()
sxp.show(domains, out=req)
else:
- domains = self.xd.list()
- domains.sort(lambda x, y: cmp(x.name, y.name))
+ domains = self.xd.list_sorted()
req.write('<ul>')
for d in domains:
req.write('<li><a href="%s%s"> Domain %s</a>'
diff -r aaee260ce02c -r 84ab93e1ee05 tools/python/xen/xend/server/event.py
--- a/tools/python/xen/xend/server/event.py Thu Sep 1 09:57:20 2005
+++ b/tools/python/xen/xend/server/event.py Thu Sep 1 10:08:53 2005
@@ -186,7 +186,7 @@
def op_domain_ls(self, name, v):
xd = xroot.get_component("xen.xend.XendDomain")
- return xd.domain_ls()
+ return xd.list_names()
def op_domain_configure(self, name, v):
domid = sxp.child_value(v, "dom")
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|