# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1173914793 0
# Node ID 30a83a0839bd85c464347f30b388f0d8567ba6f0
# Parent b39c0a79d4d5d90fd92efb148ad06198cd139f85
Implement xm domid and xm console using the Xen-API, and fix xm domname.
Signed-off-by: Tom Wilkie <tom.wilkie@xxxxxxxxx>
---
tools/python/xen/xm/main.py | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff -r b39c0a79d4d5 -r 30a83a0839bd tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Wed Mar 14 23:16:59 2007 +0000
+++ b/tools/python/xen/xm/main.py Wed Mar 14 23:26:33 2007 +0000
@@ -1140,14 +1140,16 @@ def xm_destroy(args):
else:
server.xend.domain.destroy(dom)
-
def xm_domid(args):
arg_check(args, "domid", 1)
name = args[0]
- dom = server.xend.domain(name)
- print sxp.child_value(dom, 'domid')
+ if serverType == SERVER_XEN_API:
+ print server.xenapi.VM.get_domid(get_single_vm(name))
+ else:
+ dom = server.xend.domain(name)
+ print sxp.child_value(dom, 'domid')
def xm_domname(args):
arg_check(args, "domname", 1)
@@ -1155,7 +1157,7 @@ def xm_domname(args):
name = args[0]
if serverType == SERVER_XEN_API:
- print server.xenapi.VM.get_domid(get_single_vm(dom))
+ print server.xenapi.VM.get_name_label(get_single_vm(name))
else:
dom = server.xend.domain(name)
print sxp.child_value(dom, 'name')
@@ -1384,13 +1386,17 @@ def xm_console(args):
dom = params[0]
try:
- info = server.xend.domain(dom)
+ if serverType == SERVER_XEN_API:
+ domid = int(server.xenapi.VM.get_domid(get_single_vm(dom)))
+ else:
+ info = server.xend.domain(dom)
+ domid = int(sxp.child_value(info, 'domid', '-1'))
except:
if quiet:
sys.exit(1)
else:
raise
- domid = int(sxp.child_value(info, 'domid', '-1'))
+
if domid == -1:
if quiet:
sys.exit(1)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|