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] Replace VM.platform_{std_VGA, serial, lo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Replace VM.platform_{std_VGA, serial, localtime, clock_offset, enable_audio} with
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Mar 2007 17:30:28 -0700
Delivery-date: Sun, 11 Mar 2007 17:30:58 -0700
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 1173563302 0
# Node ID 0affe03ee985ddad617d1f7b23828574cc89f324
# Parent  620212e48908b511203a1e8ad5a88a95ca0b60ac
Replace VM.platform_{std_VGA,serial,localtime,clock_offset,enable_audio} with
a single VM.platform String -> String Map.

Propogate this change through to XendDomainInfo and image so that the
backwards compatibility is handled by XendConfig.

Make PCI_bus a read-write field.

Added C bindings for these changes also.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex       |  383 +++++++++-----------------------
 tools/libxen/include/xen_vm.h           |  100 ++------
 tools/libxen/src/xen_vm.c               |  244 ++++++--------------
 tools/python/xen/xend/XendAPI.py        |  139 ++++-------
 tools/python/xen/xend/XendConfig.py     |  275 ++++++----------------
 tools/python/xen/xend/XendDomainInfo.py |   67 +----
 tools/python/xen/xend/image.py          |   54 ++--
 7 files changed, 393 insertions(+), 869 deletions(-)

diff -r 620212e48908 -r 0affe03ee985 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sat Mar 10 21:43:07 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sat Mar 10 21:48:22 2007 +0000
@@ -1058,12 +1058,8 @@ Quals & Field & Type & Description \\
 $\mathit{RW}$ &  {\tt PV/bootloader\_args} & string & miscellaneous arguments 
for the bootloader \\
 $\mathit{RW}$ &  {\tt HVM/boot\_policy} & string & HVM boot policy \\
 $\mathit{RW}$ &  {\tt HVM/boot\_params} & (string $\rightarrow$ string) Map & 
HVM boot params \\
-$\mathit{RW}$ &  {\tt platform/std\_VGA} & bool & emulate standard VGA instead 
of cirrus logic \\
-$\mathit{RW}$ &  {\tt platform/serial} & string & redirect serial port to pty 
\\
-$\mathit{RW}$ &  {\tt platform/localtime} & bool & set RTC to local time \\
-$\mathit{RW}$ &  {\tt platform/clock\_offset} & bool & timeshift applied to 
guest's clock \\
-$\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{RW}$ &  {\tt platform} & (string $\rightarrow$ string) Map & 
platform-specific configuration \\
+$\mathit{RW}$ &  {\tt PCI\_bus} & string & PCI bus path for pass-through 
devices \\
 $\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & 
additional configuration \\
 $\mathit{RO}_\mathit{run}$ &  {\tt domid} & int & domain ID (if available, -1 
otherwise) \\
 $\mathit{RO}_\mathit{run}$ &  {\tt is\_control\_domain} & bool & true if this 
is a control domain (domain 0 or a driver domain) \\
@@ -3407,13 +3403,13 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_platform\_std\_VGA}
-
-{\bf Overview:} 
-Get the platform/std\_VGA field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} bool get_platform_std_VGA (session_id s, VM ref 
self)\end{verbatim}
+\subsubsection{RPC name:~get\_platform}
+
+{\bf Overview:} 
+Get the platform field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} ((string -> string) Map) get_platform (session_id s, VM ref 
self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -3431,21 +3427,21 @@ Get the platform/std\_VGA field of the g
 
  \noindent {\bf Return Type:} 
 {\tt 
-bool
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_platform\_std\_VGA}
-
-{\bf Overview:} 
-Set the platform/std\_VGA field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_platform_std_VGA (session_id s, VM ref self, bool 
value)\end{verbatim}
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_platform}
+
+{\bf Overview:} 
+Set the platform field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_platform (session_id s, VM ref self, (string -> 
string) Map value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -3457,7 +3453,7 @@ Set the platform/std\_VGA field of the g
 {\bf type} & {\bf name} & {\bf description} \\ \hline
 {\tt VM ref } & self & reference to the object \\ \hline 
 
-{\tt bool } & value & New value to set \\ \hline 
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
 
 \end{tabular}
 
@@ -3473,13 +3469,13 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_platform\_serial}
-
-{\bf Overview:} 
-Get the platform/serial field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_platform_serial (session_id s, VM ref 
self)\end{verbatim}
+\subsubsection{RPC name:~add\_to\_platform}
+
+{\bf Overview:} 
+Add the given key-value pair to the platform field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void add_to_platform (session_id s, VM ref self, string key, 
string value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -3491,6 +3487,77 @@ Get the platform/serial field of the giv
 {\bf type} & {\bf name} & {\bf description} \\ \hline
 {\tt VM ref } & self & reference to the object \\ \hline 
 
+{\tt string } & key & Key to add \\ \hline 
+
+{\tt string } & value & Value to add \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_platform}
+
+{\bf Overview:} 
+Remove the given key and its corresponding value from the platform field of
+the given VM.  If the key is not in that Map, then do nothing.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void remove_from_platform (session_id s, VM ref self, string 
key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+ 
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline 
+
+{\tt string } & key & Key to remove \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_PCI\_bus}
+
+{\bf Overview:} 
+Get the PCI\_bus field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} string get_PCI_bus (session_id s, VM 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 VM ref } & self & reference to the object \\ \hline 
+
 \end{tabular}
 
 \vspace{0.3cm}
@@ -3505,13 +3572,13 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~set\_platform\_serial}
-
-{\bf Overview:} 
-Set the platform/serial field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_platform_serial (session_id s, VM ref self, string 
value)\end{verbatim}
+\subsubsection{RPC name:~set\_PCI\_bus}
+
+{\bf Overview:} 
+Set the PCI\_bus field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_PCI_bus (session_id s, VM ref self, string 
value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -3536,236 +3603,6 @@ void
 
 
 
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_platform\_localtime}
-
-{\bf Overview:} 
-Get the platform/localtime field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} bool get_platform_localtime (session_id s, VM 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 VM ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-bool
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_platform\_localtime}
-
-{\bf Overview:} 
-Set the platform/localtime field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_platform_localtime (session_id s, VM ref self, bool 
value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline 
-
-{\tt bool } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_platform\_clock\_offset}
-
-{\bf Overview:} 
-Get the platform/clock\_offset field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} bool get_platform_clock_offset (session_id s, VM 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 VM ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-bool
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_platform\_clock\_offset}
-
-{\bf Overview:} 
-Set the platform/clock\_offset field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_platform_clock_offset (session_id s, VM ref self, 
bool value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline 
-
-{\tt bool } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_platform\_enable\_audio}
-
-{\bf Overview:} 
-Get the platform/enable\_audio field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} bool get_platform_enable_audio (session_id s, VM 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 VM ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-bool
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_platform\_enable\_audio}
-
-{\bf Overview:} 
-Set the platform/enable\_audio field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_platform_enable_audio (session_id s, VM ref self, 
bool value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline 
-
-{\tt bool } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_PCI\_bus}
-
-{\bf Overview:} 
-Get the PCI\_bus field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_PCI_bus (session_id s, VM 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 VM 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}
diff -r 620212e48908 -r 0affe03ee985 tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h     Sat Mar 10 21:43:07 2007 +0000
+++ b/tools/libxen/include/xen_vm.h     Sat Mar 10 21:48:22 2007 +0000
@@ -106,11 +106,7 @@ typedef struct xen_vm_record
     char *pv_bootloader_args;
     char *hvm_boot_policy;
     xen_string_string_map *hvm_boot_params;
-    bool platform_std_vga;
-    char *platform_serial;
-    bool platform_localtime;
-    bool platform_clock_offset;
-    bool platform_enable_audio;
+    xen_string_string_map *platform;
     char *pci_bus;
     xen_string_string_map *other_config;
     int64_t domid;
@@ -460,38 +456,10 @@ xen_vm_get_hvm_boot_params(xen_session *
 
 
 /**
- * Get the platform/std_VGA field of the given VM.
- */
-extern bool
-xen_vm_get_platform_std_vga(xen_session *session, bool *result, xen_vm vm);
-
-
-/**
- * Get the platform/serial field of the given VM.
- */
-extern bool
-xen_vm_get_platform_serial(xen_session *session, char **result, xen_vm vm);
-
-
-/**
- * Get the platform/localtime field of the given VM.
- */
-extern bool
-xen_vm_get_platform_localtime(xen_session *session, bool *result, xen_vm vm);
-
-
-/**
- * Get the platform/clock_offset field of the given VM.
- */
-extern bool
-xen_vm_get_platform_clock_offset(xen_session *session, bool *result, xen_vm 
vm);
-
-
-/**
- * Get the platform/enable_audio field of the given VM.
- */
-extern bool
-xen_vm_get_platform_enable_audio(xen_session *session, bool *result, xen_vm 
vm);
+ * Get the platform field of the given VM.
+ */
+extern bool
+xen_vm_get_platform(xen_session *session, xen_string_string_map **result, 
xen_vm vm);
 
 
 /**
@@ -732,38 +700,32 @@ xen_vm_remove_from_hvm_boot_params(xen_s
 
 
 /**
- * Set the platform/std_VGA field of the given VM.
- */
-extern bool
-xen_vm_set_platform_std_vga(xen_session *session, xen_vm vm, bool std_vga);
-
-
-/**
- * Set the platform/serial field of the given VM.
- */
-extern bool
-xen_vm_set_platform_serial(xen_session *session, xen_vm vm, char *serial);
-
-
-/**
- * Set the platform/localtime field of the given VM.
- */
-extern bool
-xen_vm_set_platform_localtime(xen_session *session, xen_vm vm, bool localtime);
-
-
-/**
- * Set the platform/clock_offset field of the given VM.
- */
-extern bool
-xen_vm_set_platform_clock_offset(xen_session *session, xen_vm vm, bool 
clock_offset);
-
-
-/**
- * Set the platform/enable_audio field of the given VM.
- */
-extern bool
-xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool 
enable_audio);
+ * Set the platform field of the given VM.
+ */
+extern bool
+xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map 
*platform);
+
+
+/**
+ * Add the given key-value pair to the platform field of the given VM.
+ */
+extern bool
+xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the platform
+ * field of the given VM.  If the key is not in that Map, then do nothing.
+ */
+extern bool
+xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key);
+
+
+/**
+ * Set the PCI_bus field of the given VM.
+ */
+extern bool
+xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus);
 
 
 /**
diff -r 620212e48908 -r 0affe03ee985 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Sat Mar 10 21:43:07 2007 +0000
+++ b/tools/libxen/src/xen_vm.c Sat Mar 10 21:48:22 2007 +0000
@@ -145,21 +145,9 @@ static const struct_member xen_vm_record
         { .key = "HVM_boot_params",
           .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_vm_record, hvm_boot_params) },
-        { .key = "platform_std_VGA",
-          .type = &abstract_type_bool,
-          .offset = offsetof(xen_vm_record, platform_std_vga) },
-        { .key = "platform_serial",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_vm_record, platform_serial) },
-        { .key = "platform_localtime",
-          .type = &abstract_type_bool,
-          .offset = offsetof(xen_vm_record, platform_localtime) },
-        { .key = "platform_clock_offset",
-          .type = &abstract_type_bool,
-          .offset = offsetof(xen_vm_record, platform_clock_offset) },
-        { .key = "platform_enable_audio",
-          .type = &abstract_type_bool,
-          .offset = offsetof(xen_vm_record, platform_enable_audio) },
+        { .key = "platform",
+          .type = &abstract_type_string_string_map,
+          .offset = offsetof(xen_vm_record, platform) },
         { .key = "PCI_bus",
           .type = &abstract_type_string,
           .offset = offsetof(xen_vm_record, pci_bus) },
@@ -217,7 +205,7 @@ xen_vm_record_free(xen_vm_record *record
     free(record->pv_bootloader_args);
     free(record->hvm_boot_policy);
     xen_string_string_map_free(record->hvm_boot_params);
-    free(record->platform_serial);
+    xen_string_string_map_free(record->platform);
     free(record->pci_bus);
     xen_string_string_map_free(record->other_config);
     xen_vm_metrics_record_opt_free(record->metrics);
@@ -825,82 +813,18 @@ xen_vm_get_hvm_boot_params(xen_session *
 
 
 bool
-xen_vm_get_platform_std_vga(xen_session *session, bool *result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_bool;
-
-    XEN_CALL_("VM.get_platform_std_VGA");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_platform_serial(xen_session *session, char **result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VM.get_platform_serial");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_platform_localtime(xen_session *session, bool *result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_bool;
-
-    XEN_CALL_("VM.get_platform_localtime");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_platform_clock_offset(xen_session *session, bool *result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_bool;
-
-    XEN_CALL_("VM.get_platform_clock_offset");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_platform_enable_audio(xen_session *session, bool *result, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    abstract_type result_type = abstract_type_bool;
-
-    XEN_CALL_("VM.get_platform_enable_audio");
+xen_vm_get_platform(xen_session *session, xen_string_string_map **result, 
xen_vm vm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm }
+        };
+
+    abstract_type result_type = abstract_type_string_string_map;
+
+    *result = NULL;
+    XEN_CALL_("VM.get_platform");
     return session->ok;
 }
 
@@ -1442,81 +1366,67 @@ xen_vm_remove_from_hvm_boot_params(xen_s
 
 
 bool
-xen_vm_set_platform_std_vga(xen_session *session, xen_vm vm, bool std_vga)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_bool,
-              .u.bool_val = std_vga }
-        };
-
-    xen_call_(session, "VM.set_platform_std_VGA", param_values, 2, NULL, NULL);
-    return session->ok;
-}
-
-
-bool
-xen_vm_set_platform_serial(xen_session *session, xen_vm vm, char *serial)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_string,
-              .u.string_val = serial }
-        };
-
-    xen_call_(session, "VM.set_platform_serial", param_values, 2, NULL, NULL);
-    return session->ok;
-}
-
-
-bool
-xen_vm_set_platform_localtime(xen_session *session, xen_vm vm, bool localtime)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_bool,
-              .u.bool_val = localtime }
-        };
-
-    xen_call_(session, "VM.set_platform_localtime", param_values, 2, NULL, 
NULL);
-    return session->ok;
-}
-
-
-bool
-xen_vm_set_platform_clock_offset(xen_session *session, xen_vm vm, bool 
clock_offset)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_bool,
-              .u.bool_val = clock_offset }
-        };
-
-    xen_call_(session, "VM.set_platform_clock_offset", param_values, 2, NULL, 
NULL);
-    return session->ok;
-}
-
-
-bool
-xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool 
enable_audio)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_bool,
-              .u.bool_val = enable_audio }
-        };
-
-    xen_call_(session, "VM.set_platform_enable_audio", param_values, 2, NULL, 
NULL);
+xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map 
*platform)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string_string_map,
+              .u.set_val = (arbitrary_set *)platform }
+        };
+
+    xen_call_(session, "VM.set_platform", param_values, 2, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_add_to_platform(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_platform", param_values, 3, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_remove_from_platform(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_platform", param_values, 2, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string,
+              .u.string_val = pci_bus }
+        };
+
+    xen_call_(session, "VM.set_PCI_bus", param_values, 2, NULL, NULL);
     return session->ok;
 }
 
diff -r 620212e48908 -r 0affe03ee985 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sat Mar 10 21:43:07 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sat Mar 10 21:48:22 2007 +0000
@@ -676,8 +676,9 @@ class XendAPI(object):
         return xen_api_success_void()
     def host_remove_from_other_config(self, session, host_ref, key):
         node = XendNode.instance()
-        del node.other_config[key]
-        node.save()
+        if key in node.other_config:
+            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)
@@ -998,7 +999,6 @@ class XendAPI(object):
                   'VIFs',
                   'VBDs',
                   'VTPMs',
-                  'PCI_bus',
                   'tools_version',
                   'domid',
                   'is_control_domain',
@@ -1024,12 +1024,8 @@ class XendAPI(object):
                   'PV_bootloader_args',
                   'HVM_boot_policy',
                   'HVM_boot_params',
-                  'platform_std_VGA',
-                  'platform_serial',
-                  'platform_localtime',
-                  'platform_clock_offset',
-                  'platform_enable_audio',
-                  'platform_keymap',
+                  'platform',
+                  'PCI_bus',
                   'other_config']
 
     VM_methods = [('clone', 'VM'),
@@ -1042,6 +1038,10 @@ class XendAPI(object):
                   ('hard_reboot', None),
                   ('suspend', None),
                   ('resume', None),
+                  ('add_to_HVM_boot_params', None),
+                  ('remove_from_HVM_boot_params', None),
+                  ('add_to_platform', None),
+                  ('remove_from_platform', None),
                   ('add_to_other_config', None),
                   ('remove_from_other_config', None)]
     
@@ -1071,13 +1071,7 @@ class XendAPI(object):
         'PV_bootloader_args',
         'HVM_boot_policy',
         'HVM_boot_params',
-        'platform_std_VGA',
-        'platform_serial',
-        'platform_localtime',
-        'platform_clock_offset',
-        'platform_enable_audio',
-        'platform_keymap',
-        'grub_cmdline',
+        'platform',
         'PCI_bus',
         'other_config']
         
@@ -1089,7 +1083,10 @@ class XendAPI(object):
         xd = XendDomain.instance()
         dominfo = xd.get_vm_by_uuid(vm_ref)
         dominfo.info[name] = value
-        xd.managed_config_save(dominfo)
+        return self._VM_save(dominfo)
+
+    def _VM_save(self, dominfo):
+        XendDomain.instance().managed_config_save(dominfo)
         return xen_api_success_void()
 
     # attributes (ro)
@@ -1136,10 +1133,6 @@ class XendAPI(object):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return xen_api_success(dom.get_consoles())
     
-    def VM_get_PCI_bus(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return dom.get_pci_bus()
-    
     def VM_get_tools_version(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         return dom.get_tools_version()
@@ -1214,29 +1207,16 @@ class XendAPI(object):
     def VM_get_HVM_boot_params(self, session, vm_ref):
         return self.VM_get('HVM_boot_params', session, vm_ref)
     
-    def VM_get_platform_std_VGA(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_platform_std_vga())
-    
-    def VM_get_platform_serial(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_platform_serial())        
-    
-    def VM_get_platform_localtime(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_platform_localtime())
-    
-    def VM_get_platform_clock_offset(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_platform_clock_offset())        
-    
-    def VM_get_platform_enable_audio(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_platform_enable_audio())        
-    
-    def VM_get_platform_keymap(self, session, vm_ref):
-        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
-        return xen_api_success(dom.get_platform_keymap())
+    def VM_get_platform(self, session, vm_ref):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        return xen_api_success(dom.get_platform())
+    
+    def VM_get_PCI_bus(self, session, vm_ref):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        return dom.get_pci_bus()
+    
+    def VM_set_PCI_bus(self, session, vm_ref, val):
+        return self.VM_set('PCI_bus', session, vm_ref, val)
     
     def VM_get_other_config(self, session, vm_ref):
         return self.VM_get('other_config', session, vm_ref)        
@@ -1253,7 +1233,7 @@ class XendAPI(object):
     def VM_set_name_label(self, session, vm_ref, label):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         dom.setName(label)
-        return xen_api_success_void()
+        return self._VM_save(dom)
     
     def VM_set_name_description(self, session, vm_ref, desc):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
@@ -1319,14 +1299,16 @@ class XendAPI(object):
         if 'HVM_boot_params' not in dom.info:
             dom.info['HVM_boot_params'] = {}
         dom.info['HVM_boot_params'][key] = value
-        return xen_api_success_void()
+        return self._VM_save(dom)
 
     def VM_remove_from_HVM_boot_params(self, session, vm_ref, key):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
         if 'HVM_boot_params' in dom.info \
                and key in dom.info['HVM_boot_params']:
             del dom.info['HVM_boot_params'][key]
-        return xen_api_success_void()
+            return self._VM_save(dom)
+        else:
+            return xen_api_success_void()
 
     def VM_set_PV_bootloader(self, session, vm_ref, value):
         return self.VM_set('PV_bootloader', session, vm_ref, value)
@@ -1343,40 +1325,42 @@ class XendAPI(object):
     def VM_set_PV_bootloader_args(self, session, vm_ref, value):
         return self.VM_set('PV_bootloader_args', session, vm_ref, value)
 
-    def VM_set_platform_std_VGA(self, session, vm_ref, value):
-        return self.VM_set('platform_std_vga', session, vm_ref, value)
-    
-    def VM_set_platform_serial(self, session, vm_ref, value):
-        return self.VM_set('platform_serial', session, vm_ref, value)
-
-    def VM_set_platform_keymap(self, session, vm_ref, value):
-        return self.VM_set('platform_keymap', session, vm_ref, value)
-    
-    def VM_set_platform_localtime(self, session, vm_ref, value):
-        return self.VM_set('platform_localtime', session, vm_ref, value)
-    
-    def VM_set_platform_clock_offset(self, session, vm_ref, value):
-        return self.VM_set('platform_clock_offset', session, vm_ref, value)
-    
-    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_platform(self, session, vm_ref, value):
+        return self.VM_set('platform', session, vm_ref, value)
+    
+    def VM_add_to_platform(self, session, vm_ref, key, value):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        plat = dom.get_platform()
+        plat[key] = value
+        return self.VM_set_platform(session, vm_ref, plat)
+
+    def VM_remove_from_platform(self, session, vm_ref, key):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        plat = dom.get_platform()
+        if key in plat:
+            del plat[key]
+            return self.VM_set_platform(session, vm_ref, plat)
+        else:
+            return xen_api_success_void()
+
     def VM_set_other_config(self, session, vm_ref, value):
-        return self.VM_set('otherconfig', session, vm_ref, value)
+        return self.VM_set('other_config', session, vm_ref, 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()
+        if dom and 'other_config' in dom.info:
+            dom.info['other_config'][key] = value
+        return self._VM_save(dom)
 
     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']:
-            del dom.info['otherconfig'][key]
-        return xen_api_success_void()        
-    
+        if dom and 'other_config' in dom.info \
+               and key in dom.info['other_config']:
+            del dom.info['other_config'][key]
+            return self._VM_save(dom)
+        else:
+            return xen_api_success_void()
+
     # class methods
     def VM_get_all(self, session):
         refs = [d.get_uuid() for d in XendDomain.instance().list('all')]
@@ -1437,12 +1421,7 @@ class XendAPI(object):
             'PV_bootloader_args': xeninfo.info.get('PV_bootloader_args'),
             'HVM_boot_policy': xeninfo.info.get('HVM_boot_policy'),
             'HVM_boot_params': xeninfo.info.get('HVM_boot_params'),
-            'platform_std_VGA': xeninfo.get_platform_std_vga(),
-            'platform_serial': xeninfo.get_platform_serial(),
-            'platform_localtime': xeninfo.get_platform_localtime(),
-            'platform_clock_offset': xeninfo.get_platform_clock_offset(),
-            'platform_enable_audio': xeninfo.get_platform_enable_audio(),
-            'platform_keymap': xeninfo.get_platform_keymap(),
+            'platform': xeninfo.get_platform(),
             'PCI_bus': xeninfo.get_pci_bus(),
             'tools_version': xeninfo.get_tools_version(),
             'other_config': xeninfo.info.get('other_config', {}),
diff -r 620212e48908 -r 0affe03ee985 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Sat Mar 10 21:43:07 2007 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Sat Mar 10 21:48:22 2007 +0000
@@ -12,7 +12,7 @@
 # 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) 2006 XenSource Ltd
+# Copyright (C) 2006-2007 XenSource Ltd
 #============================================================================
 
 import logging
@@ -111,22 +111,18 @@ XENAPI_CFG_TO_LEGACY_CFG = {
     'actions_after_shutdown': 'on_poweroff',
     'actions_after_reboot': 'on_reboot',
     'actions_after_crash': 'on_crash', 
-    'platform_localtime': 'localtime',
     'PV_bootloader': 'bootloader',
     'PV_bootloader_args': 'bootloader_args',
 }
 
 LEGACY_CFG_TO_XENAPI_CFG = reverse_dict(XENAPI_CFG_TO_LEGACY_CFG)
 
-# Mapping from XendConfig configuration keys to the old
-# legacy configuration keys that are found in the 'image'
-# SXP object.
-XENAPI_HVM_CFG = {
-    'platform_std_vga': 'stdvga',
-    'platform_serial' : 'serial',
-    'platform_localtime': 'localtime',
-    'platform_keymap' : 'keymap'
-}    
+# Platform configuration keys.
+XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'device_model', 'display', 'fda',
+                        'fdb', 'keymap', 'isa', 'localtime', 'nographic',
+                        'pae', 'serial', 'sdl', 'soundhw','stdvga', 'usb',
+                        'usbdevice', 'vnc', 'vncconsole', 'vncdisplay',
+                        'vnclisten', 'vncpasswd', 'vncunused', 'xauthority']
 
 # List of XendConfig configuration keys that have no direct equivalent
 # in the old world.
@@ -158,15 +154,10 @@ XENAPI_CFG_TYPES = {
     'PV_bootloader_args': str,
     'HVM_boot_policy': str,
     'HVM_boot_params': dict,
-    'platform_std_vga': bool0,
-    'platform_serial': str,
-    'platform_localtime': bool0,
-    'platform_clock_offset': bool0,
-    'platform_enable_audio': bool0,
-    'platform_keymap': str,
-    'pci_bus': str,
+    'PCI_bus': str,
+    'platform': dict,
     'tools_version': dict,
-    'otherconfig': dict,
+    'other_config': dict,
 }
 
 # List of legacy configuration keys that have no equivalent in the
@@ -236,44 +227,7 @@ LEGACY_XENSTORE_VM_PARAMS = [
     'on_xend_stop',
 ]
 
-LEGACY_IMAGE_CFG = [
-    ('root', str),
-    ('ip', str),
-    ('nographic', int),
-    ('vnc', int),
-    ('sdl', int),
-    ('vncdisplay', int),
-    ('vncunused', int),
-    ('vncpasswd', str),
-    ('vnclisten', str),
-]
-
-LEGACY_IMAGE_HVM_CFG = [
-    ('device_model', str),
-    ('display', str),
-    ('xauthority', str),
-    ('vncconsole', int),
-    ('pae', int),
-    ('apic', int),
-]
-
-LEGACY_IMAGE_HVM_DEVICES_CFG = [
-    ('acpi', int),    
-    ('boot', str),
-    ('fda', str),
-    ('fdb', str),
-    ('isa', int),
-    ('keymap', str),    
-    ('localtime', int),    
-    ('serial', str),
-    ('stdvga', int),
-    ('soundhw', str),
-    ('usb', int),
-    ('usbdevice', str),    
-    ('vcpus', int),
-]
-
-LEGACY_DM = '/usr/lib/xen/bin/qemu-dm'
+DEFAULT_DM = '/usr/lib/xen/bin/qemu-dm'
 
 ##
 ## Config Choices
@@ -315,7 +269,6 @@ class XendConfig(dict):
             self._sxp_to_xapi_unsupported(sxp_obj)
         elif xapi:
             self.update_with_xenapi_config(xapi)
-            self._add_xapi_unsupported(xapi)
         elif dominfo:
             # output from xc.domain_getinfo
             self._dominfo_to_xapi(dominfo)
@@ -362,7 +315,6 @@ class XendConfig(dict):
             'memory_dynamic_max': 0,
             'memory_actual': 0,
             'devices': {},
-            'image': {},
             'security': None,
             'on_xend_start': 'ignore',
             'on_xend_stop': 'ignore',
@@ -376,6 +328,7 @@ class XendConfig(dict):
             'vbd_refs': [],
             'vtpm_refs': [],
             'other_config': {},
+            'platform': {}
         }
         
         return defaults
@@ -416,12 +369,23 @@ class XendConfig(dict):
         if 'name_label' not in self:
             self['name_label'] = 'Domain-' + self['uuid']
 
+    def _platform_sanity_check(self):
+        if self.is_hvm():
+            if 'device_model' not in self['platform']:
+                self['platform']['device_model'] = DEFAULT_DM
+
+            # Compatibility hack, can go away soon.
+            if 'soundhw' not in self['platform'] and \
+               self['platform'].get('enable_audio'):
+                self['platform']['soundhw'] = 'sb16'
+
     def validate(self):
         self._uuid_sanity_check()
         self._name_sanity_check()
         self._memory_sanity_check()
         self._actions_sanity_check()
         self._vcpus_sanity_check()
+        self._platform_sanity_check()
 
     def _dominfo_to_xapi(self, dominfo):
         self['domid'] = dominfo['domid']
@@ -496,6 +460,18 @@ class XendConfig(dict):
                 except (TypeError, ValueError), e:
                     log.warn("Unable to parse key %s: %s: %s" %
                              (key, str(val), e))
+
+        if 'platform' not in cfg:
+            cfg['platform'] = {}
+        localtime = sxp.child_value(sxp_cfg, 'localtime')
+        if localtime is not None:
+            cfg['platform']['localtime'] = localtime
+
+        # Compatibility hack -- can go soon.
+        for key in XENAPI_PLATFORM_CFG:
+            val = sxp.child_value(sxp_cfg, "platform_" + key, None)
+            if val is not None:
+                self['platform'][key] = val
 
         # Compatibility hack -- can go soon.
         boot_order = sxp.child_value(sxp_cfg, 'HVM_boot')
@@ -651,10 +627,9 @@ class XendConfig(dict):
             self.update_with_image_sxp(image_sxp)
 
         # Convert Legacy HVM parameters to Xen API configuration
-        self['platform_std_vga'] = bool0(cfg.get('stdvga', 0))
-        self['platform_serial'] = str(cfg.get('serial', ''))
-        self['platform_localtime'] = bool0(cfg.get('localtime', 0))
-        self['platform_enable_audio'] = bool0(cfg.get('soundhw', 0))
+        for key in XENAPI_PLATFORM_CFG:
+            if key in cfg:
+                self['platform'][key] = cfg[key]
 
         # make sure a sane maximum is set
         if self['memory_static_max'] <= 0:
@@ -671,7 +646,7 @@ class XendConfig(dict):
         self['vtpm_refs'] = cfg.get('vtpm_refs', [])
 
         # coalesce hvm vnc frame buffer with vfb config
-        if self['image']['type'] == 'hvm' and self['image'].get('vnc', 0):
+        if self.is_hvm() and self['platform'].get('vnc', 0):
             # add vfb device if it isn't there already
             has_rfb = False
             for console_uuid in self['console_refs']:
@@ -684,11 +659,11 @@ class XendConfig(dict):
 
             if not has_rfb:
                 dev_config = ['vfb']
-                # copy VNC related params from image config to vfb dev conf
+                # copy VNC related params from platform config to vfb dev conf
                 for key in ['vncpasswd', 'vncunused', 'vncdisplay',
                             'vnclisten']:
-                    if key in self['image']:
-                        dev_config.append([key, self['image'][key]])
+                    if key in self['platform']:
+                        dev_config.append([key, self['platform'][key]])
 
                 self.device_add('vfb', cfg_sxp = dev_config)
 
@@ -705,39 +680,19 @@ class XendConfig(dict):
         # the image (as well as HVM images)
         image_sxp = sxp.child_value(sxp_cfg, 'image', [])
         if image_sxp:
-            image = {}
-            image['type'] = sxp.name(image_sxp)
-            for arg, conv in LEGACY_IMAGE_CFG:
-                val = sxp.child_value(image_sxp, arg, None)
-                if val != None:
-                    image[arg] = conv(val)
-
-            image_hvm = {}
-            for arg, conv in LEGACY_IMAGE_HVM_CFG:
-                val = sxp.child_value(image_sxp, arg, None)
-                if val != None:
-                    image_hvm[arg] = conv(val)
-                    
-            image_hvm_devices = {}
-            for arg, conv in LEGACY_IMAGE_HVM_DEVICES_CFG:
-                val = sxp.child_value(image_sxp, arg, None)
-                if val != None:
-                    image_hvm_devices[arg] = conv(val)
-
-            if image_hvm or image_hvm_devices:
-                image['hvm'] = image_hvm
-                image['hvm']['devices'] = image_hvm_devices
-
+            image_type = sxp.name(image_sxp)
+            if image_type != 'hvm' and image_type != 'linux':
+                self['platform']['image_type'] = image_type
+            
+            for key in XENAPI_PLATFORM_CFG:
+                val = sxp.child_value(image_sxp, key, None)
+                if val is not None:
+                    self['platform'][key] = val
+            
             notes = sxp.children(image_sxp, 'notes')
             if notes:
-                image['notes'] = self.notes_from_sxp(notes[0])
-
-            self['image'] = image
-
-            for apikey, imgkey in XENAPI_HVM_CFG.items():
-                val = sxp.child_value(image_sxp, imgkey, None)
-                if val != None:
-                    self[apikey] = val
+                self['notes'] = self.notes_from_sxp(notes[0])
+
             self._hvm_boot_params_from_sxp(image_sxp)
 
         # extract backend value
@@ -773,33 +728,6 @@ class XendConfig(dict):
         _set_cfg_if_exists('up_time')
         _set_cfg_if_exists('status') # TODO, deprecated  
 
-    def _add_xapi_unsupported(self, xapi_dict):
-        """Updates the configuration object with entries that are not
-        officially supported by the Xen API but is required for
-        the rest of Xend to function.
-        """
-
-        # populate image
-        if 'image' in xapi_dict:
-            self['image'].update(xapi_dict['image'])
-        else:
-            hvm = self['HVM_boot_policy'] != ''
-            self['image']['type'] = hvm and 'hvm' or 'linux'
-            if hvm:
-                self['image']['hvm'] = {'devices': {}}
-                for xapi, cfgapi in XENAPI_HVM_CFG.items():
-                    if xapi in self:
-                        self['image']['hvm']['devices'][cfgapi] = self[xapi]
-
-                # currently unsupported options
-                self['image']['hvm']['device_model'] = LEGACY_DM
-                self['image']['vnc'] = 0
-                self['image']['hvm']['pae'] = 1
-
-                if self['platform_enable_audio']:
-                    self['image']['hvm']['devices']['soundhw'] = 'sb16'
-
-
     def _get_old_state_string(self):
         """Returns the old xm state string.
         @rtype: string
@@ -889,9 +817,7 @@ class XendConfig(dict):
             if self.has_key(legacy) and self[legacy] not in (None, []):
                 sxpr.append([legacy, self[legacy]])
 
-        if 'image' in self and self['image']:
-            sxpr.append(['image', self.image_sxpr()])
-
+        sxpr.append(['image', self.image_sxpr()])
         sxpr.append(['status', domain.state])
         sxpr.append(['memory_dynamic_min',  self.get('memory_dynamic_min')])
         sxpr.append(['memory_dynamic_max',  self.get('memory_dynamic_max')])
@@ -1338,7 +1264,7 @@ class XendConfig(dict):
     def image_sxpr(self):
         """Returns a backwards compatible image SXP expression that is
         used in xenstore's /vm/<uuid>/image value and xm list."""
-        image = [self['image'].get('type', 'linux')]
+        image = [self.image_type()]
         if self.has_key('PV_kernel'):
             image.append(['kernel', self['PV_kernel']])
         if self.has_key('PV_ramdisk') and self['PV_ramdisk']:
@@ -1346,28 +1272,12 @@ class XendConfig(dict):
         if self.has_key('PV_args') and self['PV_args']:
             image.append(['args', self['PV_args']])
 
-        for arg, conv in LEGACY_IMAGE_CFG:
-            if self['image'].has_key(arg):
-                image.append([arg, self['image'][arg]])
-
-        if 'hvm' in self['image']:
-            for arg, conv in LEGACY_IMAGE_HVM_CFG:
-                if self['image']['hvm'].get(arg):
-                    image.append([arg, conv(self['image']['hvm'][arg])])
-
-        if 'hvm' in self['image'] and 'devices' in self['image']['hvm']:
-            for arg, conv in LEGACY_IMAGE_HVM_DEVICES_CFG:
-                val = self['image']['hvm']['devices'].get(arg)
-                if val != None:
-                    try:
-                        if conv: val = conv(val)
-                    except (ValueError, TypeError):
-                        if type(val) == bool: val = int(val)
-                            
-                    image.append([arg, val])
-
-        if 'notes' in self['image']:
-            image.append(self.notes_sxp(self['image']['notes']))
+        for key in XENAPI_PLATFORM_CFG:
+            if key in self['platform']:
+                image.append([key, self['platform'][key]])
+
+        if 'notes' in self:
+            image.append(self.notes_sxp(self['notes']))
 
         return image
 
@@ -1398,57 +1308,24 @@ class XendConfig(dict):
             self['PV_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
             self['PV_args'] = kernel_args
 
-        # Store image SXP in python dictionary format
-        image = {}
-        image['type'] = sxp.name(image_sxp)
-        for arg, conv in LEGACY_IMAGE_CFG:
-            val = sxp.child_value(image_sxp, arg, None)
-            if val != None:
-                image[arg] = conv(val)
-
-        image_hvm = {}
-        for arg, conv in LEGACY_IMAGE_HVM_CFG:
-            val = sxp.child_value(image_sxp, arg, None)
-            if val != None:
-                image_hvm[arg] = conv(val)
-                    
-        image_hvm_devices = {}
-        for arg, conv in LEGACY_IMAGE_HVM_DEVICES_CFG:
-            val = sxp.child_value(image_sxp, arg, None)
-            if val != None:
-                try:
-                    image_hvm_devices[arg] = conv(val)
-                except (ValueError, TypeError):
-                    image_hvm_devices[arg] = val
-                        
-
-        if image_hvm or image_hvm_devices:
-            image['hvm'] = image_hvm
-            image['hvm']['devices'] = image_hvm_devices
+        for key in XENAPI_PLATFORM_CFG:
+            val = sxp.child_value(image_sxp, key, None)
+            if val is not None:
+                self['platform'][key] = val
 
         notes = sxp.children(image_sxp, 'notes')
         if notes:
-            image['notes'] = self.notes_from_sxp(notes[0])
-
-        self['image'] = image
-
-        for apikey, imgkey in XENAPI_HVM_CFG.items():
-            val = sxp.child_value(image_sxp, imgkey, None)
-            if val != None:
-                type_conv = XENAPI_CFG_TYPES[apikey]
-                if callable(type_conv):
-                    self[apikey] = type_conv(val)
-                else:
-                    self[apikey] = val
+            self['notes'] = self.notes_from_sxp(notes[0])
+
         self._hvm_boot_params_from_sxp(image_sxp)
 
     def set_notes(self, notes):
         'Add parsed elfnotes to image'
-        self['image']['notes'] = notes
+        self['notes'] = notes
 
     def get_notes(self):
         try:
-            return self['image']['notes'] or {}
+            return self['notes'] or {}
         except KeyError:
             return {}
 
@@ -1470,11 +1347,9 @@ class XendConfig(dict):
             self['HVM_boot_policy'] = 'BIOS order'
             self['HVM_boot_params'] = { 'order' : boot }
 
-
-#
-# debugging 
-#
-
-if __name__ == "__main__":
-    pass
-    
+    def is_hvm(self):
+        return self['HVM_boot_policy'] != ''
+
+    def image_type(self):
+        stored_type = self['platform'].get('image_type')
+        return stored_type or (self.is_hvm() and 'hvm' or 'linux')
diff -r 620212e48908 -r 0affe03ee985 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Sat Mar 10 21:43:07 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Sat Mar 10 21:48:22 2007 +0000
@@ -13,7 +13,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #============================================================================
 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@xxxxxx>
-# Copyright (C) 2005, 2006 XenSource Ltd
+# Copyright (C) 2005-2007 XenSource Ltd
 #============================================================================
 
 """Representation of a single domain.
@@ -176,14 +176,8 @@ def recreate(info, priv):
         vm._storeVmDetails()
         vm._storeDomDetails()
         
-    if vm.info['image']: # Only dom0 should be without an image entry when
-                         # recreating, but we cope with missing ones
-                         # elsewhere just in case.
-        vm.image = image.create(vm,
-                                vm.info,
-                                vm.info['image'],
-                                vm.info['devices'])
-        vm.image.recreate()
+    vm.image = image.create(vm, vm.info)
+    vm.image.recreate()
 
     vm._registerWatches()
     vm.refreshShutdown(xeninfo)
@@ -448,9 +442,7 @@ class XendDomainInfo:
         self.storeDom("control/shutdown", reason)
 
         ## shutdown hypercall for hvm domain desides xenstore write
-        image_cfg = self.info.get('image', {})
-        hvm = image_cfg.has_key('hvm')
-        if hvm:
+        if self.info.is_hvm():
             for code in DOMAIN_SHUTDOWN_REASONS.keys():
                 if DOMAIN_SHUTDOWN_REASONS[code] == reason:
                     break
@@ -1389,9 +1381,7 @@ class XendDomainInfo:
 
         self.shutdownStartTime = None
 
-        image_cfg = self.info.get('image', {})
-        hvm = image_cfg.has_key('hvm')
-
+        hvm = self.info.is_hvm()
         if hvm:
             info = xc.xeninfo()
             if 'hvm' not in info['xen_caps']:
@@ -1438,14 +1428,8 @@ class XendDomainInfo:
 
         self._configureBootloader()
 
-        if not self._infoIsSet('image'):
-            raise VmError('Missing image in configuration')
-
         try:
-            self.image = image.create(self,
-                                      self.info,
-                                      self.info['image'],
-                                      self.info['devices'])
+            self.image = image.create(self, self.info)
 
             localtime = self.info.get('platform_localtime', False)
             if localtime:
@@ -1507,7 +1491,8 @@ class XendDomainInfo:
             self._stateSet(DOM_STATE_RUNNING)
         except (RuntimeError, VmError), exn:
             log.exception("XendDomainInfo.initDomain: exception occurred")
-            self.image.cleanupBootloading()
+            if self.image:
+                self.image.cleanupBootloading()
             raise VmError(str(exn))
 
 
@@ -1574,13 +1559,8 @@ class XendDomainInfo:
         self.console_mfn = console_mfn
 
         self._introduceDomain()
-        image_cfg = self.info.get('image', {})
-        hvm = image_cfg.has_key('hvm')
-        if hvm:
-            self.image = image.create(self,
-                    self.info,
-                    self.info['image'],
-                    self.info['devices'])
+        if self.info.has_hvm():
+            self.image = image.create(self, self.info)
             if self.image:
                 self.image.createDeviceModel(True)
                 self.image.register_shutdown_watch()
@@ -1742,11 +1722,7 @@ class XendDomainInfo:
 
         if boot:
             # HVM booting.
-            self.info['image']['type'] = 'hvm'
-            if not 'devices' in self.info['image']:
-                self.info['image']['devices'] = {}
-            self.info['image']['devices']['boot'] = \
-                self.info['HVM_boot_params'].get('order', 'dc')
+            pass
         elif not blexec and kernel:
             # Boot from dom0.  Nothing left to do -- the kernel and ramdisk
             # will be picked up by image.py.
@@ -1910,10 +1886,9 @@ class XendDomainInfo:
             if self._infoIsSet(info_key):
                 to_store[key] = str(self.info[info_key])
 
-        if self.info.get('image'):
-            image_sxpr = self.info.image_sxpr()
-            if image_sxpr:
-                to_store['image'] = sxp.to_string(image_sxpr)
+        image_sxpr = self.info.image_sxpr()
+        if image_sxpr:
+            to_store['image'] = sxp.to_string(image_sxpr)
 
         if self._infoIsSet('security'):
             secinfo = self.info['security']
@@ -2074,18 +2049,8 @@ class XendDomainInfo:
         return retval
     def get_power_state(self):
         return XEN_API_VM_POWER_STATE[self.state]
-    def get_platform_std_vga(self):
-        return self.info.get('platform_std_vga', False)    
-    def get_platform_serial(self):
-        return self.info.get('platform_serial', '')
-    def get_platform_localtime(self):
-        return self.info.get('platform_localtime', False)
-    def get_platform_clock_offset(self):
-        return self.info.get('platform_clock_offset', False)
-    def get_platform_enable_audio(self):
-        return self.info.get('platform_enable_audio', False)
-    def get_platform_keymap(self):
-        return self.info.get('platform_keymap', '')
+    def get_platform(self):
+        return self.info.get('platform', {})    
     def get_pci_bus(self):
         return self.info.get('pci_bus', '')
     def get_tools_version(self):
diff -r 620212e48908 -r 0affe03ee985 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Sat Mar 10 21:43:07 2007 +0000
+++ b/tools/python/xen/xend/image.py    Sat Mar 10 21:48:22 2007 +0000
@@ -13,7 +13,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #============================================================================
 # Copyright (C) 2005 Mike Wray <mike.wray@xxxxxx>
-# Copyright (C) 2005 XenSource Ltd
+# Copyright (C) 2005-2007 XenSource Ltd
 #============================================================================
 
 
@@ -36,13 +36,12 @@ MAX_GUEST_CMDLINE = 1024
 MAX_GUEST_CMDLINE = 1024
 
 
-def create(vm, vmConfig, imageConfig, deviceConfig):
+def create(vm, vmConfig):
     """Create an image handler for a vm.
 
     @return ImageHandler instance
     """
-    return findImageHandlerClass(imageConfig)(vm, vmConfig, imageConfig,
-                                              deviceConfig)
+    return findImageHandlerClass(vmConfig)(vm, vmConfig)
 
 
 class ImageHandler:
@@ -65,7 +64,7 @@ class ImageHandler:
     ostype = None
 
 
-    def __init__(self, vm, vmConfig, imageConfig, deviceConfig):
+    def __init__(self, vm, vmConfig):
         self.vm = vm
 
         self.bootloader = False
@@ -73,9 +72,9 @@ class ImageHandler:
         self.ramdisk = None
         self.cmdline = None
 
-        self.configure(vmConfig, imageConfig, deviceConfig)
-
-    def configure(self, vmConfig, imageConfig, _):
+        self.configure(vmConfig)
+
+    def configure(self, vmConfig):
         """Config actions common to all unix-like domains."""
         if '_temp_using_bootloader' in vmConfig:
             self.bootloader = True
@@ -262,13 +261,13 @@ class HVMImageHandler(ImageHandler):
 
     ostype = "hvm"
 
-    def __init__(self, vm, vmConfig, imageConfig, deviceConfig):
-        ImageHandler.__init__(self, vm, vmConfig, imageConfig, deviceConfig)
+    def __init__(self, vm, vmConfig):
+        ImageHandler.__init__(self, vm, vmConfig)
         self.shutdownWatch = None
         self.rebootFeatureWatch = None
 
-    def configure(self, vmConfig, imageConfig, deviceConfig):
-        ImageHandler.configure(self, vmConfig, imageConfig, deviceConfig)
+    def configure(self, vmConfig):
+        ImageHandler.configure(self, vmConfig)
 
         if not self.kernel:
             self.kernel = '/usr/lib/xen/boot/hvmloader'
@@ -279,13 +278,13 @@ class HVMImageHandler(ImageHandler):
                           "supported by your CPU and enabled in your BIOS?")
 
         self.dmargs = self.parseDeviceModelArgs(vmConfig)
-        self.device_model = imageConfig['hvm'].get('device_model')
+        self.device_model = vmConfig['platform'].get('device_model')
         if not self.device_model:
             raise VmError("hvm: missing device model")
         
-        self.display = imageConfig['hvm'].get('display')
-        self.xauthority = imageConfig['hvm'].get('xauthority')
-        self.vncconsole = imageConfig['hvm'].get('vncconsole')
+        self.display = vmConfig['platform'].get('display')
+        self.xauthority = vmConfig['platform'].get('xauthority')
+        self.vncconsole = vmConfig['platform'].get('vncconsole')
 
         self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
                         ("image/device-model", self.device_model),
@@ -293,9 +292,9 @@ class HVMImageHandler(ImageHandler):
 
         self.pid = None
 
-        self.pae  = imageConfig['hvm'].get('pae', 0)
-        self.apic  = imageConfig['hvm'].get('apic', 0)
-        self.acpi  = imageConfig['hvm']['devices'].get('acpi', 0)
+        self.pae  = int(vmConfig['platform'].get('pae',  0))
+        self.apic = int(vmConfig['platform'].get('apic', 0))
+        self.acpi = int(vmConfig['platform'].get('acpi', 0))
         
 
     def buildDomain(self):
@@ -331,11 +330,10 @@ class HVMImageHandler(ImageHandler):
                    'localtime', 'serial', 'stdvga', 'isa',
                    'acpi', 'usb', 'usbdevice', 'keymap' ]
         
-        hvmDeviceConfig = vmConfig['image']['hvm']['devices']
         ret = ['-vcpus', str(self.vm.getVCpuCount())]
 
         for a in dmargs:
-            v = hvmDeviceConfig.get(a)
+            v = vmConfig['platform'].get(a)
 
             # python doesn't allow '-' in variable names
             if a == 'stdvga': a = 'std-vga'
@@ -395,14 +393,14 @@ class HVMImageHandler(ImageHandler):
         # Find RFB console device, and if it exists, make QEMU enable
         # the VNC console.
         #
-        if vmConfig['image'].get('nographic'):
+        if vmConfig['platform'].get('nographic'):
             # skip vnc init if nographic is set
             ret.append('-nographic')
             return ret
 
         vnc_config = {}
-        has_vnc = int(vmConfig['image'].get('vnc', 0)) != 0
-        has_sdl = int(vmConfig['image'].get('sdl', 0)) != 0
+        has_vnc = int(vmConfig['platform'].get('vnc', 0)) != 0
+        has_sdl = int(vmConfig['platform'].get('sdl', 0)) != 0
         for dev_uuid in vmConfig['console_refs']:
             dev_type, dev_info = vmConfig['devices'][dev_uuid]
             if dev_type == 'vfb':
@@ -414,8 +412,8 @@ class HVMImageHandler(ImageHandler):
             if not vnc_config:
                 for key in ('vncunused', 'vnclisten', 'vncdisplay',
                             'vncpasswd'):
-                    if key in vmConfig['image']:
-                        vnc_config[key] = vmConfig['image'][key]
+                    if key in vmConfig['platform']:
+                        vnc_config[key] = vmConfig['platform'][key]
 
             if not vnc_config.get('vncunused', 0) and \
                    vnc_config.get('vncdisplay', 0):
@@ -634,9 +632,7 @@ def findImageHandlerClass(image):
     @param image config
     @return ImageHandler subclass or None
     """
-    image_type = image['type']
-    if image_type is None:
-        raise VmError('missing image type')
+    image_type = image.image_type()
     try:
         return _handlers[arch.type][image_type]
     except KeyError:

_______________________________________________
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] Replace VM.platform_{std_VGA, serial, localtime, clock_offset, enable_audio} with, Xen patchbot-unstable <=