mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
[vTPM] Add set/get_other_config to Xen-API.
Add get_- and set_other_config methods to the vTPM class. Write the parameters into the xenstore while the domain is running prefixing it with 'oc_'. Also I add the methods to the C library as well as the documentation. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
This commit is contained in:
1 parent
09fa4973a1
commit
1a55b4207e
6 files changed
+156
-2
No files matched your search
@@ -2270,7 +2270,7 @@ class XendAPI(object):
|
||||
# Xen API: Class VTPM
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
VTPM_attr_rw = [ ]
|
||||
VTPM_attr_rw = ['other_config']
|
||||
VTPM_attr_ro = ['VM',
|
||||
'backend',
|
||||
'runtime_properties' ]
|
||||
@@ -2279,6 +2279,20 @@ class XendAPI(object):
|
||||
|
||||
VTPM_methods = [('destroy', None)]
|
||||
VTPM_funcs = [('create', 'VTPM')]
|
||||
|
||||
def VTPM_get_other_config(self, session, vtpm_ref):
|
||||
xendom = XendDomain.instance()
|
||||
return xen_api_success(xendom.get_dev_property_by_uuid('vtpm',
|
||||
vtpm_ref,
|
||||
'other_config'))
|
||||
|
||||
def VTPM_set_other_config(self, session, vtpm_ref, other_config):
|
||||
xendom = XendDomain.instance()
|
||||
xendom.set_dev_property_by_uuid('vtpm',
|
||||
vtpm_ref,
|
||||
'other_config',
|
||||
other_config)
|
||||
return xen_api_success_void()
|
||||
|
||||
# object methods
|
||||
def VTPM_get_record(self, session, vtpm_ref):
|
||||
|
||||
@@ -1226,6 +1226,7 @@ class XendConfig(dict):
|
||||
if not dev_uuid:
|
||||
dev_uuid = uuid.createString()
|
||||
dev_info['uuid'] = dev_uuid
|
||||
dev_info['other_config'] = cfg_xenapi.get('other_config', {})
|
||||
target['devices'][dev_uuid] = (dev_type, dev_info)
|
||||
target['vtpm_refs'].append(dev_uuid)
|
||||
|
||||
|
||||
@@ -64,6 +64,13 @@ class TPMifController(DevController):
|
||||
if uuid:
|
||||
back['uuid'] = uuid
|
||||
|
||||
data = self.vm.info['devices'].get(uuid)
|
||||
if data:
|
||||
other = data[1].get('other_config')
|
||||
if type(other) == dict:
|
||||
for key, item in other.items():
|
||||
back['oc_' + key] = item
|
||||
|
||||
front = { 'handle' : "%i" % devid }
|
||||
|
||||
return (devid, back, front)
|
||||
@@ -84,6 +91,13 @@ class TPMifController(DevController):
|
||||
if type:
|
||||
result['type'] = type
|
||||
|
||||
if uuid:
|
||||
data = self.vm.info['devices'].get(uuid)
|
||||
if data:
|
||||
other = data[1].get('other_config')
|
||||
if other:
|
||||
result['other_config'] = other
|
||||
|
||||
return result
|
||||
|
||||
def migrate(self, deviceConfig, network, dst, step, domName):
|
||||
|
||||