ia64/xen-unstable
changeset 14124:36702d9b2c5c
Added host.capabilities field.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Sun Feb 25 23:37:05 2007 +0000 (2007-02-25) |
parents | e71b277f1533 |
children | 48d581be85ea |
files | docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_host.h tools/libxen/src/xen_host.c tools/libxen/test/test_bindings.c tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendNode.py |
line diff
1.1 --- a/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 23:17:14 2007 +0000 1.2 +++ b/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 23:37:05 2007 +0000 1.3 @@ -4806,6 +4806,7 @@ Quals & Field & Type & Description \\ 1.4 $\mathit{RO}_\mathit{run}$ & {\tt API\_version/vendor\_implementation} & (string $\rightarrow$ string) Map & details of vendor implementation \\ 1.5 $\mathit{RO}_\mathit{run}$ & {\tt software\_version} & (string $\rightarrow$ string) Map & version strings \\ 1.6 $\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ 1.7 +$\mathit{RO}_\mathit{run}$ & {\tt capabilities} & string Set & Xen capabilities \\ 1.8 $\mathit{RO}_\mathit{run}$ & {\tt supported\_bootloaders} & string Set & a list of the bootloaders installed on the machine \\ 1.9 $\mathit{RO}_\mathit{run}$ & {\tt resident\_VMs} & (VM ref) Set & list of VMs currently resident on host \\ 1.10 $\mathit{RW}$ & {\tt logging} & (string $\rightarrow$ string) Map & logging configuration \\ 1.11 @@ -5463,6 +5464,38 @@ void 1.12 \vspace{0.3cm} 1.13 \vspace{0.3cm} 1.14 \vspace{0.3cm} 1.15 +\subsubsection{RPC name:~get\_capabilities} 1.16 + 1.17 +{\bf Overview:} 1.18 +Get the capabilities field of the given host. 1.19 + 1.20 + \noindent {\bf Signature:} 1.21 +\begin{verbatim} (string Set) get_capabilities (session_id s, host ref self)\end{verbatim} 1.22 + 1.23 + 1.24 +\noindent{\bf Arguments:} 1.25 + 1.26 + 1.27 +\vspace{0.3cm} 1.28 +\begin{tabular}{|c|c|p{7cm}|} 1.29 + \hline 1.30 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.31 +{\tt host ref } & self & reference to the object \\ \hline 1.32 + 1.33 +\end{tabular} 1.34 + 1.35 +\vspace{0.3cm} 1.36 + 1.37 + \noindent {\bf Return Type:} 1.38 +{\tt 1.39 +string Set 1.40 +} 1.41 + 1.42 + 1.43 +value of the field 1.44 +\vspace{0.3cm} 1.45 +\vspace{0.3cm} 1.46 +\vspace{0.3cm} 1.47 \subsubsection{RPC name:~get\_supported\_bootloaders} 1.48 1.49 {\bf Overview:}
2.1 --- a/tools/libxen/include/xen_host.h Sun Feb 25 23:17:14 2007 +0000 2.2 +++ b/tools/libxen/include/xen_host.h Sun Feb 25 23:37:05 2007 +0000 2.3 @@ -78,6 +78,7 @@ typedef struct xen_host_record 2.4 xen_string_string_map *api_version_vendor_implementation; 2.5 xen_string_string_map *software_version; 2.6 xen_string_string_map *other_config; 2.7 + struct xen_string_set *capabilities; 2.8 struct xen_string_set *supported_bootloaders; 2.9 struct xen_vm_record_opt_set *resident_vms; 2.10 xen_string_string_map *logging; 2.11 @@ -253,6 +254,13 @@ xen_host_get_other_config(xen_session *s 2.12 2.13 2.14 /** 2.15 + * Get the capabilities field of the given host. 2.16 + */ 2.17 +extern bool 2.18 +xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host); 2.19 + 2.20 + 2.21 +/** 2.22 * Get the supported_bootloaders field of the given host. 2.23 */ 2.24 extern bool
3.1 --- a/tools/libxen/src/xen_host.c Sun Feb 25 23:17:14 2007 +0000 3.2 +++ b/tools/libxen/src/xen_host.c Sun Feb 25 23:37:05 2007 +0000 3.3 @@ -70,6 +70,9 @@ static const struct_member xen_host_reco 3.4 { .key = "other_config", 3.5 .type = &abstract_type_string_string_map, 3.6 .offset = offsetof(xen_host_record, other_config) }, 3.7 + { .key = "capabilities", 3.8 + .type = &abstract_type_string_set, 3.9 + .offset = offsetof(xen_host_record, capabilities) }, 3.10 { .key = "supported_bootloaders", 3.11 .type = &abstract_type_string_set, 3.12 .offset = offsetof(xen_host_record, supported_bootloaders) }, 3.13 @@ -124,6 +127,7 @@ xen_host_record_free(xen_host_record *re 3.14 xen_string_string_map_free(record->api_version_vendor_implementation); 3.15 xen_string_string_map_free(record->software_version); 3.16 xen_string_string_map_free(record->other_config); 3.17 + xen_string_set_free(record->capabilities); 3.18 xen_string_set_free(record->supported_bootloaders); 3.19 xen_vm_record_opt_set_free(record->resident_vms); 3.20 xen_string_string_map_free(record->logging); 3.21 @@ -329,6 +333,23 @@ xen_host_get_other_config(xen_session *s 3.22 3.23 3.24 bool 3.25 +xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host) 3.26 +{ 3.27 + abstract_value param_values[] = 3.28 + { 3.29 + { .type = &abstract_type_string, 3.30 + .u.string_val = host } 3.31 + }; 3.32 + 3.33 + abstract_type result_type = abstract_type_string_set; 3.34 + 3.35 + *result = NULL; 3.36 + XEN_CALL_("host.get_capabilities"); 3.37 + return session->ok; 3.38 +} 3.39 + 3.40 + 3.41 +bool 3.42 xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host) 3.43 { 3.44 abstract_value param_values[] =
4.1 --- a/tools/libxen/test/test_bindings.c Sun Feb 25 23:17:14 2007 +0000 4.2 +++ b/tools/libxen/test/test_bindings.c Sun Feb 25 23:37:05 2007 +0000 4.3 @@ -238,6 +238,22 @@ int main(int argc, char **argv) 4.4 return 1; 4.5 } 4.6 4.7 + xen_string_set *capabilities; 4.8 + if (!xen_host_get_capabilities(session, &capabilities, host)) 4.9 + { 4.10 + print_error(session); 4.11 + free(dmesg); 4.12 + xen_string_set_free(supported_bootloaders); 4.13 + xen_string_string_map_free(versions); 4.14 + xen_host_free(host); 4.15 + xen_vm_record_free(vm_record); 4.16 + xen_uuid_bytes_free(vm_uuid_bytes); 4.17 + xen_uuid_free(vm_uuid); 4.18 + xen_vm_free(vm); 4.19 + CLEANUP; 4.20 + return 1; 4.21 + } 4.22 + 4.23 printf("%s.\n", vm_uuid); 4.24 4.25 fprintf(stderr, "In bytes, the VM UUID is "); 4.26 @@ -264,6 +280,13 @@ int main(int argc, char **argv) 4.27 } 4.28 printf("\n"); 4.29 4.30 + printf("Host has the following capabilities:"); 4.31 + for (size_t i = 0; i < capabilities->size; i++) 4.32 + { 4.33 + printf(" %s", capabilities->contents[i]); 4.34 + } 4.35 + printf("\n"); 4.36 + 4.37 printf("%s.\n", vm_record->uuid); 4.38 4.39 printf("Resident on %s.\n", (char *)vm_record->resident_on->u.handle); 4.40 @@ -279,6 +302,7 @@ int main(int argc, char **argv) 4.41 xen_string_string_map_free(versions); 4.42 free(dmesg); 4.43 xen_string_set_free(supported_bootloaders); 4.44 + xen_string_set_free(capabilities); 4.45 4.46 print_vm_metrics(session, vm); 4.47 if (!session->ok)
5.1 --- a/tools/python/xen/xend/XendAPI.py Sun Feb 25 23:17:14 2007 +0000 5.2 +++ b/tools/python/xen/xend/XendAPI.py Sun Feb 25 23:37:05 2007 +0000 5.3 @@ -630,6 +630,7 @@ class XendAPI(object): 5.4 'resident_VMs', 5.5 'host_CPUs', 5.6 'metrics', 5.7 + 'capabilities', 5.8 'supported_bootloaders', 5.9 'API_version_major', 5.10 'API_version_minor', 5.11 @@ -694,6 +695,8 @@ class XendAPI(object): 5.12 return xen_api_success(XendNode.instance().get_host_cpu_refs()) 5.13 def host_get_metrics(self, _, ref): 5.14 return xen_api_success(XendNode.instance().host_metrics_uuid) 5.15 + def host_get_capabilities(self, session, host_ref): 5.16 + return xen_api_success(XendNode.instance().get_capabilities()) 5.17 def host_get_supported_bootloaders(self, session, host_ref): 5.18 return xen_api_success(['pygrub']) 5.19 5.20 @@ -732,6 +735,7 @@ class XendAPI(object): 5.21 'resident_VMs': dom.get_domain_refs(), 5.22 'host_CPUs': node.get_host_cpu_refs(), 5.23 'metrics': node.host_metrics_uuid, 5.24 + 'capabilities': node.get_capabilities(), 5.25 'supported_bootloaders': 'pygrub'} 5.26 return xen_api_success(record) 5.27
6.1 --- a/tools/python/xen/xend/XendNode.py Sun Feb 25 23:17:14 2007 +0000 6.2 +++ b/tools/python/xen/xend/XendNode.py Sun Feb 25 23:37:05 2007 +0000 6.3 @@ -353,6 +353,9 @@ class XendNode: 6.4 def get_uuid(self): 6.5 return self.uuid 6.6 6.7 + def get_capabilities(self): 6.8 + return self.xc.xeninfo()['xen_caps'].split(" ") 6.9 + 6.10 # 6.11 # Host CPU Functions 6.12 #