direct-io.hg

changeset 13690:ae881e7b0c5e

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 <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Jan 29 12:11:13 2007 +0000 (2007-01-29)
parents bb15af2c2b4a
children 66dda30190a2
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_vm.h tools/libxen/src/xen_vm.c tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Mon Jan 29 00:05:40 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Mon Jan 29 12:11:13 2007 +0000
     1.3 @@ -1122,7 +1122,7 @@ Quals & Field & Type & Description \\
     1.4  $\mathit{RW}$ &  {\tt platform/enable\_audio} & bool & emulate audio \\
     1.5  $\mathit{RO}_\mathit{ins}$ &  {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\
     1.6  $\mathit{RO}_\mathit{run}$ &  {\tt tools\_version} & (string $\rightarrow$ string) Map & versions of installed paravirtualised drivers \\
     1.7 -$\mathit{RW}$ &  {\tt otherConfig} & (string $\rightarrow$ string) Map & additional configuration \\
     1.8 +$\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
     1.9  \hline
    1.10  \end{longtable}
    1.11  \subsection{Additional RPCs associated with class: VM}
    1.12 @@ -3895,13 +3895,13 @@ value of the field
    1.13  \vspace{0.3cm}
    1.14  \vspace{0.3cm}
    1.15  \vspace{0.3cm}
    1.16 -\subsubsection{RPC name:~get\_otherConfig}
    1.17 -
    1.18 -{\bf Overview:} 
    1.19 -Get the otherConfig field of the given VM.
    1.20 -
    1.21 - \noindent {\bf Signature:} 
    1.22 -\begin{verbatim} ((string -> string) Map) get_otherConfig (session_id s, VM ref self)\end{verbatim}
    1.23 +\subsubsection{RPC name:~get\_other\_config}
    1.24 +
    1.25 +{\bf Overview:} 
    1.26 +Get the other\_config field of the given VM.
    1.27 +
    1.28 + \noindent {\bf Signature:} 
    1.29 +\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, VM ref self)\end{verbatim}
    1.30  
    1.31  
    1.32  \noindent{\bf Arguments:}
    1.33 @@ -3927,13 +3927,13 @@ value of the field
    1.34  \vspace{0.3cm}
    1.35  \vspace{0.3cm}
    1.36  \vspace{0.3cm}
    1.37 -\subsubsection{RPC name:~set\_otherConfig}
    1.38 -
    1.39 -{\bf Overview:} 
    1.40 -Set the otherConfig field of the given VM.
    1.41 -
    1.42 - \noindent {\bf Signature:} 
    1.43 -\begin{verbatim} void set_otherConfig (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
    1.44 +\subsubsection{RPC name:~set\_other\_config}
    1.45 +
    1.46 +{\bf Overview:} 
    1.47 +Set the other\_config field of the given VM.
    1.48 +
    1.49 + \noindent {\bf Signature:} 
    1.50 +\begin{verbatim} void set_other_config (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
    1.51  
    1.52  
    1.53  \noindent{\bf Arguments:}
    1.54 @@ -3961,13 +3961,13 @@ void
    1.55  \vspace{0.3cm}
    1.56  \vspace{0.3cm}
    1.57  \vspace{0.3cm}
    1.58 -\subsubsection{RPC name:~add\_to\_otherConfig}
    1.59 -
    1.60 -{\bf Overview:} 
    1.61 -map add message derived from field otherConfig of object VM
    1.62 -
    1.63 - \noindent {\bf Signature:} 
    1.64 -\begin{verbatim} void add_to_otherConfig (session_id s, VM ref self, string key, string value)\end{verbatim}
    1.65 +\subsubsection{RPC name:~add\_to\_other\_config}
    1.66 +
    1.67 +{\bf Overview:} 
    1.68 +Add the given key-value pair to the other\_config field of the given VM.
    1.69 +
    1.70 + \noindent {\bf Signature:} 
    1.71 +\begin{verbatim} void add_to_other_config (session_id s, VM ref self, string key, string value)\end{verbatim}
    1.72  
    1.73  
    1.74  \noindent{\bf Arguments:}
    1.75 @@ -3997,13 +3997,14 @@ void
    1.76  \vspace{0.3cm}
    1.77  \vspace{0.3cm}
    1.78  \vspace{0.3cm}
    1.79 -\subsubsection{RPC name:~remove\_from\_otherConfig}
    1.80 -
    1.81 -{\bf Overview:} 
    1.82 -map remove message derived from field otherConfig of object VM
    1.83 -
    1.84 - \noindent {\bf Signature:} 
    1.85 -\begin{verbatim} void remove_from_otherConfig (session_id s, VM ref self, string key)\end{verbatim}
    1.86 +\subsubsection{RPC name:~remove\_from\_other\_config}
    1.87 +
    1.88 +{\bf Overview:} 
    1.89 +Remove the given key and its corresponding value from the other\_config
    1.90 +field of the given VM.  If the key is not in that Map, then do nothing.
    1.91 +
    1.92 + \noindent {\bf Signature:} 
    1.93 +\begin{verbatim} void remove_from_other_config (session_id s, VM ref self, string key)\end{verbatim}
    1.94  
    1.95  
    1.96  \noindent{\bf Arguments:}
     2.1 --- a/tools/libxen/include/xen_vm.h	Mon Jan 29 00:05:40 2007 +0000
     2.2 +++ b/tools/libxen/include/xen_vm.h	Mon Jan 29 12:11:13 2007 +0000
     2.3 @@ -141,7 +141,7 @@ typedef struct xen_vm_record
     2.4      bool platform_enable_audio;
     2.5      char *pci_bus;
     2.6      xen_string_string_map *tools_version;
     2.7 -    xen_string_string_map *otherconfig;
     2.8 +    xen_string_string_map *other_config;
     2.9  } xen_vm_record;
    2.10  
    2.11  /**
    2.12 @@ -555,10 +555,10 @@ xen_vm_get_tools_version(xen_session *se
    2.13  
    2.14  
    2.15  /**
    2.16 - * Get the otherConfig field of the given VM.
    2.17 + * Get the other_config field of the given VM.
    2.18   */
    2.19  extern bool
    2.20 -xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen_vm vm);
    2.21 +xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm);
    2.22  
    2.23  
    2.24  /**
    2.25 @@ -783,10 +783,27 @@ xen_vm_set_platform_enable_audio(xen_ses
    2.26  
    2.27  
    2.28  /**
    2.29 - * Set the otherConfig field of the given VM.
    2.30 + * Set the other_config field of the given VM.
    2.31 + */
    2.32 +extern bool
    2.33 +xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config);
    2.34 +
    2.35 +
    2.36 +/**
    2.37 + * Add the given key-value pair to the other_config field of the given
    2.38 + * VM.
    2.39   */
    2.40  extern bool
    2.41 -xen_vm_set_otherconfig(xen_session *session, xen_vm vm, xen_string_string_map *otherconfig);
    2.42 +xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value);
    2.43 +
    2.44 +
    2.45 +/**
    2.46 + * Remove the given key and its corresponding value from the
    2.47 + * other_config field of the given VM.  If the key is not in that Map, then do
    2.48 + * nothing.
    2.49 + */
    2.50 +extern bool
    2.51 +xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key);
    2.52  
    2.53  
    2.54  /**
     3.1 --- a/tools/libxen/src/xen_vm.c	Mon Jan 29 00:05:40 2007 +0000
     3.2 +++ b/tools/libxen/src/xen_vm.c	Mon Jan 29 12:11:13 2007 +0000
     3.3 @@ -174,9 +174,9 @@ static const struct_member xen_vm_record
     3.4          { .key = "tools_version",
     3.5            .type = &abstract_type_string_string_map,
     3.6            .offset = offsetof(xen_vm_record, tools_version) },
     3.7 -        { .key = "otherConfig",
     3.8 +        { .key = "other_config",
     3.9            .type = &abstract_type_string_string_map,
    3.10 -          .offset = offsetof(xen_vm_record, otherconfig) }
    3.11 +          .offset = offsetof(xen_vm_record, other_config) }
    3.12      };
    3.13  
    3.14  const abstract_type xen_vm_record_abstract_type_ =
    3.15 @@ -221,7 +221,7 @@ xen_vm_record_free(xen_vm_record *record
    3.16      free(record->platform_serial);
    3.17      free(record->pci_bus);
    3.18      xen_string_string_map_free(record->tools_version);
    3.19 -    xen_string_string_map_free(record->otherconfig);
    3.20 +    xen_string_string_map_free(record->other_config);
    3.21      free(record);
    3.22  }
    3.23  
    3.24 @@ -989,7 +989,7 @@ xen_vm_get_tools_version(xen_session *se
    3.25  
    3.26  
    3.27  bool
    3.28 -xen_vm_get_otherconfig(xen_session *session, xen_string_string_map **result, xen_vm vm)
    3.29 +xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm)
    3.30  {
    3.31      abstract_value param_values[] =
    3.32          {
    3.33 @@ -1000,7 +1000,7 @@ xen_vm_get_otherconfig(xen_session *sess
    3.34      abstract_type result_type = abstract_type_string_string_map;
    3.35  
    3.36      *result = NULL;
    3.37 -    XEN_CALL_("VM.get_otherConfig");
    3.38 +    XEN_CALL_("VM.get_other_config");
    3.39      return session->ok;
    3.40  }
    3.41  
    3.42 @@ -1502,17 +1502,51 @@ xen_vm_set_platform_enable_audio(xen_ses
    3.43  
    3.44  
    3.45  bool
    3.46 -xen_vm_set_otherconfig(xen_session *session, xen_vm vm, xen_string_string_map *otherconfig)
    3.47 +xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config)
    3.48  {
    3.49      abstract_value param_values[] =
    3.50          {
    3.51              { .type = &abstract_type_string,
    3.52                .u.string_val = vm },
    3.53              { .type = &abstract_type_string_string_map,
    3.54 -              .u.set_val = (arbitrary_set *)otherconfig }
    3.55 +              .u.set_val = (arbitrary_set *)other_config }
    3.56          };
    3.57  
    3.58 -    xen_call_(session, "VM.set_otherConfig", param_values, 2, NULL, NULL);
    3.59 +    xen_call_(session, "VM.set_other_config", param_values, 2, NULL, NULL);
    3.60 +    return session->ok;
    3.61 +}
    3.62 +
    3.63 +
    3.64 +bool
    3.65 +xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value)
    3.66 +{
    3.67 +    abstract_value param_values[] =
    3.68 +        {
    3.69 +            { .type = &abstract_type_string,
    3.70 +              .u.string_val = vm },
    3.71 +            { .type = &abstract_type_string,
    3.72 +              .u.string_val = key },
    3.73 +            { .type = &abstract_type_string,
    3.74 +              .u.string_val = value }
    3.75 +        };
    3.76 +
    3.77 +    xen_call_(session, "VM.add_to_other_config", param_values, 3, NULL, NULL);
    3.78 +    return session->ok;
    3.79 +}
    3.80 +
    3.81 +
    3.82 +bool
    3.83 +xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key)
    3.84 +{
    3.85 +    abstract_value param_values[] =
    3.86 +        {
    3.87 +            { .type = &abstract_type_string,
    3.88 +              .u.string_val = vm },
    3.89 +            { .type = &abstract_type_string,
    3.90 +              .u.string_val = key }
    3.91 +        };
    3.92 +
    3.93 +    xen_call_(session, "VM.remove_from_other_config", param_values, 2, NULL, NULL);
    3.94      return session->ok;
    3.95  }
    3.96  
     4.1 --- a/tools/python/xen/xend/XendAPI.py	Mon Jan 29 00:05:40 2007 +0000
     4.2 +++ b/tools/python/xen/xend/XendAPI.py	Mon Jan 29 12:11:13 2007 +0000
     4.3 @@ -868,7 +868,7 @@ class XendAPI(object):
     4.4                    'platform_clock_offset',
     4.5                    'platform_enable_audio',
     4.6                    'platform_keymap',
     4.7 -                  'otherConfig']
     4.8 +                  'other_config']
     4.9  
    4.10      VM_methods = [('clone', 'VM'),
    4.11                    ('start', None),
    4.12 @@ -880,8 +880,8 @@ class XendAPI(object):
    4.13                    ('hard_reboot', None),
    4.14                    ('suspend', None),
    4.15                    ('resume', None),
    4.16 -                  ('add_to_otherConfig', None),
    4.17 -                  ('remove_from_otherConfig', None)]
    4.18 +                  ('add_to_other_config', None),
    4.19 +                  ('remove_from_other_config', None)]
    4.20      
    4.21      VM_funcs  = [('create', 'VM'),
    4.22                   ('get_by_name_label', 'Set(VM)')]
    4.23 @@ -920,7 +920,7 @@ class XendAPI(object):
    4.24          'platform_keymap',
    4.25          'grub_cmdline',
    4.26          'PCI_bus',
    4.27 -        'otherConfig']
    4.28 +        'other_config']
    4.29          
    4.30      def VM_get(self, name, session, vm_ref):
    4.31          return xen_api_success(
    4.32 @@ -1092,8 +1092,8 @@ class XendAPI(object):
    4.33          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.34          return xen_api_success(dom.get_platform_keymap())
    4.35      
    4.36 -    def VM_get_otherConfig(self, session, vm_ref):
    4.37 -        return self.VM_get('otherConfig', session, vm_ref)        
    4.38 +    def VM_get_other_config(self, session, vm_ref):
    4.39 +        return self.VM_get('otherconfig', session, vm_ref)        
    4.40  
    4.41      def VM_set_name_label(self, session, vm_ref, label):
    4.42          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.43 @@ -1192,16 +1192,16 @@ class XendAPI(object):
    4.44      def VM_set_platform_enable_audio(self, session, vm_ref, value):
    4.45          return self.VM_set('platform_enable_audio', session, vm_ref, value)
    4.46      
    4.47 -    def VM_set_otherConfig(self, session, vm_ref, value):
    4.48 +    def VM_set_other_config(self, session, vm_ref, value):
    4.49          return self.VM_set('otherconfig', session, vm_ref, value)
    4.50  
    4.51 -    def VM_add_to_otherConfig(self, session, vm_ref, key, value):
    4.52 +    def VM_add_to_other_config(self, session, vm_ref, key, value):
    4.53          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.54          if dom and 'otherconfig' in dom.info:
    4.55              dom.info['otherconfig'][key] = value
    4.56          return xen_api_success_void()
    4.57  
    4.58 -    def VM_remove_from_otherConfig(self, session, vm_ref, key):
    4.59 +    def VM_remove_from_other_config(self, session, vm_ref, key):
    4.60          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.61          if dom and 'otherconfig' in dom.info \
    4.62                 and key in dom.info['otherconfig']:
    4.63 @@ -1277,7 +1277,7 @@ class XendAPI(object):
    4.64              'platform_keymap': xeninfo.get_platform_keymap(),
    4.65              'PCI_bus': xeninfo.get_pci_bus(),
    4.66              'tools_version': xeninfo.get_tools_version(),
    4.67 -            'otherConfig': xeninfo.info.get('otherconfig'),
    4.68 +            'other_config': xeninfo.info.get('otherconfig'),
    4.69          }
    4.70          return xen_api_success(record)
    4.71