aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python/scripts
diff options
context:
space:
mode:
authorEwan Mellor <ewan@xensource.com>2006-11-09 15:27:32 +0000
committerEwan Mellor <ewan@xensource.com>2006-11-09 15:27:32 +0000
commite5c3d644cdb161cfbbaab4230f3c4f0052b0e5b3 (patch)
tree0f0f77e411610341117916cdc28d08c881f830b8 /tools/python/scripts
parentc2739fc6af5856797c4b876291346cbd7b25e45f (diff)
downloadxen-e5c3d644cdb161cfbbaab4230f3c4f0052b0e5b3.tar.gz
xen-e5c3d644cdb161cfbbaab4230f3c4f0052b0e5b3.tar.bz2
xen-e5c3d644cdb161cfbbaab4230f3c4f0052b0e5b3.zip
The attached patch implements more of the Xen-API functionality related
to the vTPM. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Diffstat (limited to 'tools/python/scripts')
-rw-r--r--tools/python/scripts/xapi.domcfg.py2
-rw-r--r--tools/python/scripts/xapi.py33
-rw-r--r--tools/python/scripts/xapi.vtpmcfg.py3
3 files changed, 34 insertions, 4 deletions
diff --git a/tools/python/scripts/xapi.domcfg.py b/tools/python/scripts/xapi.domcfg.py
index 70c009cbfb..8565bd8975 100644
--- a/tools/python/scripts/xapi.domcfg.py
+++ b/tools/python/scripts/xapi.domcfg.py
@@ -20,8 +20,6 @@ actions_after_shutdown = 'destroy'
actions_after_reboot = 'restart'
actions_after_suspend = 'destroy'
actions_after_crash = 'restart'
-TPM_instance = ''
-TPM_backend = ''
bios_boot = ''
platform_std_VGA = False
platform_serial = ''
diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py
index 7801030557..8dc7a4012f 100644
--- a/tools/python/scripts/xapi.py
+++ b/tools/python/scripts/xapi.py
@@ -42,6 +42,7 @@ COMMANDS = {
'vdi-rename': ('<vdi_uuid> <new_name>', 'Rename VDI'),
'vdi-delete': ('<vdi_uuid>', 'Delete VDI'),
'vif-create': ('<domname> <pycfg>', 'Create VIF attached to domname'),
+ 'vtpm-create' : ('<domname> <pycfg>', 'Create VTPM attached to domname'),
'vm-create': ('<pycfg>', 'Create VM with python config'),
'vm-destroy': ('<domname>', 'Delete VM'),
@@ -208,16 +209,22 @@ def xapi_vm_list(*args):
if is_long:
vbds = vm_info['vbds']
vifs = vm_info['vifs']
+ vtpms = vm_info['vtpms']
vif_infos = []
vbd_infos = []
+ vtpm_infos = []
for vbd in vbds:
vbd_info = execute(server.VBD.get_record, session, vbd)
vbd_infos.append(vbd_info)
for vif in vifs:
vif_info = execute(server.VIF.get_record, session, vif)
vif_infos.append(vif_info)
+ for vtpm in vtpms:
+ vtpm_info = execute(server.VTPM.get_record, session, vtpm)
+ vtpm_infos.append(vtpm_info)
vm_info['vbds'] = vbd_infos
vm_info['vifs'] = vif_infos
+ vm_info['vtpms'] = vtpm_infos
pprint(vm_info)
else:
print VM_LIST_FORMAT % _stringify(vm_info)
@@ -377,8 +384,30 @@ def xapi_vdi_rename(*args):
print 'Renaming VDI %s to %s' % (vdi_uuid, vdi_name)
result = execute(server.VDI.set_name_label, session, vdi_uuid, vdi_name)
print 'Done.'
-
-
+
+
+def xapi_vtpm_create(*args):
+ server, session = _connect()
+ domname = args[0]
+ cfg = _read_python_cfg(args[1])
+
+ vm_uuid = resolve_vm(server, session, domname)
+ cfg['VM'] = vm_uuid
+ print "Creating vTPM with cfg = %s" % cfg
+ vtpm_uuid = execute(server.VTPM.create, session, cfg)
+ print "Done. (%s)" % vtpm_uuid
+ vtpm_id = execute(server.VTPM.get_instance, session, vtpm_uuid)
+ print "Has instance number '%s'" % vtpm_id
+ vtpm_be = execute(server.VTPM.get_backend, session, vtpm_uuid)
+ print "Has backend in '%s'" % vtpm_be
+ driver = execute(server.VTPM.get_driver, session, vtpm_uuid)
+ print "Has driver type '%s'" % driver
+ vtpm_rec = execute(server.VTPM.get_record, session, vtpm_uuid)
+ print "Has vtpm record '%s'" % vtpm_rec
+ vm = execute(server.VTPM.get_VM, session, vtpm_uuid)
+ print "Has VM '%s'" % vm
+
+
#
# Command Line Utils
#
diff --git a/tools/python/scripts/xapi.vtpmcfg.py b/tools/python/scripts/xapi.vtpmcfg.py
new file mode 100644
index 0000000000..7c419baa26
--- /dev/null
+++ b/tools/python/scripts/xapi.vtpmcfg.py
@@ -0,0 +1,3 @@
+type = 'paravirtualised'
+backend = 'Domain-0'
+instance = 1