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] [vTPM] Add set/get_other_config to Xen-AP

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [vTPM] Add set/get_other_config to Xen-API.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 11 Oct 2007 14:30:12 -0700
Delivery-date: Thu, 11 Oct 2007 14:30:38 -0700
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 Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1192092076 -3600
# Node ID 51f521303df7c85a7e67a6f543e388530f40b552
# Parent  960a05895a4ac0e9b2e93281b8de57dca568f08a
[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@xxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex       |   67 ++++++++++++++++++++++++++++++++
 tools/libxen/include/xen/api/xen_vtpm.h |   19 +++++++++
 tools/libxen/src/xen_vtpm.c             |   41 +++++++++++++++++++
 tools/python/xen/xend/XendAPI.py        |   16 +++++++
 tools/python/xen/xend/XendConfig.py     |    1 
 tools/python/xen/xend/server/tpmif.py   |   14 ++++++
 6 files changed, 156 insertions(+), 2 deletions(-)

diff -r 960a05895a4a -r 51f521303df7 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Thu Oct 11 08:14:11 2007 +0100
+++ b/docs/xen-api/xenapi-datamodel.tex Thu Oct 11 09:41:16 2007 +0100
@@ -13563,6 +13563,7 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object 
reference \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt VM} & VM ref & the virtual machine \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt backend} & VM ref & the domain where the 
backend is located \\
+$\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & 
additional configuration \\
 \hline
 \end{longtable}
 \subsection{RPCs associated with class: VTPM}
@@ -13659,6 +13660,72 @@ VM ref
 
 
 value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_other\_config}
+
+{\bf Overview:}
+Get the other\_config field of the given VTPM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, VTPM 
ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VTPM ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_other\_config}
+
+{\bf Overview:}
+Set the other\_config field of the given VTPM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_other_config (session_id s, VTPM ref self, (string 
-> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VTPM ref } & self & reference to the object \\ \hline
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
diff -r 960a05895a4a -r 51f521303df7 tools/libxen/include/xen/api/xen_vtpm.h
--- a/tools/libxen/include/xen/api/xen_vtpm.h   Thu Oct 11 08:14:11 2007 +0100
+++ b/tools/libxen/include/xen/api/xen_vtpm.h   Thu Oct 11 09:41:16 2007 +0100
@@ -66,6 +66,7 @@ typedef struct xen_vtpm_record
     char *uuid;
     struct xen_vm_record_opt *vm;
     struct xen_vm_record_opt *backend;
+    xen_string_string_map *other_config;
 } xen_vtpm_record;
 
 /**
@@ -196,4 +197,22 @@ xen_vtpm_get_backend(xen_session *sessio
 xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
 
 
+/**
+ * Get the other_config field of the given VTPM.
+ */
+extern bool
+xen_vtpm_get_other_config(xen_session *session,
+                          xen_string_string_map **result,
+                          xen_vtpm vtpm);
+
+
+/**
+ * Set the other_config field of the given VTPM.
+ */
+extern bool
+xen_vtpm_set_other_config(xen_session *session,
+                          xen_vtpm vtpm,
+                          xen_string_string_map *other_config);
+
+
 #endif
diff -r 960a05895a4a -r 51f521303df7 tools/libxen/src/xen_vtpm.c
--- a/tools/libxen/src/xen_vtpm.c       Thu Oct 11 08:14:11 2007 +0100
+++ b/tools/libxen/src/xen_vtpm.c       Thu Oct 11 09:41:16 2007 +0100
@@ -46,7 +46,10 @@ static const struct_member xen_vtpm_reco
           .offset = offsetof(xen_vtpm_record, vm) },
         { .key = "backend",
           .type = &abstract_type_ref,
-          .offset = offsetof(xen_vtpm_record, backend) }
+          .offset = offsetof(xen_vtpm_record, backend) },
+        { .key = "other_config",
+          .type = &abstract_type_string_string_map,
+          .offset = offsetof(xen_vtpm_record, other_config) }
     };
 
 const abstract_type xen_vtpm_record_abstract_type_ =
@@ -70,6 +73,7 @@ xen_vtpm_record_free(xen_vtpm_record *re
     free(record->uuid);
     xen_vm_record_opt_free(record->vm);
     xen_vm_record_opt_free(record->backend);
+    xen_string_string_map_free(record->other_config);
     free(record);
 }
 
@@ -194,3 +198,38 @@ xen_vtpm_get_uuid(xen_session *session, 
     XEN_CALL_("VTPM.get_uuid");
     return session->ok;
 }
+
+
+bool
+xen_vtpm_get_other_config(xen_session *session, xen_string_string_map **result,
+                          xen_vtpm vtpm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vtpm }
+        };
+
+    abstract_type result_type = abstract_type_string_string_map;
+
+    *result = NULL;
+    XEN_CALL_("VTPM.get_other_config");
+    return session->ok;
+}
+
+
+bool
+xen_vtpm_set_other_config(xen_session *session, xen_vtpm vtpm,
+                          xen_string_string_map *other_config)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vtpm },
+            { .type = &abstract_type_string_string_map,
+              .u.set_val = (arbitrary_set *)other_config }
+        };
+
+    xen_call_(session, "VTPM.set_other_config", param_values, 2, NULL, NULL);
+    return session->ok;
+}
diff -r 960a05895a4a -r 51f521303df7 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Oct 11 08:14:11 2007 +0100
+++ b/tools/python/xen/xend/XendAPI.py  Thu Oct 11 09:41:16 2007 +0100
@@ -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):
diff -r 960a05895a4a -r 51f521303df7 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Oct 11 08:14:11 2007 +0100
+++ b/tools/python/xen/xend/XendConfig.py       Thu Oct 11 09:41:16 2007 +0100
@@ -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)
 
diff -r 960a05895a4a -r 51f521303df7 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py     Thu Oct 11 08:14:11 2007 +0100
+++ b/tools/python/xen/xend/server/tpmif.py     Thu Oct 11 09:41:16 2007 +0100
@@ -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)
@@ -83,6 +90,13 @@ class TPMifController(DevController):
             result['uuid'] = uuid
         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
 

_______________________________________________
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] [vTPM] Add set/get_other_config to Xen-API., Xen patchbot-unstable <=