direct-io.hg

changeset 14341:0affe03ee985

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@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Sat Mar 10 21:48:22 2007 +0000 (2007-03-10)
parents 620212e48908
children e5d7b878118f
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 tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Sat Mar 10 21:43:07 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Sat Mar 10 21:48:22 2007 +0000
     1.3 @@ -1058,12 +1058,8 @@ Quals & Field & Type & Description \\
     1.4  $\mathit{RW}$ &  {\tt PV/bootloader\_args} & string & miscellaneous arguments for the bootloader \\
     1.5  $\mathit{RW}$ &  {\tt HVM/boot\_policy} & string & HVM boot policy \\
     1.6  $\mathit{RW}$ &  {\tt HVM/boot\_params} & (string $\rightarrow$ string) Map & HVM boot params \\
     1.7 -$\mathit{RW}$ &  {\tt platform/std\_VGA} & bool & emulate standard VGA instead of cirrus logic \\
     1.8 -$\mathit{RW}$ &  {\tt platform/serial} & string & redirect serial port to pty \\
     1.9 -$\mathit{RW}$ &  {\tt platform/localtime} & bool & set RTC to local time \\
    1.10 -$\mathit{RW}$ &  {\tt platform/clock\_offset} & bool & timeshift applied to guest's clock \\
    1.11 -$\mathit{RW}$ &  {\tt platform/enable\_audio} & bool & emulate audio \\
    1.12 -$\mathit{RO}_\mathit{ins}$ &  {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\
    1.13 +$\mathit{RW}$ &  {\tt platform} & (string $\rightarrow$ string) Map & platform-specific configuration \\
    1.14 +$\mathit{RW}$ &  {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\
    1.15  $\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
    1.16  $\mathit{RO}_\mathit{run}$ &  {\tt domid} & int & domain ID (if available, -1 otherwise) \\
    1.17  $\mathit{RO}_\mathit{run}$ &  {\tt is\_control\_domain} & bool & true if this is a control domain (domain 0 or a driver domain) \\
    1.18 @@ -3407,321 +3403,128 @@ void
    1.19  \vspace{0.3cm}
    1.20  \vspace{0.3cm}
    1.21  \vspace{0.3cm}
    1.22 -\subsubsection{RPC name:~get\_platform\_std\_VGA}
    1.23 -
    1.24 -{\bf Overview:} 
    1.25 -Get the platform/std\_VGA field of the given VM.
    1.26 -
    1.27 - \noindent {\bf Signature:} 
    1.28 -\begin{verbatim} bool get_platform_std_VGA (session_id s, VM ref self)\end{verbatim}
    1.29 -
    1.30 -
    1.31 -\noindent{\bf Arguments:}
    1.32 -
    1.33 - 
    1.34 -\vspace{0.3cm}
    1.35 -\begin{tabular}{|c|c|p{7cm}|}
    1.36 - \hline
    1.37 -{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.38 -{\tt VM ref } & self & reference to the object \\ \hline 
    1.39 -
    1.40 -\end{tabular}
    1.41 -
    1.42 -\vspace{0.3cm}
    1.43 -
    1.44 - \noindent {\bf Return Type:} 
    1.45 -{\tt 
    1.46 -bool
    1.47 -}
    1.48 -
    1.49 -
    1.50 -value of the field
    1.51 -\vspace{0.3cm}
    1.52 -\vspace{0.3cm}
    1.53 -\vspace{0.3cm}
    1.54 -\subsubsection{RPC name:~set\_platform\_std\_VGA}
    1.55 -
    1.56 -{\bf Overview:} 
    1.57 -Set the platform/std\_VGA field of the given VM.
    1.58 -
    1.59 - \noindent {\bf Signature:} 
    1.60 -\begin{verbatim} void set_platform_std_VGA (session_id s, VM ref self, bool value)\end{verbatim}
    1.61 -
    1.62 -
    1.63 -\noindent{\bf Arguments:}
    1.64 -
    1.65 - 
    1.66 -\vspace{0.3cm}
    1.67 -\begin{tabular}{|c|c|p{7cm}|}
    1.68 - \hline
    1.69 -{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.70 -{\tt VM ref } & self & reference to the object \\ \hline 
    1.71 -
    1.72 -{\tt bool } & value & New value to set \\ \hline 
    1.73 -
    1.74 -\end{tabular}
    1.75 -
    1.76 -\vspace{0.3cm}
    1.77 -
    1.78 - \noindent {\bf Return Type:} 
    1.79 -{\tt 
    1.80 -void
    1.81 -}
    1.82 -
    1.83 -
    1.84 -
    1.85 -\vspace{0.3cm}
    1.86 -\vspace{0.3cm}
    1.87 -\vspace{0.3cm}
    1.88 -\subsubsection{RPC name:~get\_platform\_serial}
    1.89 -
    1.90 -{\bf Overview:} 
    1.91 -Get the platform/serial field of the given VM.
    1.92 -
    1.93 - \noindent {\bf Signature:} 
    1.94 -\begin{verbatim} string get_platform_serial (session_id s, VM ref self)\end{verbatim}
    1.95 -
    1.96 -
    1.97 -\noindent{\bf Arguments:}
    1.98 -
    1.99 - 
   1.100 -\vspace{0.3cm}
   1.101 -\begin{tabular}{|c|c|p{7cm}|}
   1.102 - \hline
   1.103 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.104 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.105 -
   1.106 -\end{tabular}
   1.107 -
   1.108 -\vspace{0.3cm}
   1.109 -
   1.110 - \noindent {\bf Return Type:} 
   1.111 -{\tt 
   1.112 -string
   1.113 -}
   1.114 -
   1.115 -
   1.116 -value of the field
   1.117 -\vspace{0.3cm}
   1.118 -\vspace{0.3cm}
   1.119 -\vspace{0.3cm}
   1.120 -\subsubsection{RPC name:~set\_platform\_serial}
   1.121 -
   1.122 -{\bf Overview:} 
   1.123 -Set the platform/serial field of the given VM.
   1.124 -
   1.125 - \noindent {\bf Signature:} 
   1.126 -\begin{verbatim} void set_platform_serial (session_id s, VM ref self, string value)\end{verbatim}
   1.127 -
   1.128 -
   1.129 -\noindent{\bf Arguments:}
   1.130 -
   1.131 - 
   1.132 -\vspace{0.3cm}
   1.133 -\begin{tabular}{|c|c|p{7cm}|}
   1.134 - \hline
   1.135 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.136 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.137 -
   1.138 -{\tt string } & value & New value to set \\ \hline 
   1.139 -
   1.140 -\end{tabular}
   1.141 -
   1.142 -\vspace{0.3cm}
   1.143 -
   1.144 - \noindent {\bf Return Type:} 
   1.145 -{\tt 
   1.146 -void
   1.147 -}
   1.148 -
   1.149 -
   1.150 -
   1.151 -\vspace{0.3cm}
   1.152 -\vspace{0.3cm}
   1.153 -\vspace{0.3cm}
   1.154 -\subsubsection{RPC name:~get\_platform\_localtime}
   1.155 -
   1.156 -{\bf Overview:} 
   1.157 -Get the platform/localtime field of the given VM.
   1.158 -
   1.159 - \noindent {\bf Signature:} 
   1.160 -\begin{verbatim} bool get_platform_localtime (session_id s, VM ref self)\end{verbatim}
   1.161 -
   1.162 -
   1.163 -\noindent{\bf Arguments:}
   1.164 -
   1.165 - 
   1.166 -\vspace{0.3cm}
   1.167 -\begin{tabular}{|c|c|p{7cm}|}
   1.168 - \hline
   1.169 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.170 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.171 -
   1.172 -\end{tabular}
   1.173 -
   1.174 -\vspace{0.3cm}
   1.175 -
   1.176 - \noindent {\bf Return Type:} 
   1.177 -{\tt 
   1.178 -bool
   1.179 -}
   1.180 -
   1.181 -
   1.182 -value of the field
   1.183 -\vspace{0.3cm}
   1.184 -\vspace{0.3cm}
   1.185 -\vspace{0.3cm}
   1.186 -\subsubsection{RPC name:~set\_platform\_localtime}
   1.187 -
   1.188 -{\bf Overview:} 
   1.189 -Set the platform/localtime field of the given VM.
   1.190 -
   1.191 - \noindent {\bf Signature:} 
   1.192 -\begin{verbatim} void set_platform_localtime (session_id s, VM ref self, bool value)\end{verbatim}
   1.193 -
   1.194 -
   1.195 -\noindent{\bf Arguments:}
   1.196 -
   1.197 - 
   1.198 -\vspace{0.3cm}
   1.199 -\begin{tabular}{|c|c|p{7cm}|}
   1.200 - \hline
   1.201 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.202 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.203 -
   1.204 -{\tt bool } & value & New value to set \\ \hline 
   1.205 -
   1.206 -\end{tabular}
   1.207 -
   1.208 -\vspace{0.3cm}
   1.209 -
   1.210 - \noindent {\bf Return Type:} 
   1.211 -{\tt 
   1.212 -void
   1.213 -}
   1.214 -
   1.215 -
   1.216 -
   1.217 -\vspace{0.3cm}
   1.218 -\vspace{0.3cm}
   1.219 -\vspace{0.3cm}
   1.220 -\subsubsection{RPC name:~get\_platform\_clock\_offset}
   1.221 -
   1.222 -{\bf Overview:} 
   1.223 -Get the platform/clock\_offset field of the given VM.
   1.224 -
   1.225 - \noindent {\bf Signature:} 
   1.226 -\begin{verbatim} bool get_platform_clock_offset (session_id s, VM ref self)\end{verbatim}
   1.227 -
   1.228 -
   1.229 -\noindent{\bf Arguments:}
   1.230 -
   1.231 - 
   1.232 -\vspace{0.3cm}
   1.233 -\begin{tabular}{|c|c|p{7cm}|}
   1.234 - \hline
   1.235 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.236 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.237 -
   1.238 -\end{tabular}
   1.239 -
   1.240 -\vspace{0.3cm}
   1.241 -
   1.242 - \noindent {\bf Return Type:} 
   1.243 -{\tt 
   1.244 -bool
   1.245 -}
   1.246 -
   1.247 -
   1.248 -value of the field
   1.249 -\vspace{0.3cm}
   1.250 -\vspace{0.3cm}
   1.251 -\vspace{0.3cm}
   1.252 -\subsubsection{RPC name:~set\_platform\_clock\_offset}
   1.253 -
   1.254 -{\bf Overview:} 
   1.255 -Set the platform/clock\_offset field of the given VM.
   1.256 -
   1.257 - \noindent {\bf Signature:} 
   1.258 -\begin{verbatim} void set_platform_clock_offset (session_id s, VM ref self, bool value)\end{verbatim}
   1.259 -
   1.260 -
   1.261 -\noindent{\bf Arguments:}
   1.262 -
   1.263 - 
   1.264 -\vspace{0.3cm}
   1.265 -\begin{tabular}{|c|c|p{7cm}|}
   1.266 - \hline
   1.267 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.268 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.269 -
   1.270 -{\tt bool } & value & New value to set \\ \hline 
   1.271 -
   1.272 -\end{tabular}
   1.273 -
   1.274 -\vspace{0.3cm}
   1.275 -
   1.276 - \noindent {\bf Return Type:} 
   1.277 -{\tt 
   1.278 -void
   1.279 -}
   1.280 -
   1.281 -
   1.282 -
   1.283 -\vspace{0.3cm}
   1.284 -\vspace{0.3cm}
   1.285 -\vspace{0.3cm}
   1.286 -\subsubsection{RPC name:~get\_platform\_enable\_audio}
   1.287 -
   1.288 -{\bf Overview:} 
   1.289 -Get the platform/enable\_audio field of the given VM.
   1.290 -
   1.291 - \noindent {\bf Signature:} 
   1.292 -\begin{verbatim} bool get_platform_enable_audio (session_id s, VM ref self)\end{verbatim}
   1.293 -
   1.294 -
   1.295 -\noindent{\bf Arguments:}
   1.296 -
   1.297 - 
   1.298 -\vspace{0.3cm}
   1.299 -\begin{tabular}{|c|c|p{7cm}|}
   1.300 - \hline
   1.301 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.302 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.303 -
   1.304 -\end{tabular}
   1.305 -
   1.306 -\vspace{0.3cm}
   1.307 -
   1.308 - \noindent {\bf Return Type:} 
   1.309 -{\tt 
   1.310 -bool
   1.311 -}
   1.312 -
   1.313 -
   1.314 -value of the field
   1.315 -\vspace{0.3cm}
   1.316 -\vspace{0.3cm}
   1.317 -\vspace{0.3cm}
   1.318 -\subsubsection{RPC name:~set\_platform\_enable\_audio}
   1.319 -
   1.320 -{\bf Overview:} 
   1.321 -Set the platform/enable\_audio field of the given VM.
   1.322 -
   1.323 - \noindent {\bf Signature:} 
   1.324 -\begin{verbatim} void set_platform_enable_audio (session_id s, VM ref self, bool value)\end{verbatim}
   1.325 -
   1.326 -
   1.327 -\noindent{\bf Arguments:}
   1.328 -
   1.329 - 
   1.330 -\vspace{0.3cm}
   1.331 -\begin{tabular}{|c|c|p{7cm}|}
   1.332 - \hline
   1.333 -{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.334 -{\tt VM ref } & self & reference to the object \\ \hline 
   1.335 -
   1.336 -{\tt bool } & value & New value to set \\ \hline 
   1.337 +\subsubsection{RPC name:~get\_platform}
   1.338 +
   1.339 +{\bf Overview:} 
   1.340 +Get the platform field of the given VM.
   1.341 +
   1.342 + \noindent {\bf Signature:} 
   1.343 +\begin{verbatim} ((string -> string) Map) get_platform (session_id s, VM ref self)\end{verbatim}
   1.344 +
   1.345 +
   1.346 +\noindent{\bf Arguments:}
   1.347 +
   1.348 + 
   1.349 +\vspace{0.3cm}
   1.350 +\begin{tabular}{|c|c|p{7cm}|}
   1.351 + \hline
   1.352 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.353 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.354 +
   1.355 +\end{tabular}
   1.356 +
   1.357 +\vspace{0.3cm}
   1.358 +
   1.359 + \noindent {\bf Return Type:} 
   1.360 +{\tt 
   1.361 +(string $\rightarrow$ string) Map
   1.362 +}
   1.363 +
   1.364 +
   1.365 +value of the field
   1.366 +\vspace{0.3cm}
   1.367 +\vspace{0.3cm}
   1.368 +\vspace{0.3cm}
   1.369 +\subsubsection{RPC name:~set\_platform}
   1.370 +
   1.371 +{\bf Overview:} 
   1.372 +Set the platform field of the given VM.
   1.373 +
   1.374 + \noindent {\bf Signature:} 
   1.375 +\begin{verbatim} void set_platform (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
   1.376 +
   1.377 +
   1.378 +\noindent{\bf Arguments:}
   1.379 +
   1.380 + 
   1.381 +\vspace{0.3cm}
   1.382 +\begin{tabular}{|c|c|p{7cm}|}
   1.383 + \hline
   1.384 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.385 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.386 +
   1.387 +{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
   1.388 +
   1.389 +\end{tabular}
   1.390 +
   1.391 +\vspace{0.3cm}
   1.392 +
   1.393 + \noindent {\bf Return Type:} 
   1.394 +{\tt 
   1.395 +void
   1.396 +}
   1.397 +
   1.398 +
   1.399 +
   1.400 +\vspace{0.3cm}
   1.401 +\vspace{0.3cm}
   1.402 +\vspace{0.3cm}
   1.403 +\subsubsection{RPC name:~add\_to\_platform}
   1.404 +
   1.405 +{\bf Overview:} 
   1.406 +Add the given key-value pair to the platform field of the given VM.
   1.407 +
   1.408 + \noindent {\bf Signature:} 
   1.409 +\begin{verbatim} void add_to_platform (session_id s, VM ref self, string key, string value)\end{verbatim}
   1.410 +
   1.411 +
   1.412 +\noindent{\bf Arguments:}
   1.413 +
   1.414 + 
   1.415 +\vspace{0.3cm}
   1.416 +\begin{tabular}{|c|c|p{7cm}|}
   1.417 + \hline
   1.418 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.419 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.420 +
   1.421 +{\tt string } & key & Key to add \\ \hline 
   1.422 +
   1.423 +{\tt string } & value & Value to add \\ \hline 
   1.424 +
   1.425 +\end{tabular}
   1.426 +
   1.427 +\vspace{0.3cm}
   1.428 +
   1.429 + \noindent {\bf Return Type:} 
   1.430 +{\tt 
   1.431 +void
   1.432 +}
   1.433 +
   1.434 +
   1.435 +
   1.436 +\vspace{0.3cm}
   1.437 +\vspace{0.3cm}
   1.438 +\vspace{0.3cm}
   1.439 +\subsubsection{RPC name:~remove\_from\_platform}
   1.440 +
   1.441 +{\bf Overview:} 
   1.442 +Remove the given key and its corresponding value from the platform field of
   1.443 +the given VM.  If the key is not in that Map, then do nothing.
   1.444 +
   1.445 + \noindent {\bf Signature:} 
   1.446 +\begin{verbatim} void remove_from_platform (session_id s, VM ref self, string key)\end{verbatim}
   1.447 +
   1.448 +
   1.449 +\noindent{\bf Arguments:}
   1.450 +
   1.451 + 
   1.452 +\vspace{0.3cm}
   1.453 +\begin{tabular}{|c|c|p{7cm}|}
   1.454 + \hline
   1.455 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.456 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.457 +
   1.458 +{\tt string } & key & Key to remove \\ \hline 
   1.459  
   1.460  \end{tabular}
   1.461  
   1.462 @@ -3769,6 +3572,40 @@ value of the field
   1.463  \vspace{0.3cm}
   1.464  \vspace{0.3cm}
   1.465  \vspace{0.3cm}
   1.466 +\subsubsection{RPC name:~set\_PCI\_bus}
   1.467 +
   1.468 +{\bf Overview:} 
   1.469 +Set the PCI\_bus field of the given VM.
   1.470 +
   1.471 + \noindent {\bf Signature:} 
   1.472 +\begin{verbatim} void set_PCI_bus (session_id s, VM ref self, string value)\end{verbatim}
   1.473 +
   1.474 +
   1.475 +\noindent{\bf Arguments:}
   1.476 +
   1.477 + 
   1.478 +\vspace{0.3cm}
   1.479 +\begin{tabular}{|c|c|p{7cm}|}
   1.480 + \hline
   1.481 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.482 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.483 +
   1.484 +{\tt string } & value & New value to set \\ \hline 
   1.485 +
   1.486 +\end{tabular}
   1.487 +
   1.488 +\vspace{0.3cm}
   1.489 +
   1.490 + \noindent {\bf Return Type:} 
   1.491 +{\tt 
   1.492 +void
   1.493 +}
   1.494 +
   1.495 +
   1.496 +
   1.497 +\vspace{0.3cm}
   1.498 +\vspace{0.3cm}
   1.499 +\vspace{0.3cm}
   1.500  \subsubsection{RPC name:~get\_other\_config}
   1.501  
   1.502  {\bf Overview:} 
     2.1 --- a/tools/libxen/include/xen_vm.h	Sat Mar 10 21:43:07 2007 +0000
     2.2 +++ b/tools/libxen/include/xen_vm.h	Sat Mar 10 21:48:22 2007 +0000
     2.3 @@ -106,11 +106,7 @@ typedef struct xen_vm_record
     2.4      char *pv_bootloader_args;
     2.5      char *hvm_boot_policy;
     2.6      xen_string_string_map *hvm_boot_params;
     2.7 -    bool platform_std_vga;
     2.8 -    char *platform_serial;
     2.9 -    bool platform_localtime;
    2.10 -    bool platform_clock_offset;
    2.11 -    bool platform_enable_audio;
    2.12 +    xen_string_string_map *platform;
    2.13      char *pci_bus;
    2.14      xen_string_string_map *other_config;
    2.15      int64_t domid;
    2.16 @@ -460,38 +456,10 @@ xen_vm_get_hvm_boot_params(xen_session *
    2.17  
    2.18  
    2.19  /**
    2.20 - * Get the platform/std_VGA field of the given VM.
    2.21 - */
    2.22 -extern bool
    2.23 -xen_vm_get_platform_std_vga(xen_session *session, bool *result, xen_vm vm);
    2.24 -
    2.25 -
    2.26 -/**
    2.27 - * Get the platform/serial field of the given VM.
    2.28 + * Get the platform field of the given VM.
    2.29   */
    2.30  extern bool
    2.31 -xen_vm_get_platform_serial(xen_session *session, char **result, xen_vm vm);
    2.32 -
    2.33 -
    2.34 -/**
    2.35 - * Get the platform/localtime field of the given VM.
    2.36 - */
    2.37 -extern bool
    2.38 -xen_vm_get_platform_localtime(xen_session *session, bool *result, xen_vm vm);
    2.39 -
    2.40 -
    2.41 -/**
    2.42 - * Get the platform/clock_offset field of the given VM.
    2.43 - */
    2.44 -extern bool
    2.45 -xen_vm_get_platform_clock_offset(xen_session *session, bool *result, xen_vm vm);
    2.46 -
    2.47 -
    2.48 -/**
    2.49 - * Get the platform/enable_audio field of the given VM.
    2.50 - */
    2.51 -extern bool
    2.52 -xen_vm_get_platform_enable_audio(xen_session *session, bool *result, xen_vm vm);
    2.53 +xen_vm_get_platform(xen_session *session, xen_string_string_map **result, xen_vm vm);
    2.54  
    2.55  
    2.56  /**
    2.57 @@ -732,38 +700,32 @@ xen_vm_remove_from_hvm_boot_params(xen_s
    2.58  
    2.59  
    2.60  /**
    2.61 - * Set the platform/std_VGA field of the given VM.
    2.62 + * Set the platform field of the given VM.
    2.63   */
    2.64  extern bool
    2.65 -xen_vm_set_platform_std_vga(xen_session *session, xen_vm vm, bool std_vga);
    2.66 -
    2.67 -
    2.68 -/**
    2.69 - * Set the platform/serial field of the given VM.
    2.70 - */
    2.71 -extern bool
    2.72 -xen_vm_set_platform_serial(xen_session *session, xen_vm vm, char *serial);
    2.73 +xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map *platform);
    2.74  
    2.75  
    2.76  /**
    2.77 - * Set the platform/localtime field of the given VM.
    2.78 + * Add the given key-value pair to the platform field of the given VM.
    2.79   */
    2.80  extern bool
    2.81 -xen_vm_set_platform_localtime(xen_session *session, xen_vm vm, bool localtime);
    2.82 +xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char *value);
    2.83  
    2.84  
    2.85  /**
    2.86 - * Set the platform/clock_offset field of the given VM.
    2.87 + * Remove the given key and its corresponding value from the platform
    2.88 + * field of the given VM.  If the key is not in that Map, then do nothing.
    2.89   */
    2.90  extern bool
    2.91 -xen_vm_set_platform_clock_offset(xen_session *session, xen_vm vm, bool clock_offset);
    2.92 +xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key);
    2.93  
    2.94  
    2.95  /**
    2.96 - * Set the platform/enable_audio field of the given VM.
    2.97 + * Set the PCI_bus field of the given VM.
    2.98   */
    2.99  extern bool
   2.100 -xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool enable_audio);
   2.101 +xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus);
   2.102  
   2.103  
   2.104  /**
     3.1 --- a/tools/libxen/src/xen_vm.c	Sat Mar 10 21:43:07 2007 +0000
     3.2 +++ b/tools/libxen/src/xen_vm.c	Sat Mar 10 21:48:22 2007 +0000
     3.3 @@ -145,21 +145,9 @@ static const struct_member xen_vm_record
     3.4          { .key = "HVM_boot_params",
     3.5            .type = &abstract_type_string_string_map,
     3.6            .offset = offsetof(xen_vm_record, hvm_boot_params) },
     3.7 -        { .key = "platform_std_VGA",
     3.8 -          .type = &abstract_type_bool,
     3.9 -          .offset = offsetof(xen_vm_record, platform_std_vga) },
    3.10 -        { .key = "platform_serial",
    3.11 -          .type = &abstract_type_string,
    3.12 -          .offset = offsetof(xen_vm_record, platform_serial) },
    3.13 -        { .key = "platform_localtime",
    3.14 -          .type = &abstract_type_bool,
    3.15 -          .offset = offsetof(xen_vm_record, platform_localtime) },
    3.16 -        { .key = "platform_clock_offset",
    3.17 -          .type = &abstract_type_bool,
    3.18 -          .offset = offsetof(xen_vm_record, platform_clock_offset) },
    3.19 -        { .key = "platform_enable_audio",
    3.20 -          .type = &abstract_type_bool,
    3.21 -          .offset = offsetof(xen_vm_record, platform_enable_audio) },
    3.22 +        { .key = "platform",
    3.23 +          .type = &abstract_type_string_string_map,
    3.24 +          .offset = offsetof(xen_vm_record, platform) },
    3.25          { .key = "PCI_bus",
    3.26            .type = &abstract_type_string,
    3.27            .offset = offsetof(xen_vm_record, pci_bus) },
    3.28 @@ -217,7 +205,7 @@ xen_vm_record_free(xen_vm_record *record
    3.29      free(record->pv_bootloader_args);
    3.30      free(record->hvm_boot_policy);
    3.31      xen_string_string_map_free(record->hvm_boot_params);
    3.32 -    free(record->platform_serial);
    3.33 +    xen_string_string_map_free(record->platform);
    3.34      free(record->pci_bus);
    3.35      xen_string_string_map_free(record->other_config);
    3.36      xen_vm_metrics_record_opt_free(record->metrics);
    3.37 @@ -825,23 +813,7 @@ xen_vm_get_hvm_boot_params(xen_session *
    3.38  
    3.39  
    3.40  bool
    3.41 -xen_vm_get_platform_std_vga(xen_session *session, bool *result, xen_vm vm)
    3.42 -{
    3.43 -    abstract_value param_values[] =
    3.44 -        {
    3.45 -            { .type = &abstract_type_string,
    3.46 -              .u.string_val = vm }
    3.47 -        };
    3.48 -
    3.49 -    abstract_type result_type = abstract_type_bool;
    3.50 -
    3.51 -    XEN_CALL_("VM.get_platform_std_VGA");
    3.52 -    return session->ok;
    3.53 -}
    3.54 -
    3.55 -
    3.56 -bool
    3.57 -xen_vm_get_platform_serial(xen_session *session, char **result, xen_vm vm)
    3.58 +xen_vm_get_platform(xen_session *session, xen_string_string_map **result, xen_vm vm)
    3.59  {
    3.60      abstract_value param_values[] =
    3.61          {
    3.62 @@ -849,58 +821,10 @@ xen_vm_get_platform_serial(xen_session *
    3.63                .u.string_val = vm }
    3.64          };
    3.65  
    3.66 -    abstract_type result_type = abstract_type_string;
    3.67 +    abstract_type result_type = abstract_type_string_string_map;
    3.68  
    3.69      *result = NULL;
    3.70 -    XEN_CALL_("VM.get_platform_serial");
    3.71 -    return session->ok;
    3.72 -}
    3.73 -
    3.74 -
    3.75 -bool
    3.76 -xen_vm_get_platform_localtime(xen_session *session, bool *result, xen_vm vm)
    3.77 -{
    3.78 -    abstract_value param_values[] =
    3.79 -        {
    3.80 -            { .type = &abstract_type_string,
    3.81 -              .u.string_val = vm }
    3.82 -        };
    3.83 -
    3.84 -    abstract_type result_type = abstract_type_bool;
    3.85 -
    3.86 -    XEN_CALL_("VM.get_platform_localtime");
    3.87 -    return session->ok;
    3.88 -}
    3.89 -
    3.90 -
    3.91 -bool
    3.92 -xen_vm_get_platform_clock_offset(xen_session *session, bool *result, xen_vm vm)
    3.93 -{
    3.94 -    abstract_value param_values[] =
    3.95 -        {
    3.96 -            { .type = &abstract_type_string,
    3.97 -              .u.string_val = vm }
    3.98 -        };
    3.99 -
   3.100 -    abstract_type result_type = abstract_type_bool;
   3.101 -
   3.102 -    XEN_CALL_("VM.get_platform_clock_offset");
   3.103 -    return session->ok;
   3.104 -}
   3.105 -
   3.106 -
   3.107 -bool
   3.108 -xen_vm_get_platform_enable_audio(xen_session *session, bool *result, xen_vm vm)
   3.109 -{
   3.110 -    abstract_value param_values[] =
   3.111 -        {
   3.112 -            { .type = &abstract_type_string,
   3.113 -              .u.string_val = vm }
   3.114 -        };
   3.115 -
   3.116 -    abstract_type result_type = abstract_type_bool;
   3.117 -
   3.118 -    XEN_CALL_("VM.get_platform_enable_audio");
   3.119 +    XEN_CALL_("VM.get_platform");
   3.120      return session->ok;
   3.121  }
   3.122  
   3.123 @@ -1442,81 +1366,67 @@ xen_vm_remove_from_hvm_boot_params(xen_s
   3.124  
   3.125  
   3.126  bool
   3.127 -xen_vm_set_platform_std_vga(xen_session *session, xen_vm vm, bool std_vga)
   3.128 +xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map *platform)
   3.129  {
   3.130      abstract_value param_values[] =
   3.131          {
   3.132              { .type = &abstract_type_string,
   3.133                .u.string_val = vm },
   3.134 -            { .type = &abstract_type_bool,
   3.135 -              .u.bool_val = std_vga }
   3.136 +            { .type = &abstract_type_string_string_map,
   3.137 +              .u.set_val = (arbitrary_set *)platform }
   3.138          };
   3.139  
   3.140 -    xen_call_(session, "VM.set_platform_std_VGA", param_values, 2, NULL, NULL);
   3.141 +    xen_call_(session, "VM.set_platform", param_values, 2, NULL, NULL);
   3.142      return session->ok;
   3.143  }
   3.144  
   3.145  
   3.146  bool
   3.147 -xen_vm_set_platform_serial(xen_session *session, xen_vm vm, char *serial)
   3.148 +xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char *value)
   3.149  {
   3.150      abstract_value param_values[] =
   3.151          {
   3.152              { .type = &abstract_type_string,
   3.153                .u.string_val = vm },
   3.154              { .type = &abstract_type_string,
   3.155 -              .u.string_val = serial }
   3.156 +              .u.string_val = key },
   3.157 +            { .type = &abstract_type_string,
   3.158 +              .u.string_val = value }
   3.159          };
   3.160  
   3.161 -    xen_call_(session, "VM.set_platform_serial", param_values, 2, NULL, NULL);
   3.162 -    return session->ok;
   3.163 -}
   3.164 -
   3.165 -
   3.166 -bool
   3.167 -xen_vm_set_platform_localtime(xen_session *session, xen_vm vm, bool localtime)
   3.168 -{
   3.169 -    abstract_value param_values[] =
   3.170 -        {
   3.171 -            { .type = &abstract_type_string,
   3.172 -              .u.string_val = vm },
   3.173 -            { .type = &abstract_type_bool,
   3.174 -              .u.bool_val = localtime }
   3.175 -        };
   3.176 -
   3.177 -    xen_call_(session, "VM.set_platform_localtime", param_values, 2, NULL, NULL);
   3.178 +    xen_call_(session, "VM.add_to_platform", param_values, 3, NULL, NULL);
   3.179      return session->ok;
   3.180  }
   3.181  
   3.182  
   3.183  bool
   3.184 -xen_vm_set_platform_clock_offset(xen_session *session, xen_vm vm, bool clock_offset)
   3.185 +xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key)
   3.186  {
   3.187      abstract_value param_values[] =
   3.188          {
   3.189              { .type = &abstract_type_string,
   3.190                .u.string_val = vm },
   3.191 -            { .type = &abstract_type_bool,
   3.192 -              .u.bool_val = clock_offset }
   3.193 +            { .type = &abstract_type_string,
   3.194 +              .u.string_val = key }
   3.195          };
   3.196  
   3.197 -    xen_call_(session, "VM.set_platform_clock_offset", param_values, 2, NULL, NULL);
   3.198 +    xen_call_(session, "VM.remove_from_platform", param_values, 2, NULL, NULL);
   3.199      return session->ok;
   3.200  }
   3.201  
   3.202  
   3.203  bool
   3.204 -xen_vm_set_platform_enable_audio(xen_session *session, xen_vm vm, bool enable_audio)
   3.205 +xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus)
   3.206  {
   3.207      abstract_value param_values[] =
   3.208          {
   3.209              { .type = &abstract_type_string,
   3.210                .u.string_val = vm },
   3.211 -            { .type = &abstract_type_bool,
   3.212 -              .u.bool_val = enable_audio }
   3.213 +            { .type = &abstract_type_string,
   3.214 +              .u.string_val = pci_bus }
   3.215          };
   3.216  
   3.217 -    xen_call_(session, "VM.set_platform_enable_audio", param_values, 2, NULL, NULL);
   3.218 +    xen_call_(session, "VM.set_PCI_bus", param_values, 2, NULL, NULL);
   3.219      return session->ok;
   3.220  }
   3.221  
     4.1 --- a/tools/python/xen/xend/XendAPI.py	Sat Mar 10 21:43:07 2007 +0000
     4.2 +++ b/tools/python/xen/xend/XendAPI.py	Sat Mar 10 21:48:22 2007 +0000
     4.3 @@ -676,8 +676,9 @@ class XendAPI(object):
     4.4          return xen_api_success_void()
     4.5      def host_remove_from_other_config(self, session, host_ref, key):
     4.6          node = XendNode.instance()
     4.7 -        del node.other_config[key]
     4.8 -        node.save()
     4.9 +        if key in node.other_config:
    4.10 +            del node.other_config[key]
    4.11 +            node.save()
    4.12          return xen_api_success_void()
    4.13      def host_get_API_version_major(self, _, ref):
    4.14          return xen_api_success(XEN_API_VERSION_MAJOR)
    4.15 @@ -998,7 +999,6 @@ class XendAPI(object):
    4.16                    'VIFs',
    4.17                    'VBDs',
    4.18                    'VTPMs',
    4.19 -                  'PCI_bus',
    4.20                    'tools_version',
    4.21                    'domid',
    4.22                    'is_control_domain',
    4.23 @@ -1024,12 +1024,8 @@ class XendAPI(object):
    4.24                    'PV_bootloader_args',
    4.25                    'HVM_boot_policy',
    4.26                    'HVM_boot_params',
    4.27 -                  'platform_std_VGA',
    4.28 -                  'platform_serial',
    4.29 -                  'platform_localtime',
    4.30 -                  'platform_clock_offset',
    4.31 -                  'platform_enable_audio',
    4.32 -                  'platform_keymap',
    4.33 +                  'platform',
    4.34 +                  'PCI_bus',
    4.35                    'other_config']
    4.36  
    4.37      VM_methods = [('clone', 'VM'),
    4.38 @@ -1042,6 +1038,10 @@ class XendAPI(object):
    4.39                    ('hard_reboot', None),
    4.40                    ('suspend', None),
    4.41                    ('resume', None),
    4.42 +                  ('add_to_HVM_boot_params', None),
    4.43 +                  ('remove_from_HVM_boot_params', None),
    4.44 +                  ('add_to_platform', None),
    4.45 +                  ('remove_from_platform', None),
    4.46                    ('add_to_other_config', None),
    4.47                    ('remove_from_other_config', None)]
    4.48      
    4.49 @@ -1071,13 +1071,7 @@ class XendAPI(object):
    4.50          'PV_bootloader_args',
    4.51          'HVM_boot_policy',
    4.52          'HVM_boot_params',
    4.53 -        'platform_std_VGA',
    4.54 -        'platform_serial',
    4.55 -        'platform_localtime',
    4.56 -        'platform_clock_offset',
    4.57 -        'platform_enable_audio',
    4.58 -        'platform_keymap',
    4.59 -        'grub_cmdline',
    4.60 +        'platform',
    4.61          'PCI_bus',
    4.62          'other_config']
    4.63          
    4.64 @@ -1089,7 +1083,10 @@ class XendAPI(object):
    4.65          xd = XendDomain.instance()
    4.66          dominfo = xd.get_vm_by_uuid(vm_ref)
    4.67          dominfo.info[name] = value
    4.68 -        xd.managed_config_save(dominfo)
    4.69 +        return self._VM_save(dominfo)
    4.70 +
    4.71 +    def _VM_save(self, dominfo):
    4.72 +        XendDomain.instance().managed_config_save(dominfo)
    4.73          return xen_api_success_void()
    4.74  
    4.75      # attributes (ro)
    4.76 @@ -1136,10 +1133,6 @@ class XendAPI(object):
    4.77          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.78          return xen_api_success(dom.get_consoles())
    4.79      
    4.80 -    def VM_get_PCI_bus(self, session, vm_ref):
    4.81 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.82 -        return dom.get_pci_bus()
    4.83 -    
    4.84      def VM_get_tools_version(self, session, vm_ref):
    4.85          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.86          return dom.get_tools_version()
    4.87 @@ -1214,29 +1207,16 @@ class XendAPI(object):
    4.88      def VM_get_HVM_boot_params(self, session, vm_ref):
    4.89          return self.VM_get('HVM_boot_params', session, vm_ref)
    4.90      
    4.91 -    def VM_get_platform_std_VGA(self, session, vm_ref):
    4.92 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.93 -        return xen_api_success(dom.get_platform_std_vga())
    4.94 -    
    4.95 -    def VM_get_platform_serial(self, session, vm_ref):
    4.96 +    def VM_get_platform(self, session, vm_ref):
    4.97          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    4.98 -        return xen_api_success(dom.get_platform_serial())        
    4.99 -    
   4.100 -    def VM_get_platform_localtime(self, session, vm_ref):
   4.101 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.102 -        return xen_api_success(dom.get_platform_localtime())
   4.103 +        return xen_api_success(dom.get_platform())
   4.104      
   4.105 -    def VM_get_platform_clock_offset(self, session, vm_ref):
   4.106 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.107 -        return xen_api_success(dom.get_platform_clock_offset())        
   4.108 -    
   4.109 -    def VM_get_platform_enable_audio(self, session, vm_ref):
   4.110 +    def VM_get_PCI_bus(self, session, vm_ref):
   4.111          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.112 -        return xen_api_success(dom.get_platform_enable_audio())        
   4.113 +        return dom.get_pci_bus()
   4.114      
   4.115 -    def VM_get_platform_keymap(self, session, vm_ref):
   4.116 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.117 -        return xen_api_success(dom.get_platform_keymap())
   4.118 +    def VM_set_PCI_bus(self, session, vm_ref, val):
   4.119 +        return self.VM_set('PCI_bus', session, vm_ref, val)
   4.120      
   4.121      def VM_get_other_config(self, session, vm_ref):
   4.122          return self.VM_get('other_config', session, vm_ref)        
   4.123 @@ -1253,7 +1233,7 @@ class XendAPI(object):
   4.124      def VM_set_name_label(self, session, vm_ref, label):
   4.125          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.126          dom.setName(label)
   4.127 -        return xen_api_success_void()
   4.128 +        return self._VM_save(dom)
   4.129      
   4.130      def VM_set_name_description(self, session, vm_ref, desc):
   4.131          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.132 @@ -1319,14 +1299,16 @@ class XendAPI(object):
   4.133          if 'HVM_boot_params' not in dom.info:
   4.134              dom.info['HVM_boot_params'] = {}
   4.135          dom.info['HVM_boot_params'][key] = value
   4.136 -        return xen_api_success_void()
   4.137 +        return self._VM_save(dom)
   4.138  
   4.139      def VM_remove_from_HVM_boot_params(self, session, vm_ref, key):
   4.140          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.141          if 'HVM_boot_params' in dom.info \
   4.142                 and key in dom.info['HVM_boot_params']:
   4.143              del dom.info['HVM_boot_params'][key]
   4.144 -        return xen_api_success_void()
   4.145 +            return self._VM_save(dom)
   4.146 +        else:
   4.147 +            return xen_api_success_void()
   4.148  
   4.149      def VM_set_PV_bootloader(self, session, vm_ref, value):
   4.150          return self.VM_set('PV_bootloader', session, vm_ref, value)
   4.151 @@ -1343,40 +1325,42 @@ class XendAPI(object):
   4.152      def VM_set_PV_bootloader_args(self, session, vm_ref, value):
   4.153          return self.VM_set('PV_bootloader_args', session, vm_ref, value)
   4.154  
   4.155 -    def VM_set_platform_std_VGA(self, session, vm_ref, value):
   4.156 -        return self.VM_set('platform_std_vga', session, vm_ref, value)
   4.157 -    
   4.158 -    def VM_set_platform_serial(self, session, vm_ref, value):
   4.159 -        return self.VM_set('platform_serial', session, vm_ref, value)
   4.160 -
   4.161 -    def VM_set_platform_keymap(self, session, vm_ref, value):
   4.162 -        return self.VM_set('platform_keymap', session, vm_ref, value)
   4.163 +    def VM_set_platform(self, session, vm_ref, value):
   4.164 +        return self.VM_set('platform', session, vm_ref, value)
   4.165      
   4.166 -    def VM_set_platform_localtime(self, session, vm_ref, value):
   4.167 -        return self.VM_set('platform_localtime', session, vm_ref, value)
   4.168 -    
   4.169 -    def VM_set_platform_clock_offset(self, session, vm_ref, value):
   4.170 -        return self.VM_set('platform_clock_offset', session, vm_ref, value)
   4.171 -    
   4.172 -    def VM_set_platform_enable_audio(self, session, vm_ref, value):
   4.173 -        return self.VM_set('platform_enable_audio', session, vm_ref, value)
   4.174 -    
   4.175 +    def VM_add_to_platform(self, session, vm_ref, key, value):
   4.176 +        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.177 +        plat = dom.get_platform()
   4.178 +        plat[key] = value
   4.179 +        return self.VM_set_platform(session, vm_ref, plat)
   4.180 +
   4.181 +    def VM_remove_from_platform(self, session, vm_ref, key):
   4.182 +        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.183 +        plat = dom.get_platform()
   4.184 +        if key in plat:
   4.185 +            del plat[key]
   4.186 +            return self.VM_set_platform(session, vm_ref, plat)
   4.187 +        else:
   4.188 +            return xen_api_success_void()
   4.189 +
   4.190      def VM_set_other_config(self, session, vm_ref, value):
   4.191 -        return self.VM_set('otherconfig', session, vm_ref, value)
   4.192 +        return self.VM_set('other_config', session, vm_ref, value)
   4.193  
   4.194      def VM_add_to_other_config(self, session, vm_ref, key, value):
   4.195          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.196 -        if dom and 'otherconfig' in dom.info:
   4.197 -            dom.info['otherconfig'][key] = value
   4.198 -        return xen_api_success_void()
   4.199 +        if dom and 'other_config' in dom.info:
   4.200 +            dom.info['other_config'][key] = value
   4.201 +        return self._VM_save(dom)
   4.202  
   4.203      def VM_remove_from_other_config(self, session, vm_ref, key):
   4.204          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   4.205 -        if dom and 'otherconfig' in dom.info \
   4.206 -               and key in dom.info['otherconfig']:
   4.207 -            del dom.info['otherconfig'][key]
   4.208 -        return xen_api_success_void()        
   4.209 -    
   4.210 +        if dom and 'other_config' in dom.info \
   4.211 +               and key in dom.info['other_config']:
   4.212 +            del dom.info['other_config'][key]
   4.213 +            return self._VM_save(dom)
   4.214 +        else:
   4.215 +            return xen_api_success_void()
   4.216 +
   4.217      # class methods
   4.218      def VM_get_all(self, session):
   4.219          refs = [d.get_uuid() for d in XendDomain.instance().list('all')]
   4.220 @@ -1437,12 +1421,7 @@ class XendAPI(object):
   4.221              'PV_bootloader_args': xeninfo.info.get('PV_bootloader_args'),
   4.222              'HVM_boot_policy': xeninfo.info.get('HVM_boot_policy'),
   4.223              'HVM_boot_params': xeninfo.info.get('HVM_boot_params'),
   4.224 -            'platform_std_VGA': xeninfo.get_platform_std_vga(),
   4.225 -            'platform_serial': xeninfo.get_platform_serial(),
   4.226 -            'platform_localtime': xeninfo.get_platform_localtime(),
   4.227 -            'platform_clock_offset': xeninfo.get_platform_clock_offset(),
   4.228 -            'platform_enable_audio': xeninfo.get_platform_enable_audio(),
   4.229 -            'platform_keymap': xeninfo.get_platform_keymap(),
   4.230 +            'platform': xeninfo.get_platform(),
   4.231              'PCI_bus': xeninfo.get_pci_bus(),
   4.232              'tools_version': xeninfo.get_tools_version(),
   4.233              'other_config': xeninfo.info.get('other_config', {}),
     5.1 --- a/tools/python/xen/xend/XendConfig.py	Sat Mar 10 21:43:07 2007 +0000
     5.2 +++ b/tools/python/xen/xend/XendConfig.py	Sat Mar 10 21:48:22 2007 +0000
     5.3 @@ -12,7 +12,7 @@
     5.4  # License along with this library; if not, write to the Free Software
     5.5  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     5.6  #============================================================================
     5.7 -# Copyright (C) 2006 XenSource Ltd
     5.8 +# Copyright (C) 2006-2007 XenSource Ltd
     5.9  #============================================================================
    5.10  
    5.11  import logging
    5.12 @@ -111,22 +111,18 @@ XENAPI_CFG_TO_LEGACY_CFG = {
    5.13      'actions_after_shutdown': 'on_poweroff',
    5.14      'actions_after_reboot': 'on_reboot',
    5.15      'actions_after_crash': 'on_crash', 
    5.16 -    'platform_localtime': 'localtime',
    5.17      'PV_bootloader': 'bootloader',
    5.18      'PV_bootloader_args': 'bootloader_args',
    5.19  }
    5.20  
    5.21  LEGACY_CFG_TO_XENAPI_CFG = reverse_dict(XENAPI_CFG_TO_LEGACY_CFG)
    5.22  
    5.23 -# Mapping from XendConfig configuration keys to the old
    5.24 -# legacy configuration keys that are found in the 'image'
    5.25 -# SXP object.
    5.26 -XENAPI_HVM_CFG = {
    5.27 -    'platform_std_vga': 'stdvga',
    5.28 -    'platform_serial' : 'serial',
    5.29 -    'platform_localtime': 'localtime',
    5.30 -    'platform_keymap' : 'keymap'
    5.31 -}    
    5.32 +# Platform configuration keys.
    5.33 +XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'device_model', 'display', 'fda',
    5.34 +                        'fdb', 'keymap', 'isa', 'localtime', 'nographic',
    5.35 +                        'pae', 'serial', 'sdl', 'soundhw','stdvga', 'usb',
    5.36 +                        'usbdevice', 'vnc', 'vncconsole', 'vncdisplay',
    5.37 +                        'vnclisten', 'vncpasswd', 'vncunused', 'xauthority']
    5.38  
    5.39  # List of XendConfig configuration keys that have no direct equivalent
    5.40  # in the old world.
    5.41 @@ -158,15 +154,10 @@ XENAPI_CFG_TYPES = {
    5.42      'PV_bootloader_args': str,
    5.43      'HVM_boot_policy': str,
    5.44      'HVM_boot_params': dict,
    5.45 -    'platform_std_vga': bool0,
    5.46 -    'platform_serial': str,
    5.47 -    'platform_localtime': bool0,
    5.48 -    'platform_clock_offset': bool0,
    5.49 -    'platform_enable_audio': bool0,
    5.50 -    'platform_keymap': str,
    5.51 -    'pci_bus': str,
    5.52 +    'PCI_bus': str,
    5.53 +    'platform': dict,
    5.54      'tools_version': dict,
    5.55 -    'otherconfig': dict,
    5.56 +    'other_config': dict,
    5.57  }
    5.58  
    5.59  # List of legacy configuration keys that have no equivalent in the
    5.60 @@ -236,44 +227,7 @@ LEGACY_XENSTORE_VM_PARAMS = [
    5.61      'on_xend_stop',
    5.62  ]
    5.63  
    5.64 -LEGACY_IMAGE_CFG = [
    5.65 -    ('root', str),
    5.66 -    ('ip', str),
    5.67 -    ('nographic', int),
    5.68 -    ('vnc', int),
    5.69 -    ('sdl', int),
    5.70 -    ('vncdisplay', int),
    5.71 -    ('vncunused', int),
    5.72 -    ('vncpasswd', str),
    5.73 -    ('vnclisten', str),
    5.74 -]
    5.75 -
    5.76 -LEGACY_IMAGE_HVM_CFG = [
    5.77 -    ('device_model', str),
    5.78 -    ('display', str),
    5.79 -    ('xauthority', str),
    5.80 -    ('vncconsole', int),
    5.81 -    ('pae', int),
    5.82 -    ('apic', int),
    5.83 -]
    5.84 -
    5.85 -LEGACY_IMAGE_HVM_DEVICES_CFG = [
    5.86 -    ('acpi', int),    
    5.87 -    ('boot', str),
    5.88 -    ('fda', str),
    5.89 -    ('fdb', str),
    5.90 -    ('isa', int),
    5.91 -    ('keymap', str),    
    5.92 -    ('localtime', int),    
    5.93 -    ('serial', str),
    5.94 -    ('stdvga', int),
    5.95 -    ('soundhw', str),
    5.96 -    ('usb', int),
    5.97 -    ('usbdevice', str),    
    5.98 -    ('vcpus', int),
    5.99 -]
   5.100 -
   5.101 -LEGACY_DM = '/usr/lib/xen/bin/qemu-dm'
   5.102 +DEFAULT_DM = '/usr/lib/xen/bin/qemu-dm'
   5.103  
   5.104  ##
   5.105  ## Config Choices
   5.106 @@ -315,7 +269,6 @@ class XendConfig(dict):
   5.107              self._sxp_to_xapi_unsupported(sxp_obj)
   5.108          elif xapi:
   5.109              self.update_with_xenapi_config(xapi)
   5.110 -            self._add_xapi_unsupported(xapi)
   5.111          elif dominfo:
   5.112              # output from xc.domain_getinfo
   5.113              self._dominfo_to_xapi(dominfo)
   5.114 @@ -362,7 +315,6 @@ class XendConfig(dict):
   5.115              'memory_dynamic_max': 0,
   5.116              'memory_actual': 0,
   5.117              'devices': {},
   5.118 -            'image': {},
   5.119              'security': None,
   5.120              'on_xend_start': 'ignore',
   5.121              'on_xend_stop': 'ignore',
   5.122 @@ -376,6 +328,7 @@ class XendConfig(dict):
   5.123              'vbd_refs': [],
   5.124              'vtpm_refs': [],
   5.125              'other_config': {},
   5.126 +            'platform': {}
   5.127          }
   5.128          
   5.129          return defaults
   5.130 @@ -416,12 +369,23 @@ class XendConfig(dict):
   5.131          if 'name_label' not in self:
   5.132              self['name_label'] = 'Domain-' + self['uuid']
   5.133  
   5.134 +    def _platform_sanity_check(self):
   5.135 +        if self.is_hvm():
   5.136 +            if 'device_model' not in self['platform']:
   5.137 +                self['platform']['device_model'] = DEFAULT_DM
   5.138 +
   5.139 +            # Compatibility hack, can go away soon.
   5.140 +            if 'soundhw' not in self['platform'] and \
   5.141 +               self['platform'].get('enable_audio'):
   5.142 +                self['platform']['soundhw'] = 'sb16'
   5.143 +
   5.144      def validate(self):
   5.145          self._uuid_sanity_check()
   5.146          self._name_sanity_check()
   5.147          self._memory_sanity_check()
   5.148          self._actions_sanity_check()
   5.149          self._vcpus_sanity_check()
   5.150 +        self._platform_sanity_check()
   5.151  
   5.152      def _dominfo_to_xapi(self, dominfo):
   5.153          self['domid'] = dominfo['domid']
   5.154 @@ -497,6 +461,18 @@ class XendConfig(dict):
   5.155                      log.warn("Unable to parse key %s: %s: %s" %
   5.156                               (key, str(val), e))
   5.157  
   5.158 +        if 'platform' not in cfg:
   5.159 +            cfg['platform'] = {}
   5.160 +        localtime = sxp.child_value(sxp_cfg, 'localtime')
   5.161 +        if localtime is not None:
   5.162 +            cfg['platform']['localtime'] = localtime
   5.163 +
   5.164 +        # Compatibility hack -- can go soon.
   5.165 +        for key in XENAPI_PLATFORM_CFG:
   5.166 +            val = sxp.child_value(sxp_cfg, "platform_" + key, None)
   5.167 +            if val is not None:
   5.168 +                self['platform'][key] = val
   5.169 +
   5.170          # Compatibility hack -- can go soon.
   5.171          boot_order = sxp.child_value(sxp_cfg, 'HVM_boot')
   5.172          if boot_order:
   5.173 @@ -651,10 +627,9 @@ class XendConfig(dict):
   5.174              self.update_with_image_sxp(image_sxp)
   5.175  
   5.176          # Convert Legacy HVM parameters to Xen API configuration
   5.177 -        self['platform_std_vga'] = bool0(cfg.get('stdvga', 0))
   5.178 -        self['platform_serial'] = str(cfg.get('serial', ''))
   5.179 -        self['platform_localtime'] = bool0(cfg.get('localtime', 0))
   5.180 -        self['platform_enable_audio'] = bool0(cfg.get('soundhw', 0))
   5.181 +        for key in XENAPI_PLATFORM_CFG:
   5.182 +            if key in cfg:
   5.183 +                self['platform'][key] = cfg[key]
   5.184  
   5.185          # make sure a sane maximum is set
   5.186          if self['memory_static_max'] <= 0:
   5.187 @@ -671,7 +646,7 @@ class XendConfig(dict):
   5.188          self['vtpm_refs'] = cfg.get('vtpm_refs', [])
   5.189  
   5.190          # coalesce hvm vnc frame buffer with vfb config
   5.191 -        if self['image']['type'] == 'hvm' and self['image'].get('vnc', 0):
   5.192 +        if self.is_hvm() and self['platform'].get('vnc', 0):
   5.193              # add vfb device if it isn't there already
   5.194              has_rfb = False
   5.195              for console_uuid in self['console_refs']:
   5.196 @@ -684,11 +659,11 @@ class XendConfig(dict):
   5.197  
   5.198              if not has_rfb:
   5.199                  dev_config = ['vfb']
   5.200 -                # copy VNC related params from image config to vfb dev conf
   5.201 +                # copy VNC related params from platform config to vfb dev conf
   5.202                  for key in ['vncpasswd', 'vncunused', 'vncdisplay',
   5.203                              'vnclisten']:
   5.204 -                    if key in self['image']:
   5.205 -                        dev_config.append([key, self['image'][key]])
   5.206 +                    if key in self['platform']:
   5.207 +                        dev_config.append([key, self['platform'][key]])
   5.208  
   5.209                  self.device_add('vfb', cfg_sxp = dev_config)
   5.210  
   5.211 @@ -705,39 +680,19 @@ class XendConfig(dict):
   5.212          # the image (as well as HVM images)
   5.213          image_sxp = sxp.child_value(sxp_cfg, 'image', [])
   5.214          if image_sxp:
   5.215 -            image = {}
   5.216 -            image['type'] = sxp.name(image_sxp)
   5.217 -            for arg, conv in LEGACY_IMAGE_CFG:
   5.218 -                val = sxp.child_value(image_sxp, arg, None)
   5.219 -                if val != None:
   5.220 -                    image[arg] = conv(val)
   5.221 -
   5.222 -            image_hvm = {}
   5.223 -            for arg, conv in LEGACY_IMAGE_HVM_CFG:
   5.224 -                val = sxp.child_value(image_sxp, arg, None)
   5.225 -                if val != None:
   5.226 -                    image_hvm[arg] = conv(val)
   5.227 -                    
   5.228 -            image_hvm_devices = {}
   5.229 -            for arg, conv in LEGACY_IMAGE_HVM_DEVICES_CFG:
   5.230 -                val = sxp.child_value(image_sxp, arg, None)
   5.231 -                if val != None:
   5.232 -                    image_hvm_devices[arg] = conv(val)
   5.233 -
   5.234 -            if image_hvm or image_hvm_devices:
   5.235 -                image['hvm'] = image_hvm
   5.236 -                image['hvm']['devices'] = image_hvm_devices
   5.237 -
   5.238 +            image_type = sxp.name(image_sxp)
   5.239 +            if image_type != 'hvm' and image_type != 'linux':
   5.240 +                self['platform']['image_type'] = image_type
   5.241 +            
   5.242 +            for key in XENAPI_PLATFORM_CFG:
   5.243 +                val = sxp.child_value(image_sxp, key, None)
   5.244 +                if val is not None:
   5.245 +                    self['platform'][key] = val
   5.246 +            
   5.247              notes = sxp.children(image_sxp, 'notes')
   5.248              if notes:
   5.249 -                image['notes'] = self.notes_from_sxp(notes[0])
   5.250 -
   5.251 -            self['image'] = image
   5.252 +                self['notes'] = self.notes_from_sxp(notes[0])
   5.253  
   5.254 -            for apikey, imgkey in XENAPI_HVM_CFG.items():
   5.255 -                val = sxp.child_value(image_sxp, imgkey, None)
   5.256 -                if val != None:
   5.257 -                    self[apikey] = val
   5.258              self._hvm_boot_params_from_sxp(image_sxp)
   5.259  
   5.260          # extract backend value
   5.261 @@ -773,33 +728,6 @@ class XendConfig(dict):
   5.262          _set_cfg_if_exists('up_time')
   5.263          _set_cfg_if_exists('status') # TODO, deprecated  
   5.264  
   5.265 -    def _add_xapi_unsupported(self, xapi_dict):
   5.266 -        """Updates the configuration object with entries that are not
   5.267 -        officially supported by the Xen API but is required for
   5.268 -        the rest of Xend to function.
   5.269 -        """
   5.270 -
   5.271 -        # populate image
   5.272 -        if 'image' in xapi_dict:
   5.273 -            self['image'].update(xapi_dict['image'])
   5.274 -        else:
   5.275 -            hvm = self['HVM_boot_policy'] != ''
   5.276 -            self['image']['type'] = hvm and 'hvm' or 'linux'
   5.277 -            if hvm:
   5.278 -                self['image']['hvm'] = {'devices': {}}
   5.279 -                for xapi, cfgapi in XENAPI_HVM_CFG.items():
   5.280 -                    if xapi in self:
   5.281 -                        self['image']['hvm']['devices'][cfgapi] = self[xapi]
   5.282 -
   5.283 -                # currently unsupported options
   5.284 -                self['image']['hvm']['device_model'] = LEGACY_DM
   5.285 -                self['image']['vnc'] = 0
   5.286 -                self['image']['hvm']['pae'] = 1
   5.287 -
   5.288 -                if self['platform_enable_audio']:
   5.289 -                    self['image']['hvm']['devices']['soundhw'] = 'sb16'
   5.290 -
   5.291 -
   5.292      def _get_old_state_string(self):
   5.293          """Returns the old xm state string.
   5.294          @rtype: string
   5.295 @@ -889,9 +817,7 @@ class XendConfig(dict):
   5.296              if self.has_key(legacy) and self[legacy] not in (None, []):
   5.297                  sxpr.append([legacy, self[legacy]])
   5.298  
   5.299 -        if 'image' in self and self['image']:
   5.300 -            sxpr.append(['image', self.image_sxpr()])
   5.301 -
   5.302 +        sxpr.append(['image', self.image_sxpr()])
   5.303          sxpr.append(['status', domain.state])
   5.304          sxpr.append(['memory_dynamic_min',  self.get('memory_dynamic_min')])
   5.305          sxpr.append(['memory_dynamic_max',  self.get('memory_dynamic_max')])
   5.306 @@ -1338,7 +1264,7 @@ class XendConfig(dict):
   5.307      def image_sxpr(self):
   5.308          """Returns a backwards compatible image SXP expression that is
   5.309          used in xenstore's /vm/<uuid>/image value and xm list."""
   5.310 -        image = [self['image'].get('type', 'linux')]
   5.311 +        image = [self.image_type()]
   5.312          if self.has_key('PV_kernel'):
   5.313              image.append(['kernel', self['PV_kernel']])
   5.314          if self.has_key('PV_ramdisk') and self['PV_ramdisk']:
   5.315 @@ -1346,28 +1272,12 @@ class XendConfig(dict):
   5.316          if self.has_key('PV_args') and self['PV_args']:
   5.317              image.append(['args', self['PV_args']])
   5.318  
   5.319 -        for arg, conv in LEGACY_IMAGE_CFG:
   5.320 -            if self['image'].has_key(arg):
   5.321 -                image.append([arg, self['image'][arg]])
   5.322 -
   5.323 -        if 'hvm' in self['image']:
   5.324 -            for arg, conv in LEGACY_IMAGE_HVM_CFG:
   5.325 -                if self['image']['hvm'].get(arg):
   5.326 -                    image.append([arg, conv(self['image']['hvm'][arg])])
   5.327 +        for key in XENAPI_PLATFORM_CFG:
   5.328 +            if key in self['platform']:
   5.329 +                image.append([key, self['platform'][key]])
   5.330  
   5.331 -        if 'hvm' in self['image'] and 'devices' in self['image']['hvm']:
   5.332 -            for arg, conv in LEGACY_IMAGE_HVM_DEVICES_CFG:
   5.333 -                val = self['image']['hvm']['devices'].get(arg)
   5.334 -                if val != None:
   5.335 -                    try:
   5.336 -                        if conv: val = conv(val)
   5.337 -                    except (ValueError, TypeError):
   5.338 -                        if type(val) == bool: val = int(val)
   5.339 -                            
   5.340 -                    image.append([arg, val])
   5.341 -
   5.342 -        if 'notes' in self['image']:
   5.343 -            image.append(self.notes_sxp(self['image']['notes']))
   5.344 +        if 'notes' in self:
   5.345 +            image.append(self.notes_sxp(self['notes']))
   5.346  
   5.347          return image
   5.348  
   5.349 @@ -1398,57 +1308,24 @@ class XendConfig(dict):
   5.350              self['PV_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
   5.351              self['PV_args'] = kernel_args
   5.352  
   5.353 -        # Store image SXP in python dictionary format
   5.354 -        image = {}
   5.355 -        image['type'] = sxp.name(image_sxp)
   5.356 -        for arg, conv in LEGACY_IMAGE_CFG:
   5.357 -            val = sxp.child_value(image_sxp, arg, None)
   5.358 -            if val != None:
   5.359 -                image[arg] = conv(val)
   5.360 -
   5.361 -        image_hvm = {}
   5.362 -        for arg, conv in LEGACY_IMAGE_HVM_CFG:
   5.363 -            val = sxp.child_value(image_sxp, arg, None)
   5.364 -            if val != None:
   5.365 -                image_hvm[arg] = conv(val)
   5.366 -                    
   5.367 -        image_hvm_devices = {}
   5.368 -        for arg, conv in LEGACY_IMAGE_HVM_DEVICES_CFG:
   5.369 -            val = sxp.child_value(image_sxp, arg, None)
   5.370 -            if val != None:
   5.371 -                try:
   5.372 -                    image_hvm_devices[arg] = conv(val)
   5.373 -                except (ValueError, TypeError):
   5.374 -                    image_hvm_devices[arg] = val
   5.375 -                        
   5.376 -
   5.377 -        if image_hvm or image_hvm_devices:
   5.378 -            image['hvm'] = image_hvm
   5.379 -            image['hvm']['devices'] = image_hvm_devices
   5.380 +        for key in XENAPI_PLATFORM_CFG:
   5.381 +            val = sxp.child_value(image_sxp, key, None)
   5.382 +            if val is not None:
   5.383 +                self['platform'][key] = val
   5.384  
   5.385          notes = sxp.children(image_sxp, 'notes')
   5.386          if notes:
   5.387 -            image['notes'] = self.notes_from_sxp(notes[0])
   5.388 -
   5.389 -        self['image'] = image
   5.390 +            self['notes'] = self.notes_from_sxp(notes[0])
   5.391  
   5.392 -        for apikey, imgkey in XENAPI_HVM_CFG.items():
   5.393 -            val = sxp.child_value(image_sxp, imgkey, None)
   5.394 -            if val != None:
   5.395 -                type_conv = XENAPI_CFG_TYPES[apikey]
   5.396 -                if callable(type_conv):
   5.397 -                    self[apikey] = type_conv(val)
   5.398 -                else:
   5.399 -                    self[apikey] = val
   5.400          self._hvm_boot_params_from_sxp(image_sxp)
   5.401  
   5.402      def set_notes(self, notes):
   5.403          'Add parsed elfnotes to image'
   5.404 -        self['image']['notes'] = notes
   5.405 +        self['notes'] = notes
   5.406  
   5.407      def get_notes(self):
   5.408          try:
   5.409 -            return self['image']['notes'] or {}
   5.410 +            return self['notes'] or {}
   5.411          except KeyError:
   5.412              return {}
   5.413  
   5.414 @@ -1470,11 +1347,9 @@ class XendConfig(dict):
   5.415              self['HVM_boot_policy'] = 'BIOS order'
   5.416              self['HVM_boot_params'] = { 'order' : boot }
   5.417  
   5.418 +    def is_hvm(self):
   5.419 +        return self['HVM_boot_policy'] != ''
   5.420  
   5.421 -#
   5.422 -# debugging 
   5.423 -#
   5.424 -
   5.425 -if __name__ == "__main__":
   5.426 -    pass
   5.427 -    
   5.428 +    def image_type(self):
   5.429 +        stored_type = self['platform'].get('image_type')
   5.430 +        return stored_type or (self.is_hvm() and 'hvm' or 'linux')
     6.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Sat Mar 10 21:43:07 2007 +0000
     6.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Sat Mar 10 21:48:22 2007 +0000
     6.3 @@ -13,7 +13,7 @@
     6.4  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     6.5  #============================================================================
     6.6  # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
     6.7 -# Copyright (C) 2005, 2006 XenSource Ltd
     6.8 +# Copyright (C) 2005-2007 XenSource Ltd
     6.9  #============================================================================
    6.10  
    6.11  """Representation of a single domain.
    6.12 @@ -176,14 +176,8 @@ def recreate(info, priv):
    6.13          vm._storeVmDetails()
    6.14          vm._storeDomDetails()
    6.15          
    6.16 -    if vm.info['image']: # Only dom0 should be without an image entry when
    6.17 -                         # recreating, but we cope with missing ones
    6.18 -                         # elsewhere just in case.
    6.19 -        vm.image = image.create(vm,
    6.20 -                                vm.info,
    6.21 -                                vm.info['image'],
    6.22 -                                vm.info['devices'])
    6.23 -        vm.image.recreate()
    6.24 +    vm.image = image.create(vm, vm.info)
    6.25 +    vm.image.recreate()
    6.26  
    6.27      vm._registerWatches()
    6.28      vm.refreshShutdown(xeninfo)
    6.29 @@ -448,9 +442,7 @@ class XendDomainInfo:
    6.30          self.storeDom("control/shutdown", reason)
    6.31  
    6.32          ## shutdown hypercall for hvm domain desides xenstore write
    6.33 -        image_cfg = self.info.get('image', {})
    6.34 -        hvm = image_cfg.has_key('hvm')
    6.35 -        if hvm:
    6.36 +        if self.info.is_hvm():
    6.37              for code in DOMAIN_SHUTDOWN_REASONS.keys():
    6.38                  if DOMAIN_SHUTDOWN_REASONS[code] == reason:
    6.39                      break
    6.40 @@ -1389,9 +1381,7 @@ class XendDomainInfo:
    6.41  
    6.42          self.shutdownStartTime = None
    6.43  
    6.44 -        image_cfg = self.info.get('image', {})
    6.45 -        hvm = image_cfg.has_key('hvm')
    6.46 -
    6.47 +        hvm = self.info.is_hvm()
    6.48          if hvm:
    6.49              info = xc.xeninfo()
    6.50              if 'hvm' not in info['xen_caps']:
    6.51 @@ -1438,14 +1428,8 @@ class XendDomainInfo:
    6.52  
    6.53          self._configureBootloader()
    6.54  
    6.55 -        if not self._infoIsSet('image'):
    6.56 -            raise VmError('Missing image in configuration')
    6.57 -
    6.58          try:
    6.59 -            self.image = image.create(self,
    6.60 -                                      self.info,
    6.61 -                                      self.info['image'],
    6.62 -                                      self.info['devices'])
    6.63 +            self.image = image.create(self, self.info)
    6.64  
    6.65              localtime = self.info.get('platform_localtime', False)
    6.66              if localtime:
    6.67 @@ -1507,7 +1491,8 @@ class XendDomainInfo:
    6.68              self._stateSet(DOM_STATE_RUNNING)
    6.69          except (RuntimeError, VmError), exn:
    6.70              log.exception("XendDomainInfo.initDomain: exception occurred")
    6.71 -            self.image.cleanupBootloading()
    6.72 +            if self.image:
    6.73 +                self.image.cleanupBootloading()
    6.74              raise VmError(str(exn))
    6.75  
    6.76  
    6.77 @@ -1574,13 +1559,8 @@ class XendDomainInfo:
    6.78          self.console_mfn = console_mfn
    6.79  
    6.80          self._introduceDomain()
    6.81 -        image_cfg = self.info.get('image', {})
    6.82 -        hvm = image_cfg.has_key('hvm')
    6.83 -        if hvm:
    6.84 -            self.image = image.create(self,
    6.85 -                    self.info,
    6.86 -                    self.info['image'],
    6.87 -                    self.info['devices'])
    6.88 +        if self.info.has_hvm():
    6.89 +            self.image = image.create(self, self.info)
    6.90              if self.image:
    6.91                  self.image.createDeviceModel(True)
    6.92                  self.image.register_shutdown_watch()
    6.93 @@ -1742,11 +1722,7 @@ class XendDomainInfo:
    6.94  
    6.95          if boot:
    6.96              # HVM booting.
    6.97 -            self.info['image']['type'] = 'hvm'
    6.98 -            if not 'devices' in self.info['image']:
    6.99 -                self.info['image']['devices'] = {}
   6.100 -            self.info['image']['devices']['boot'] = \
   6.101 -                self.info['HVM_boot_params'].get('order', 'dc')
   6.102 +            pass
   6.103          elif not blexec and kernel:
   6.104              # Boot from dom0.  Nothing left to do -- the kernel and ramdisk
   6.105              # will be picked up by image.py.
   6.106 @@ -1910,10 +1886,9 @@ class XendDomainInfo:
   6.107              if self._infoIsSet(info_key):
   6.108                  to_store[key] = str(self.info[info_key])
   6.109  
   6.110 -        if self.info.get('image'):
   6.111 -            image_sxpr = self.info.image_sxpr()
   6.112 -            if image_sxpr:
   6.113 -                to_store['image'] = sxp.to_string(image_sxpr)
   6.114 +        image_sxpr = self.info.image_sxpr()
   6.115 +        if image_sxpr:
   6.116 +            to_store['image'] = sxp.to_string(image_sxpr)
   6.117  
   6.118          if self._infoIsSet('security'):
   6.119              secinfo = self.info['security']
   6.120 @@ -2074,18 +2049,8 @@ class XendDomainInfo:
   6.121          return retval
   6.122      def get_power_state(self):
   6.123          return XEN_API_VM_POWER_STATE[self.state]
   6.124 -    def get_platform_std_vga(self):
   6.125 -        return self.info.get('platform_std_vga', False)    
   6.126 -    def get_platform_serial(self):
   6.127 -        return self.info.get('platform_serial', '')
   6.128 -    def get_platform_localtime(self):
   6.129 -        return self.info.get('platform_localtime', False)
   6.130 -    def get_platform_clock_offset(self):
   6.131 -        return self.info.get('platform_clock_offset', False)
   6.132 -    def get_platform_enable_audio(self):
   6.133 -        return self.info.get('platform_enable_audio', False)
   6.134 -    def get_platform_keymap(self):
   6.135 -        return self.info.get('platform_keymap', '')
   6.136 +    def get_platform(self):
   6.137 +        return self.info.get('platform', {})    
   6.138      def get_pci_bus(self):
   6.139          return self.info.get('pci_bus', '')
   6.140      def get_tools_version(self):
     7.1 --- a/tools/python/xen/xend/image.py	Sat Mar 10 21:43:07 2007 +0000
     7.2 +++ b/tools/python/xen/xend/image.py	Sat Mar 10 21:48:22 2007 +0000
     7.3 @@ -13,7 +13,7 @@
     7.4  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     7.5  #============================================================================
     7.6  # Copyright (C) 2005 Mike Wray <mike.wray@hp.com>
     7.7 -# Copyright (C) 2005 XenSource Ltd
     7.8 +# Copyright (C) 2005-2007 XenSource Ltd
     7.9  #============================================================================
    7.10  
    7.11  
    7.12 @@ -36,13 +36,12 @@ xc = xen.lowlevel.xc.xc()
    7.13  MAX_GUEST_CMDLINE = 1024
    7.14  
    7.15  
    7.16 -def create(vm, vmConfig, imageConfig, deviceConfig):
    7.17 +def create(vm, vmConfig):
    7.18      """Create an image handler for a vm.
    7.19  
    7.20      @return ImageHandler instance
    7.21      """
    7.22 -    return findImageHandlerClass(imageConfig)(vm, vmConfig, imageConfig,
    7.23 -                                              deviceConfig)
    7.24 +    return findImageHandlerClass(vmConfig)(vm, vmConfig)
    7.25  
    7.26  
    7.27  class ImageHandler:
    7.28 @@ -65,7 +64,7 @@ class ImageHandler:
    7.29      ostype = None
    7.30  
    7.31  
    7.32 -    def __init__(self, vm, vmConfig, imageConfig, deviceConfig):
    7.33 +    def __init__(self, vm, vmConfig):
    7.34          self.vm = vm
    7.35  
    7.36          self.bootloader = False
    7.37 @@ -73,9 +72,9 @@ class ImageHandler:
    7.38          self.ramdisk = None
    7.39          self.cmdline = None
    7.40  
    7.41 -        self.configure(vmConfig, imageConfig, deviceConfig)
    7.42 +        self.configure(vmConfig)
    7.43  
    7.44 -    def configure(self, vmConfig, imageConfig, _):
    7.45 +    def configure(self, vmConfig):
    7.46          """Config actions common to all unix-like domains."""
    7.47          if '_temp_using_bootloader' in vmConfig:
    7.48              self.bootloader = True
    7.49 @@ -262,13 +261,13 @@ class HVMImageHandler(ImageHandler):
    7.50  
    7.51      ostype = "hvm"
    7.52  
    7.53 -    def __init__(self, vm, vmConfig, imageConfig, deviceConfig):
    7.54 -        ImageHandler.__init__(self, vm, vmConfig, imageConfig, deviceConfig)
    7.55 +    def __init__(self, vm, vmConfig):
    7.56 +        ImageHandler.__init__(self, vm, vmConfig)
    7.57          self.shutdownWatch = None
    7.58          self.rebootFeatureWatch = None
    7.59  
    7.60 -    def configure(self, vmConfig, imageConfig, deviceConfig):
    7.61 -        ImageHandler.configure(self, vmConfig, imageConfig, deviceConfig)
    7.62 +    def configure(self, vmConfig):
    7.63 +        ImageHandler.configure(self, vmConfig)
    7.64  
    7.65          if not self.kernel:
    7.66              self.kernel = '/usr/lib/xen/boot/hvmloader'
    7.67 @@ -279,13 +278,13 @@ class HVMImageHandler(ImageHandler):
    7.68                            "supported by your CPU and enabled in your BIOS?")
    7.69  
    7.70          self.dmargs = self.parseDeviceModelArgs(vmConfig)
    7.71 -        self.device_model = imageConfig['hvm'].get('device_model')
    7.72 +        self.device_model = vmConfig['platform'].get('device_model')
    7.73          if not self.device_model:
    7.74              raise VmError("hvm: missing device model")
    7.75          
    7.76 -        self.display = imageConfig['hvm'].get('display')
    7.77 -        self.xauthority = imageConfig['hvm'].get('xauthority')
    7.78 -        self.vncconsole = imageConfig['hvm'].get('vncconsole')
    7.79 +        self.display = vmConfig['platform'].get('display')
    7.80 +        self.xauthority = vmConfig['platform'].get('xauthority')
    7.81 +        self.vncconsole = vmConfig['platform'].get('vncconsole')
    7.82  
    7.83          self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
    7.84                          ("image/device-model", self.device_model),
    7.85 @@ -293,9 +292,9 @@ class HVMImageHandler(ImageHandler):
    7.86  
    7.87          self.pid = None
    7.88  
    7.89 -        self.pae  = imageConfig['hvm'].get('pae', 0)
    7.90 -        self.apic  = imageConfig['hvm'].get('apic', 0)
    7.91 -        self.acpi  = imageConfig['hvm']['devices'].get('acpi', 0)
    7.92 +        self.pae  = int(vmConfig['platform'].get('pae',  0))
    7.93 +        self.apic = int(vmConfig['platform'].get('apic', 0))
    7.94 +        self.acpi = int(vmConfig['platform'].get('acpi', 0))
    7.95          
    7.96  
    7.97      def buildDomain(self):
    7.98 @@ -331,11 +330,10 @@ class HVMImageHandler(ImageHandler):
    7.99                     'localtime', 'serial', 'stdvga', 'isa',
   7.100                     'acpi', 'usb', 'usbdevice', 'keymap' ]
   7.101          
   7.102 -        hvmDeviceConfig = vmConfig['image']['hvm']['devices']
   7.103          ret = ['-vcpus', str(self.vm.getVCpuCount())]
   7.104  
   7.105          for a in dmargs:
   7.106 -            v = hvmDeviceConfig.get(a)
   7.107 +            v = vmConfig['platform'].get(a)
   7.108  
   7.109              # python doesn't allow '-' in variable names
   7.110              if a == 'stdvga': a = 'std-vga'
   7.111 @@ -395,14 +393,14 @@ class HVMImageHandler(ImageHandler):
   7.112          # Find RFB console device, and if it exists, make QEMU enable
   7.113          # the VNC console.
   7.114          #
   7.115 -        if vmConfig['image'].get('nographic'):
   7.116 +        if vmConfig['platform'].get('nographic'):
   7.117              # skip vnc init if nographic is set
   7.118              ret.append('-nographic')
   7.119              return ret
   7.120  
   7.121          vnc_config = {}
   7.122 -        has_vnc = int(vmConfig['image'].get('vnc', 0)) != 0
   7.123 -        has_sdl = int(vmConfig['image'].get('sdl', 0)) != 0
   7.124 +        has_vnc = int(vmConfig['platform'].get('vnc', 0)) != 0
   7.125 +        has_sdl = int(vmConfig['platform'].get('sdl', 0)) != 0
   7.126          for dev_uuid in vmConfig['console_refs']:
   7.127              dev_type, dev_info = vmConfig['devices'][dev_uuid]
   7.128              if dev_type == 'vfb':
   7.129 @@ -414,8 +412,8 @@ class HVMImageHandler(ImageHandler):
   7.130              if not vnc_config:
   7.131                  for key in ('vncunused', 'vnclisten', 'vncdisplay',
   7.132                              'vncpasswd'):
   7.133 -                    if key in vmConfig['image']:
   7.134 -                        vnc_config[key] = vmConfig['image'][key]
   7.135 +                    if key in vmConfig['platform']:
   7.136 +                        vnc_config[key] = vmConfig['platform'][key]
   7.137  
   7.138              if not vnc_config.get('vncunused', 0) and \
   7.139                     vnc_config.get('vncdisplay', 0):
   7.140 @@ -634,9 +632,7 @@ def findImageHandlerClass(image):
   7.141      @param image config
   7.142      @return ImageHandler subclass or None
   7.143      """
   7.144 -    image_type = image['type']
   7.145 -    if image_type is None:
   7.146 -        raise VmError('missing image type')
   7.147 +    image_type = image.image_type()
   7.148      try:
   7.149          return _handlers[arch.type][image_type]
   7.150      except KeyError: