Rename VM.otherConfig to VM.other_config, for consistency with the other fields,
authorEwan Mellor <ewan@xensource.com>
Mon, 29 Jan 2007 12:11:13 +0000 (12:11 +0000)
committerEwan Mellor <ewan@xensource.com>
Mon, 29 Jan 2007 12:11:13 +0000 (12:11 +0000)
and implement add_to_other_config and remove_from_other_config in the C
bindings.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
docs/xen-api/xenapi-datamodel.tex
tools/libxen/include/xen_vm.h
tools/libxen/src/xen_vm.c
tools/python/xen/xend/XendAPI.py

index 15c27e9c8d9d423be61779bc3d591142e87a8816..821ba54685af551e69250f1a5efd66f989b48a10 100644 (file)
@@ -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:}
index 5287be58736c27b5ef9c8e23581f5d952de12dfe..22a967bb856a9dd8898b17f5b1b6cabb35251a03 100644 (file)
@@ -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);
 
 
 /**
index 35cf104abf90a2ec7081dfde96c99f06784b1133..08f4a6098e667363ed26490148fe610e856f1a0c 100644 (file)
@@ -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;
 }
 
index a24af6a6874e6e5af12bf3e30183b8c10111fd3e..98377d939628a5ca1885f0854a96da956efe48bb 100644 (file)
@@ -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)