WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XENAPI] Make xapi.py work with modules i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XENAPI] Make xapi.py work with modules in /usr/lib/python.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Nov 2006 15:30:17 +0000
Delivery-date: Fri, 10 Nov 2006 07:30:16 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID 272cd2dc7cdfaffdda6ed5dd8b620152e0a9c7d8
# Parent  5a4517468f4f7341eef9d20d4959187a7f2f2267
[XENAPI] Make xapi.py work with modules in /usr/lib/python.

Also Add host_set_name command.

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/scripts/xapi.py |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletion(-)

diff -r 5a4517468f4f -r 272cd2dc7cdf tools/python/scripts/xapi.py
--- a/tools/python/scripts/xapi.py      Fri Nov 10 11:01:15 2006 +0000
+++ b/tools/python/scripts/xapi.py      Fri Nov 10 12:44:47 2006 +0000
@@ -16,11 +16,15 @@
 # Copyright (C) 2006 XenSource Ltd.
 #============================================================================
 
+import sys
+sys.path.append('/usr/lib/python')
+
 from xen.util.xmlrpclib2 import ServerProxy
 from optparse import *
 from pprint import pprint
 from types import DictType
 from getpass import getpass
+
 
 MB = 1024 * 1024
 
@@ -34,6 +38,7 @@ VDI_LIST_FORMAT = '%(name_label)-18s %(u
 
 COMMANDS = {
     'host-info': ('', 'Get Xen Host Info'),
+    'host-set-name': ('', 'Set host name'),
     'sr-list':   ('', 'List all SRs'),
     'vbd-create': ('<domname> <pycfg> [opts]',
                    'Create VBD attached to domname'),
@@ -51,7 +56,7 @@ COMMANDS = {
     'vm-name':   ('<uuid>', 'Name of UUID.'),
     'vm-shutdown': ('<name> [opts]', 'Shutdown VM with name'),
     'vm-start':  ('<name>', 'Start VM with name'),
-    'vm-uuid':   ('<name>', 'UUID of a domain by name.'),    
+    'vm-uuid':   ('<name>', 'UUID of a domain by name.'),
 }
 
 OPTIONS = {
@@ -174,6 +179,17 @@ def xapi_host_info(*args):
         print HOST_INFO_FORMAT % ('CPUs', len(hostinfo['host_CPUs']))
         print HOST_INFO_FORMAT % ('VMs', len(hostinfo['resident_VMs']))
         print HOST_INFO_FORMAT % ('UUID', host)        
+
+def xapi_host_set_name(*args):
+    if len(args) < 1:
+        raise OptionError("No hostname specified")
+    
+    server, session = _connect()
+    hosts = execute(server.host.get_all, session)
+    if len(hosts) > 0:
+        execute(server.host.set_name_label, session, hosts[0], args[0])
+        print 'Hostname: %s' % execute(server.host.get_name_label, session,
+                                       hosts[0])
 
 def xapi_vm_uuid(*args):
     if len(args) < 1:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XENAPI] Make xapi.py work with modules in /usr/lib/python., Xen patchbot-unstable <=