mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Cleanup domain listing.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
This commit is contained in:
1 parent
876087a864
commit
399f4f8647
3 files changed
+22
-23
No files matched your search
@@ -75,8 +75,26 @@ class XendDomain:
|
||||
|
||||
@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 @@ class XendDomain:
|
||||
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.
|
||||
|
||||
|
||||
@@ -146,11 +146,10 @@ class SrvDomainDir(SrvDir):
|
||||
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>'
|
||||
|
||||
@@ -186,7 +186,7 @@ class EventProtocol(protocol.Protocol):
|
||||
|
||||
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")
|
||||
|
||||