aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python/scripts
diff options
context:
space:
mode:
authorAlastair Tse <atse@xensource.com>2006-10-13 15:34:01 +0100
committerAlastair Tse <atse@xensource.com>2006-10-13 15:34:01 +0100
commit5d179b7561692d372481dec35002f96fee053e01 (patch)
treedd52836bd363ff87c738e77f53e7f21431809c61 /tools/python/scripts
parent76b24ff4e2109f39534f421cb151929cc09718cf (diff)
downloadxen-5d179b7561692d372481dec35002f96fee053e01.tar.gz
xen-5d179b7561692d372481dec35002f96fee053e01.tar.bz2
xen-5d179b7561692d372481dec35002f96fee053e01.zip
[XEND] XendVDI saves configuration on change.
Added a base class called AutoSaveObject that will attempt to call save_config() if any attribute in the object changes. It isn't particularly efficient, but we do not expect VDI to change much. Signed-off-by: Alastair Tse <atse@xensource.com>
Diffstat (limited to 'tools/python/scripts')
-rw-r--r--tools/python/scripts/xapi.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py
index e44663bd1b..5b0d571324 100644
--- a/tools/python/scripts/xapi.py
+++ b/tools/python/scripts/xapi.py
@@ -37,6 +37,7 @@ COMMANDS = {
'sr-list': ('', 'List all SRs'),
'vbd-create': ('<domname> <pycfg>', 'Create VBD attached to domname'),
'vdi-list' : ('', 'List all VDI'),
+ 'vdi-rename': ('<vdi_uuid> <new_name>', 'Rename VDI'),
'vdi-delete': ('<vdi_uuid>', 'Delete VDI'),
'vif-create': ('<domname> <pycfg>', 'Create VIF attached to domname'),
@@ -303,6 +304,17 @@ def xapi_vdi_delete(*args):
print 'Deleting VDI %s' % vdi_uuid
result = execute(server.VDI.destroy, session, vdi_uuid)
print 'Done.'
+
+def xapi_vdi_rename(*args):
+ server, session = _connect()
+ if len(args) < 2:
+ raise OptionError('Not enough arguments')
+
+ vdi_uuid = args[0]
+ vdi_name = args[1]
+ print 'Renaming VDI %s to %s' % (vdi_uuid, vdi_name)
+ result = execute(server.VDI.set_name_label, session, vdi_uuid, vdi_name)
+ print 'Done.'
#