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] Added host.API_version_{major, minor, ve

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Added host.API_version_{major, minor, vendor, vendor_implementation} fields.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 26 Feb 2007 03:50:27 -0800
Delivery-date: Mon, 26 Feb 2007 04:42:41 -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 Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1172424051 0
# Node ID f3aa6e34aeb14b7ed5907adc7e0571d3a2171913
# Parent  fd7f23e44b1163c943b725232d3647d2d7567d73
Added host.API_version_{major,minor,vendor,vendor_implementation} fields.

Fix missing host.other_config from the record returned by Xend.

Improve the error diagnosis when we catch TypeError.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex       |  132 ++++++++++++++++++++++++++++++++
 tools/libxen/include/xen_host.h         |   32 +++++++
 tools/libxen/src/xen_host.c             |   80 +++++++++++++++++++
 tools/python/xen/xend/XendAPI.py        |   49 ++++++++---
 tools/python/xen/xend/XendAPIVersion.py |   22 +++++
 5 files changed, 301 insertions(+), 14 deletions(-)

diff -r fd7f23e44b11 -r f3aa6e34aeb1 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Wed Feb 21 23:03:00 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 17:20:51 2007 +0000
@@ -4422,6 +4422,10 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object 
reference \\
 $\mathit{RW}$ &  {\tt name/label} & string & a human-readable name \\
 $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg 
human-readable description \\
+$\mathit{RO}_\mathit{run}$ &  {\tt API\_version/major} & int & major version 
number \\
+$\mathit{RO}_\mathit{run}$ &  {\tt API\_version/minor} & int & minor version 
number \\
+$\mathit{RO}_\mathit{run}$ &  {\tt API\_version/vendor} & string & 
identification of vendor \\
+$\mathit{RO}_\mathit{run}$ &  {\tt API\_version/vendor\_implementation} & 
(string $\rightarrow$ string) Map & details of vendor implementation \\
 $\mathit{RO}_\mathit{run}$ &  {\tt software\_version} & (string $\rightarrow$ 
string) Map & version strings \\
 $\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & 
additional configuration \\
 $\mathit{RO}_\mathit{run}$ &  {\tt supported\_bootloaders} & string Set & a 
list of the bootloaders installed on the machine \\
@@ -4781,6 +4785,134 @@ void
 
 
 
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_API\_version\_major}
+
+{\bf Overview:} 
+Get the API\_version/major field of the given host.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_API_version_major (session_id s, host 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 host ref } & self & reference to the object \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_API\_version\_minor}
+
+{\bf Overview:} 
+Get the API\_version/minor field of the given host.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_API_version_minor (session_id s, host 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 host ref } & self & reference to the object \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_API\_version\_vendor}
+
+{\bf Overview:} 
+Get the API\_version/vendor field of the given host.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} string get_API_version_vendor (session_id s, host 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 host ref } & self & reference to the object \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+string
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_API\_version\_vendor\_implementation}
+
+{\bf Overview:} 
+Get the API\_version/vendor\_implementation field of the given host.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} ((string -> string) Map) 
get_API_version_vendor_implementation (session_id s, host 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 host 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}
diff -r fd7f23e44b11 -r f3aa6e34aeb1 tools/libxen/include/xen_host.h
--- a/tools/libxen/include/xen_host.h   Wed Feb 21 23:03:00 2007 +0000
+++ b/tools/libxen/include/xen_host.h   Sun Feb 25 17:20:51 2007 +0000
@@ -72,6 +72,10 @@ typedef struct xen_host_record
     char *uuid;
     char *name_label;
     char *name_description;
+    int64_t api_version_major;
+    int64_t api_version_minor;
+    char *api_version_vendor;
+    xen_string_string_map *api_version_vendor_implementation;
     xen_string_string_map *software_version;
     xen_string_string_map *other_config;
     struct xen_string_set *supported_bootloaders;
@@ -207,6 +211,34 @@ xen_host_get_name_description(xen_sessio
 
 
 /**
+ * Get the API_version/major field of the given host.
+ */
+extern bool
+xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host 
host);
+
+
+/**
+ * Get the API_version/minor field of the given host.
+ */
+extern bool
+xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host 
host);
+
+
+/**
+ * Get the API_version/vendor field of the given host.
+ */
+extern bool
+xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host 
host);
+
+
+/**
+ * Get the API_version/vendor_implementation field of the given host.
+ */
+extern bool
+xen_host_get_api_version_vendor_implementation(xen_session *session, 
xen_string_string_map **result, xen_host host);
+
+
+/**
  * Get the software_version field of the given host.
  */
 extern bool
diff -r fd7f23e44b11 -r f3aa6e34aeb1 tools/libxen/src/xen_host.c
--- a/tools/libxen/src/xen_host.c       Wed Feb 21 23:03:00 2007 +0000
+++ b/tools/libxen/src/xen_host.c       Sun Feb 25 17:20:51 2007 +0000
@@ -52,6 +52,18 @@ static const struct_member xen_host_reco
         { .key = "name_description",
           .type = &abstract_type_string,
           .offset = offsetof(xen_host_record, name_description) },
+        { .key = "API_version_major",
+          .type = &abstract_type_int,
+          .offset = offsetof(xen_host_record, api_version_major) },
+        { .key = "API_version_minor",
+          .type = &abstract_type_int,
+          .offset = offsetof(xen_host_record, api_version_minor) },
+        { .key = "API_version_vendor",
+          .type = &abstract_type_string,
+          .offset = offsetof(xen_host_record, api_version_vendor) },
+        { .key = "API_version_vendor_implementation",
+          .type = &abstract_type_string_string_map,
+          .offset = offsetof(xen_host_record, 
api_version_vendor_implementation) },
         { .key = "software_version",
           .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_host_record, software_version) },
@@ -108,6 +120,8 @@ xen_host_record_free(xen_host_record *re
     free(record->uuid);
     free(record->name_label);
     free(record->name_description);
+    free(record->api_version_vendor);
+    xen_string_string_map_free(record->api_version_vendor_implementation);
     xen_string_string_map_free(record->software_version);
     xen_string_string_map_free(record->other_config);
     xen_string_set_free(record->supported_bootloaders);
@@ -215,6 +229,72 @@ xen_host_get_name_description(xen_sessio
 
 
 bool
+xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host 
host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    abstract_type result_type = abstract_type_int;
+
+    XEN_CALL_("host.get_API_version_major");
+    return session->ok;
+}
+
+
+bool
+xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host 
host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    abstract_type result_type = abstract_type_int;
+
+    XEN_CALL_("host.get_API_version_minor");
+    return session->ok;
+}
+
+
+bool
+xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host 
host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    abstract_type result_type = abstract_type_string;
+
+    *result = NULL;
+    XEN_CALL_("host.get_API_version_vendor");
+    return session->ok;
+}
+
+
+bool
+xen_host_get_api_version_vendor_implementation(xen_session *session, 
xen_string_string_map **result, xen_host host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    abstract_type result_type = abstract_type_string_string_map;
+
+    *result = NULL;
+    XEN_CALL_("host.get_API_version_vendor_implementation");
+    return session->ok;
+}
+
+
+bool
 xen_host_get_software_version(xen_session *session, xen_string_string_map 
**result, xen_host host)
 {
     abstract_value param_values[] =
diff -r fd7f23e44b11 -r f3aa6e34aeb1 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Wed Feb 21 23:03:00 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sun Feb 25 17:20:51 2007 +0000
@@ -25,6 +25,7 @@ from xen.xend import XendDomain, XendDom
 from xen.xend import XendDomain, XendDomainInfo, XendNode, XendDmesg
 from xen.xend import XendLogging, XendTaskManager
 
+from xen.xend.XendAPIVersion import *
 from xen.xend.XendAuthSessions import instance as auth_manager
 from xen.xend.XendError import *
 from xen.xend.XendClient import ERROR_INVALID_DOMAIN
@@ -104,20 +105,22 @@ def catch_typeerror(func):
         except TypeError, exn:
             #log.exception('catch_typeerror')
             if hasattr(func, 'api') and func.api in argcounts:
-                # Assume that if the exception was thrown inside this
-                # file, then it is due to an invalid call from the client,
-                # but if it was thrown elsewhere, then it's an internal
+                # Assume that if the argument count was wrong and if the
+                # exception was thrown inside this file, then it is due to an
+                # invalid call from the client, otherwise it's an internal
                 # error (which will be handled further up).
-                tb = sys.exc_info()[2]
-                try:
-                    sourcefile = traceback.extract_tb(tb)[-1][0]
-                    if sourcefile == inspect.getsourcefile(XendAPI):
-                        return xen_api_error(
-                            ['MESSAGE_PARAMETER_COUNT_MISMATCH',
-                             func.api, argcounts[func.api],
-                             len(args) + len(kwargs)])
-                finally:
-                    del tb
+                expected = argcounts[func.api]
+                actual = len(args) + len(kwargs)
+                if expected != actual:
+                    tb = sys.exc_info()[2]
+                    try:
+                        sourcefile = traceback.extract_tb(tb)[-1][0]
+                        if sourcefile == inspect.getsourcefile(XendAPI):
+                            return xen_api_error(
+                                ['MESSAGE_PARAMETER_COUNT_MISMATCH',
+                                 func.api, expected, actual])
+                    finally:
+                        del tb
             raise
 
     return f
@@ -627,7 +630,11 @@ class XendAPI(object):
                     'resident_VMs',
                     'host_CPUs',
                     'metrics',
-                    'supported_bootloaders']
+                    'supported_bootloaders',
+                    'API_version_major',
+                    'API_version_minor',
+                    'API_version_vendor',
+                    'API_version_vendor_implementation']
     
     host_attr_rw = ['name_label',
                     'name_description',
@@ -671,6 +678,14 @@ class XendAPI(object):
         del node.other_config[key]
         node.save()
         return xen_api_success_void()
+    def host_get_API_version_major(self, _, ref):
+        return xen_api_success(XEN_API_VERSION_MAJOR)
+    def host_get_API_version_minor(self, _, ref):
+        return xen_api_success(XEN_API_VERSION_MINOR)
+    def host_get_API_version_vendor(self, _, ref):
+        return xen_api_success(XEN_API_VERSION_VENDOR)
+    def host_get_API_version_vendor_implementation(self, _, ref):
+        return xen_api_success(XEN_API_VERSION_VENDOR_IMPLEMENTATION)
     def host_get_software_version(self, session, host_ref):
         return xen_api_success(XendNode.instance().xen_version())
     def host_get_resident_VMs(self, session, host_ref):
@@ -707,7 +722,13 @@ class XendAPI(object):
         record = {'uuid': node.uuid,
                   'name_label': node.name,
                   'name_description': '',
+                  'API_version_major': XEN_API_VERSION_MAJOR,
+                  'API_version_minor': XEN_API_VERSION_MINOR,
+                  'API_version_vendor': XEN_API_VERSION_VENDOR,
+                  'API_version_vendor_implemention':
+                  XEN_API_VERSION_VENDOR_IMPLEMENTATION,
                   'software_version': node.xen_version(),
+                  'other_config': node.other_config,
                   'resident_VMs': dom.get_domain_refs(),
                   'host_CPUs': node.get_host_cpu_refs(),
                   'metrics': node.host_metrics_uuid,
diff -r fd7f23e44b11 -r f3aa6e34aeb1 tools/python/xen/xend/XendAPIVersion.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/python/xen/xend/XendAPIVersion.py   Sun Feb 25 17:20:51 2007 +0000
@@ -0,0 +1,22 @@
+#============================================================================
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#============================================================================
+# Copyright (c) 2007 XenSource Inc.
+#============================================================================
+
+
+XEN_API_VERSION_MAJOR = 0
+XEN_API_VERSION_MINOR = 5
+XEN_API_VERSION_VENDOR = 'xenbits'
+XEN_API_VERSION_VENDOR_IMPLEMENTATION = {}

_______________________________________________
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] Added host.API_version_{major, minor, vendor, vendor_implementation} fields., Xen patchbot-unstable <=