From: Ewan Mellor Date: Mon, 29 Jan 2007 12:11:13 +0000 (+0000) Subject: Rename VM.otherConfig to VM.other_config, for consistency with the other fields, X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15368^2~52 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=22309ac5669d3b97cba5571afe8398561b3fcde5;p=xen.git Rename VM.otherConfig to VM.other_config, for consistency with the other fields, and implement add_to_other_config and remove_from_other_config in the C bindings. Signed-off-by: Ewan Mellor --- diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex index 15c27e9c8d..821ba54685 100644 --- a/docs/xen-api/xenapi-datamodel.tex +++ b/docs/xen-api/xenapi-datamodel.tex @@ -1122,7 +1122,7 @@ $\mathit{RW}$ & {\tt platform/clock\_offset} & bool & timeshift applied to gues $\mathit{RW}$ & {\tt platform/enable\_audio} & bool & emulate audio \\ $\mathit{RO}_\mathit{ins}$ & {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\ $\mathit{RO}_\mathit{run}$ & {\tt tools\_version} & (string $\rightarrow$ string) Map & versions of installed paravirtualised drivers \\ -$\mathit{RW}$ & {\tt otherConfig} & (string $\rightarrow$ string) Map & additional configuration \\ +$\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ \hline \end{longtable} \subsection{Additional RPCs associated with class: VM} @@ -3895,13 +3895,13 @@ value of the field \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~get\_otherConfig} +\subsubsection{RPC name:~get\_other\_config} {\bf Overview:} -Get the otherConfig field of the given VM. +Get the other\_config field of the given VM. \noindent {\bf Signature:} -\begin{verbatim} ((string -> string) Map) get_otherConfig (session_id s, VM ref self)\end{verbatim} +\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, VM ref self)\end{verbatim} \noindent{\bf Arguments:} @@ -3927,13 +3927,13 @@ value of the field \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~set\_otherConfig} +\subsubsection{RPC name:~set\_other\_config} {\bf Overview:} -Set the otherConfig field of the given VM. +Set the other\_config field of the given VM. \noindent {\bf Signature:} -\begin{verbatim} void set_otherConfig (session_id s, VM ref self, (string -> string) Map value)\end{verbatim} +\begin{verbatim} void set_other_config (session_id s, VM ref self, (string -> string) Map value)\end{verbatim} \noindent{\bf Arguments:} @@ -3961,13 +3961,13 @@ void \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~add\_to\_otherConfig} +\subsubsection{RPC name:~add\_to\_other\_config} {\bf Overview:} -map add message derived from field otherConfig of object VM +Add the given key-value pair to the other\_config field of the given VM. \noindent {\bf Signature:} -\begin{verbatim} void add_to_otherConfig (session_id s, VM ref self, string key, string value)\end{verbatim} +\begin{verbatim} void add_to_other_config (session_id s, VM ref self, string key, string value)\end{verbatim} \noindent{\bf Arguments:} @@ -3997,13 +3997,14 @@ void \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~remove\_from\_otherConfig} +\subsubsection{RPC name:~remove\_from\_other\_config} {\bf Overview:} -map remove message derived from field otherConfig of object VM +Remove the given key and its corresponding value from the other\_config +field of the given VM. If the key is not in that Map, then do nothing. \noindent {\bf Signature:} -\begin{verbatim} void remove_from_otherConfig (session_id s, VM ref self, string key)\end{verbatim} +\begin{verbatim} void remove_from_other_config (session_id s, VM ref self, string key)\end{verbatim} \noindent{\bf Arguments:} diff --git a/tools/libxen/include/xen_vm.h b/tools/libxen/include/xen_vm.h index 5287be5873..22a967bb85 100644 --- a/tools/libxen/include/xen_vm.h +++ b/tools/libxen/include/xen_vm.h @@ -141,7 +141,7 @@ typedef struct xen_vm_record bool platform_enable_audio; char *pci_bus; xen_string_string_map *tools_version; - xen_string_string_map *otherconfig; + xen_string_string_map *other_config; } xen_vm_record; /** @@ -555,10 +555,10 @@ xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result, x /** - * Get the otherConfig field of the given VM. + * Get the other_config field of the given VM. */ extern bool -xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen_vm vm); +xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm); /** @@ -783,10 +783,27 @@ xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool enable_au /** - * Set the otherConfig field of the given VM. + * Set the other_config field of the given VM. */ extern bool -xen_vm_set_otherconfig(xen_session *session, xen_vm vm, xen_string_string_map *otherconfig); +xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config); + + +/** + * Add the given key-value pair to the other_config field of the given + * VM. + */ +extern bool +xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value); + + +/** + * Remove the given key and its corresponding value from the + * other_config field of the given VM. If the key is not in that Map, then do + * nothing. + */ +extern bool +xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key); /** diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c index 35cf104abf..08f4a6098e 100644 --- a/tools/libxen/src/xen_vm.c +++ b/tools/libxen/src/xen_vm.c @@ -174,9 +174,9 @@ static const struct_member xen_vm_record_struct_members[] = { .key = "tools_version", .type = &abstract_type_string_string_map, .offset = offsetof(xen_vm_record, tools_version) }, - { .key = "otherConfig", + { .key = "other_config", .type = &abstract_type_string_string_map, - .offset = offsetof(xen_vm_record, otherconfig) } + .offset = offsetof(xen_vm_record, other_config) } }; const abstract_type xen_vm_record_abstract_type_ = @@ -221,7 +221,7 @@ xen_vm_record_free(xen_vm_record *record) free(record->platform_serial); free(record->pci_bus); xen_string_string_map_free(record->tools_version); - xen_string_string_map_free(record->otherconfig); + xen_string_string_map_free(record->other_config); free(record); } @@ -989,7 +989,7 @@ xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result, x bool -xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen_vm vm) +xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm) { abstract_value param_values[] = { @@ -1000,7 +1000,7 @@ xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen abstract_type result_type = abstract_type_string_string_map; *result = NULL; - XEN_CALL_("VM.get_otherConfig"); + XEN_CALL_("VM.get_other_config"); return session->ok; } @@ -1502,17 +1502,51 @@ xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool enable_au bool -xen_vm_set_otherconfig(xen_session *session, xen_vm vm, xen_string_string_map *otherconfig) +xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config) { abstract_value param_values[] = { { .type = &abstract_type_string, .u.string_val = vm }, { .type = &abstract_type_string_string_map, - .u.set_val = (arbitrary_set *)otherconfig } + .u.set_val = (arbitrary_set *)other_config } }; - xen_call_(session, "VM.set_otherConfig", param_values, 2, NULL, NULL); + xen_call_(session, "VM.set_other_config", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &abstract_type_string, + .u.string_val = key }, + { .type = &abstract_type_string, + .u.string_val = value } + }; + + xen_call_(session, "VM.add_to_other_config", param_values, 3, NULL, NULL); + return session->ok; +} + + +bool +xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm }, + { .type = &abstract_type_string, + .u.string_val = key } + }; + + xen_call_(session, "VM.remove_from_other_config", param_values, 2, NULL, NULL); return session->ok; } diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index a24af6a687..98377d9396 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -868,7 +868,7 @@ class XendAPI(object): 'platform_clock_offset', 'platform_enable_audio', 'platform_keymap', - 'otherConfig'] + 'other_config'] VM_methods = [('clone', 'VM'), ('start', None), @@ -880,8 +880,8 @@ class XendAPI(object): ('hard_reboot', None), ('suspend', None), ('resume', None), - ('add_to_otherConfig', None), - ('remove_from_otherConfig', None)] + ('add_to_other_config', None), + ('remove_from_other_config', None)] VM_funcs = [('create', 'VM'), ('get_by_name_label', 'Set(VM)')] @@ -920,7 +920,7 @@ class XendAPI(object): 'platform_keymap', 'grub_cmdline', 'PCI_bus', - 'otherConfig'] + 'other_config'] def VM_get(self, name, session, vm_ref): return xen_api_success( @@ -1092,8 +1092,8 @@ class XendAPI(object): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) return xen_api_success(dom.get_platform_keymap()) - def VM_get_otherConfig(self, session, vm_ref): - return self.VM_get('otherConfig', session, vm_ref) + def VM_get_other_config(self, session, vm_ref): + return self.VM_get('otherconfig', session, vm_ref) def VM_set_name_label(self, session, vm_ref, label): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) @@ -1192,16 +1192,16 @@ class XendAPI(object): def VM_set_platform_enable_audio(self, session, vm_ref, value): return self.VM_set('platform_enable_audio', session, vm_ref, value) - def VM_set_otherConfig(self, session, vm_ref, value): + def VM_set_other_config(self, session, vm_ref, value): return self.VM_set('otherconfig', session, vm_ref, value) - def VM_add_to_otherConfig(self, session, vm_ref, key, value): + def VM_add_to_other_config(self, session, vm_ref, key, value): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) if dom and 'otherconfig' in dom.info: dom.info['otherconfig'][key] = value return xen_api_success_void() - def VM_remove_from_otherConfig(self, session, vm_ref, key): + def VM_remove_from_other_config(self, session, vm_ref, key): dom = XendDomain.instance().get_vm_by_uuid(vm_ref) if dom and 'otherconfig' in dom.info \ and key in dom.info['otherconfig']: @@ -1277,7 +1277,7 @@ class XendAPI(object): 'platform_keymap': xeninfo.get_platform_keymap(), 'PCI_bus': xeninfo.get_pci_bus(), 'tools_version': xeninfo.get_tools_version(), - 'otherConfig': xeninfo.info.get('otherconfig'), + 'other_config': xeninfo.info.get('otherconfig'), } return xen_api_success(record)