ia64/xen-unstable

changeset 13810:d34d43fb88ae

Merge
author Tim Deegan <Tim.Deegan@xensource.com>
date Thu Feb 01 15:03:55 2007 +0000 (2007-02-01)
parents 1c7efb60176c a9f30d8eea75
children 868babf6b1dd
files
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Thu Feb 01 15:03:37 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Thu Feb 01 15:03:55 2007 +0000
     1.3 @@ -1026,9 +1026,9 @@ references to objects with match names
     1.4  virtual machine (or 'guest').
     1.5  
     1.6  VM booting is controlled by setting one of the two mutually exclusive
     1.7 -groups: "PV", and "HVM".  If HVM.boot is the empty string, then paravirtual
     1.8 -domain building and booting will be used; otherwise the VM will be loaded
     1.9 -as an HVM domain, and booted using an emulated BIOS.
    1.10 +groups: "PV", and "HVM".  If HVM.boot\_policy is the empty string, then
    1.11 +paravirtual domain building and booting will be used; otherwise the VM will
    1.12 +be loaded as an HVM domain, and booted using an emulated BIOS.
    1.13  
    1.14  When paravirtual booting is in use, the PV/bootloader field indicates the
    1.15  bootloader to use.  It may be "pygrub", in which case the platform's
    1.16 @@ -1053,7 +1053,10 @@ ramdisk values will be treated as paths 
    1.17  PV/bootloader and PV/kernel are empty, then the behaviour is as if
    1.18  PV/bootloader was specified as "pygrub".
    1.19  
    1.20 -When using HVM booting, HVM/boot specifies the order of the boot devices.}} \\
    1.21 +When using HVM booting, HVM/boot\_policy and HVM/boot\_params specify the
    1.22 +boot handling.  Only one policy is currently defined: "BIOS order".  In
    1.23 +this case, HVM/boot\_params should contain one key-value pair "order" = "N"
    1.24 +where N is the string that will be passed to QEMU.}} \\
    1.25  \hline
    1.26  Quals & Field & Type & Description \\
    1.27  \hline
    1.28 @@ -1089,7 +1092,8 @@ Quals & Field & Type & Description \\
    1.29  $\mathit{RW}$ &  {\tt PV/ramdisk} & string & path to the initrd \\
    1.30  $\mathit{RW}$ &  {\tt PV/args} & string & kernel command-line arguments \\
    1.31  $\mathit{RW}$ &  {\tt PV/bootloader\_args} & string & miscellaneous arguments for the bootloader \\
    1.32 -$\mathit{RW}$ &  {\tt HVM/boot} & string & device boot order \\
    1.33 +$\mathit{RW}$ &  {\tt HVM/boot\_policy} & string & HVM boot policy \\
    1.34 +$\mathit{RW}$ &  {\tt HVM/boot\_params} & (string $\rightarrow$ string) Map & HVM boot params \\
    1.35  $\mathit{RW}$ &  {\tt platform/std\_VGA} & bool & emulate standard VGA instead of cirrus logic \\
    1.36  $\mathit{RW}$ &  {\tt platform/serial} & string & redirect serial port to pty \\
    1.37  $\mathit{RW}$ &  {\tt platform/localtime} & bool & set RTC to local time \\
    1.38 @@ -3297,13 +3301,13 @@ void
    1.39  \vspace{0.3cm}
    1.40  \vspace{0.3cm}
    1.41  \vspace{0.3cm}
    1.42 -\subsubsection{RPC name:~get\_HVM\_boot}
    1.43 -
    1.44 -{\bf Overview:} 
    1.45 -Get the HVM/boot field of the given VM.
    1.46 -
    1.47 - \noindent {\bf Signature:} 
    1.48 -\begin{verbatim} string get_HVM_boot (session_id s, VM ref self)\end{verbatim}
    1.49 +\subsubsection{RPC name:~get\_HVM\_boot\_policy}
    1.50 +
    1.51 +{\bf Overview:} 
    1.52 +Get the HVM/boot\_policy field of the given VM.
    1.53 +
    1.54 + \noindent {\bf Signature:} 
    1.55 +\begin{verbatim} string get_HVM_boot_policy (session_id s, VM ref self)\end{verbatim}
    1.56  
    1.57  
    1.58  \noindent{\bf Arguments:}
    1.59 @@ -3329,13 +3333,13 @@ value of the field
    1.60  \vspace{0.3cm}
    1.61  \vspace{0.3cm}
    1.62  \vspace{0.3cm}
    1.63 -\subsubsection{RPC name:~set\_HVM\_boot}
    1.64 -
    1.65 -{\bf Overview:} 
    1.66 -Set the HVM/boot field of the given VM.
    1.67 -
    1.68 - \noindent {\bf Signature:} 
    1.69 -\begin{verbatim} void set_HVM_boot (session_id s, VM ref self, string value)\end{verbatim}
    1.70 +\subsubsection{RPC name:~set\_HVM\_boot\_policy}
    1.71 +
    1.72 +{\bf Overview:} 
    1.73 +Set the HVM/boot\_policy field of the given VM.
    1.74 +
    1.75 + \noindent {\bf Signature:} 
    1.76 +\begin{verbatim} void set_HVM_boot_policy (session_id s, VM ref self, string value)\end{verbatim}
    1.77  
    1.78  
    1.79  \noindent{\bf Arguments:}
    1.80 @@ -3363,6 +3367,143 @@ void
    1.81  \vspace{0.3cm}
    1.82  \vspace{0.3cm}
    1.83  \vspace{0.3cm}
    1.84 +\subsubsection{RPC name:~get\_HVM\_boot\_params}
    1.85 +
    1.86 +{\bf Overview:} 
    1.87 +Get the HVM/boot\_params field of the given VM.
    1.88 +
    1.89 + \noindent {\bf Signature:} 
    1.90 +\begin{verbatim} ((string -> string) Map) get_HVM_boot_params (session_id s, VM ref self)\end{verbatim}
    1.91 +
    1.92 +
    1.93 +\noindent{\bf Arguments:}
    1.94 +
    1.95 + 
    1.96 +\vspace{0.3cm}
    1.97 +\begin{tabular}{|c|c|p{7cm}|}
    1.98 + \hline
    1.99 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.100 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.101 +
   1.102 +\end{tabular}
   1.103 +
   1.104 +\vspace{0.3cm}
   1.105 +
   1.106 + \noindent {\bf Return Type:} 
   1.107 +{\tt 
   1.108 +(string $\rightarrow$ string) Map
   1.109 +}
   1.110 +
   1.111 +
   1.112 +value of the field
   1.113 +\vspace{0.3cm}
   1.114 +\vspace{0.3cm}
   1.115 +\vspace{0.3cm}
   1.116 +\subsubsection{RPC name:~set\_HVM\_boot\_params}
   1.117 +
   1.118 +{\bf Overview:} 
   1.119 +Set the HVM/boot\_params field of the given VM.
   1.120 +
   1.121 + \noindent {\bf Signature:} 
   1.122 +\begin{verbatim} void set_HVM_boot_params (session_id s, VM ref self, (string -> string) Map value)\end{verbatim}
   1.123 +
   1.124 +
   1.125 +\noindent{\bf Arguments:}
   1.126 +
   1.127 + 
   1.128 +\vspace{0.3cm}
   1.129 +\begin{tabular}{|c|c|p{7cm}|}
   1.130 + \hline
   1.131 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.132 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.133 +
   1.134 +{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
   1.135 +
   1.136 +\end{tabular}
   1.137 +
   1.138 +\vspace{0.3cm}
   1.139 +
   1.140 + \noindent {\bf Return Type:} 
   1.141 +{\tt 
   1.142 +void
   1.143 +}
   1.144 +
   1.145 +
   1.146 +
   1.147 +\vspace{0.3cm}
   1.148 +\vspace{0.3cm}
   1.149 +\vspace{0.3cm}
   1.150 +\subsubsection{RPC name:~add\_to\_HVM\_boot\_params}
   1.151 +
   1.152 +{\bf Overview:} 
   1.153 +Add the given key-value pair to the HVM/boot\_params field of the given VM.
   1.154 +
   1.155 + \noindent {\bf Signature:} 
   1.156 +\begin{verbatim} void add_to_HVM_boot_params (session_id s, VM ref self, string key, string value)\end{verbatim}
   1.157 +
   1.158 +
   1.159 +\noindent{\bf Arguments:}
   1.160 +
   1.161 + 
   1.162 +\vspace{0.3cm}
   1.163 +\begin{tabular}{|c|c|p{7cm}|}
   1.164 + \hline
   1.165 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.166 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.167 +
   1.168 +{\tt string } & key & Key to add \\ \hline 
   1.169 +
   1.170 +{\tt string } & value & Value to add \\ \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 +void
   1.179 +}
   1.180 +
   1.181 +
   1.182 +
   1.183 +\vspace{0.3cm}
   1.184 +\vspace{0.3cm}
   1.185 +\vspace{0.3cm}
   1.186 +\subsubsection{RPC name:~remove\_from\_HVM\_boot\_params}
   1.187 +
   1.188 +{\bf Overview:} 
   1.189 +Remove the given key and its corresponding value from the HVM/boot\_params
   1.190 +field of the given VM.  If the key is not in that Map, then do nothing.
   1.191 +
   1.192 + \noindent {\bf Signature:} 
   1.193 +\begin{verbatim} void remove_from_HVM_boot_params (session_id s, VM ref self, string key)\end{verbatim}
   1.194 +
   1.195 +
   1.196 +\noindent{\bf Arguments:}
   1.197 +
   1.198 + 
   1.199 +\vspace{0.3cm}
   1.200 +\begin{tabular}{|c|c|p{7cm}|}
   1.201 + \hline
   1.202 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.203 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.204 +
   1.205 +{\tt string } & key & Key to remove \\ \hline 
   1.206 +
   1.207 +\end{tabular}
   1.208 +
   1.209 +\vspace{0.3cm}
   1.210 +
   1.211 + \noindent {\bf Return Type:} 
   1.212 +{\tt 
   1.213 +void
   1.214 +}
   1.215 +
   1.216 +
   1.217 +
   1.218 +\vspace{0.3cm}
   1.219 +\vspace{0.3cm}
   1.220 +\vspace{0.3cm}
   1.221  \subsubsection{RPC name:~get\_platform\_std\_VGA}
   1.222  
   1.223  {\bf Overview:} 
   1.224 @@ -11758,6 +11899,17 @@ The handle parameter echoes the bad valu
   1.225  \begin{verbatim}TASK_HANDLE_INVALID(handle)\end{verbatim}
   1.226  \begin{center}\rule{10em}{0.1pt}\end{center}
   1.227  
   1.228 +\subsubsection{VALUE\_NOT\_SUPPORTED}
   1.229 +
   1.230 +You attempted to set a value that is not supported by this implementation. 
   1.231 +The fully-qualified field name and the value that you tried to set are
   1.232 +returned.  Also returned is a developer-only diagnostic reason.
   1.233 +
   1.234 +\vspace{0.3cm}
   1.235 +{\bf Signature:}
   1.236 +\begin{verbatim}VALUE_NOT_SUPPORTED(field, value, reason)\end{verbatim}
   1.237 +\begin{center}\rule{10em}{0.1pt}\end{center}
   1.238 +
   1.239  \subsubsection{VBD\_HANDLE\_INVALID}
   1.240  
   1.241  You gave an invalid VBD handle.  The VBD may have recently been deleted. 
     2.1 --- a/tools/libxen/include/xen_vm.h	Thu Feb 01 15:03:37 2007 +0000
     2.2 +++ b/tools/libxen/include/xen_vm.h	Thu Feb 01 15:03:55 2007 +0000
     2.3 @@ -42,9 +42,9 @@
     2.4   * A virtual machine (or 'guest').
     2.5   * 
     2.6   * VM booting is controlled by setting one of the two mutually exclusive
     2.7 - * groups: "PV", and "HVM".  If HVM.boot is the empty string, then paravirtual
     2.8 - * domain building and booting will be used; otherwise the VM will be loaded
     2.9 - * as an HVM domain, and booted using an emulated BIOS.
    2.10 + * groups: "PV", and "HVM".  If HVM.boot_policy is the empty string, then
    2.11 + * paravirtual domain building and booting will be used; otherwise the VM will
    2.12 + * be loaded as an HVM domain, and booted using an emulated BIOS.
    2.13   * 
    2.14   * When paravirtual booting is in use, the PV/bootloader field indicates the
    2.15   * bootloader to use.  It may be "pygrub", in which case the platform's
    2.16 @@ -69,7 +69,10 @@
    2.17   * PV/bootloader and PV/kernel are empty, then the behaviour is as if
    2.18   * PV/bootloader was specified as "pygrub".
    2.19   * 
    2.20 - * When using HVM booting, HVM/boot specifies the order of the boot devices.
    2.21 + * When using HVM booting, HVM/boot_policy and HVM/boot_params specify the
    2.22 + * boot handling.  Only one policy is currently defined: "BIOS order".  In
    2.23 + * this case, HVM/boot_params should contain one key-value pair "order" = "N"
    2.24 + * where N is the string that will be passed to QEMU..
    2.25   */
    2.26  
    2.27  
    2.28 @@ -136,7 +139,8 @@ typedef struct xen_vm_record
    2.29      char *pv_ramdisk;
    2.30      char *pv_args;
    2.31      char *pv_bootloader_args;
    2.32 -    char *hvm_boot;
    2.33 +    char *hvm_boot_policy;
    2.34 +    xen_string_string_map *hvm_boot_params;
    2.35      bool platform_std_vga;
    2.36      char *platform_serial;
    2.37      bool platform_localtime;
    2.38 @@ -490,10 +494,17 @@ xen_vm_get_pv_bootloader_args(xen_sessio
    2.39  
    2.40  
    2.41  /**
    2.42 - * Get the HVM/boot field of the given VM.
    2.43 + * Get the HVM/boot_policy field of the given VM.
    2.44   */
    2.45  extern bool
    2.46 -xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm);
    2.47 +xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm);
    2.48 +
    2.49 +
    2.50 +/**
    2.51 + * Get the HVM/boot_params field of the given VM.
    2.52 + */
    2.53 +extern bool
    2.54 +xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm);
    2.55  
    2.56  
    2.57  /**
    2.58 @@ -731,10 +742,34 @@ xen_vm_set_pv_bootloader_args(xen_sessio
    2.59  
    2.60  
    2.61  /**
    2.62 - * Set the HVM/boot field of the given VM.
    2.63 + * Set the HVM/boot_policy field of the given VM.
    2.64 + */
    2.65 +extern bool
    2.66 +xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy);
    2.67 +
    2.68 +
    2.69 +/**
    2.70 + * Set the HVM/boot_params field of the given VM.
    2.71   */
    2.72  extern bool
    2.73 -xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot);
    2.74 +xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params);
    2.75 +
    2.76 +
    2.77 +/**
    2.78 + * Add the given key-value pair to the HVM/boot_params field of the
    2.79 + * given VM.
    2.80 + */
    2.81 +extern bool
    2.82 +xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value);
    2.83 +
    2.84 +
    2.85 +/**
    2.86 + * Remove the given key and its corresponding value from the
    2.87 + * HVM/boot_params field of the given VM.  If the key is not in that Map, then
    2.88 + * do nothing.
    2.89 + */
    2.90 +extern bool
    2.91 +xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key);
    2.92  
    2.93  
    2.94  /**
     3.1 --- a/tools/libxen/src/xen_vm.c	Thu Feb 01 15:03:37 2007 +0000
     3.2 +++ b/tools/libxen/src/xen_vm.c	Thu Feb 01 15:03:55 2007 +0000
     3.3 @@ -145,9 +145,12 @@ static const struct_member xen_vm_record
     3.4          { .key = "PV_bootloader_args",
     3.5            .type = &abstract_type_string,
     3.6            .offset = offsetof(xen_vm_record, pv_bootloader_args) },
     3.7 -        { .key = "HVM_boot",
     3.8 +        { .key = "HVM_boot_policy",
     3.9            .type = &abstract_type_string,
    3.10 -          .offset = offsetof(xen_vm_record, hvm_boot) },
    3.11 +          .offset = offsetof(xen_vm_record, hvm_boot_policy) },
    3.12 +        { .key = "HVM_boot_params",
    3.13 +          .type = &abstract_type_string_string_map,
    3.14 +          .offset = offsetof(xen_vm_record, hvm_boot_params) },
    3.15          { .key = "platform_std_VGA",
    3.16            .type = &abstract_type_bool,
    3.17            .offset = offsetof(xen_vm_record, platform_std_vga) },
    3.18 @@ -216,7 +219,8 @@ xen_vm_record_free(xen_vm_record *record
    3.19      free(record->pv_ramdisk);
    3.20      free(record->pv_args);
    3.21      free(record->pv_bootloader_args);
    3.22 -    free(record->hvm_boot);
    3.23 +    free(record->hvm_boot_policy);
    3.24 +    xen_string_string_map_free(record->hvm_boot_params);
    3.25      free(record->platform_serial);
    3.26      free(record->pci_bus);
    3.27      xen_string_string_map_free(record->tools_version);
    3.28 @@ -824,7 +828,7 @@ xen_vm_get_pv_bootloader_args(xen_sessio
    3.29  
    3.30  
    3.31  bool
    3.32 -xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm)
    3.33 +xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm)
    3.34  {
    3.35      abstract_value param_values[] =
    3.36          {
    3.37 @@ -835,7 +839,24 @@ xen_vm_get_hvm_boot(xen_session *session
    3.38      abstract_type result_type = abstract_type_string;
    3.39  
    3.40      *result = NULL;
    3.41 -    XEN_CALL_("VM.get_HVM_boot");
    3.42 +    XEN_CALL_("VM.get_HVM_boot_policy");
    3.43 +    return session->ok;
    3.44 +}
    3.45 +
    3.46 +
    3.47 +bool
    3.48 +xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm)
    3.49 +{
    3.50 +    abstract_value param_values[] =
    3.51 +        {
    3.52 +            { .type = &abstract_type_string,
    3.53 +              .u.string_val = vm }
    3.54 +        };
    3.55 +
    3.56 +    abstract_type result_type = abstract_type_string_string_map;
    3.57 +
    3.58 +    *result = NULL;
    3.59 +    XEN_CALL_("VM.get_HVM_boot_params");
    3.60      return session->ok;
    3.61  }
    3.62  
    3.63 @@ -1376,17 +1397,67 @@ xen_vm_set_pv_bootloader_args(xen_sessio
    3.64  
    3.65  
    3.66  bool
    3.67 -xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot)
    3.68 +xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy)
    3.69  {
    3.70      abstract_value param_values[] =
    3.71          {
    3.72              { .type = &abstract_type_string,
    3.73                .u.string_val = vm },
    3.74              { .type = &abstract_type_string,
    3.75 -              .u.string_val = boot }
    3.76 +              .u.string_val = boot_policy }
    3.77 +        };
    3.78 +
    3.79 +    xen_call_(session, "VM.set_HVM_boot_policy", param_values, 2, NULL, NULL);
    3.80 +    return session->ok;
    3.81 +}
    3.82 +
    3.83 +
    3.84 +bool
    3.85 +xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params)
    3.86 +{
    3.87 +    abstract_value param_values[] =
    3.88 +        {
    3.89 +            { .type = &abstract_type_string,
    3.90 +              .u.string_val = vm },
    3.91 +            { .type = &abstract_type_string_string_map,
    3.92 +              .u.set_val = (arbitrary_set *)boot_params }
    3.93          };
    3.94  
    3.95 -    xen_call_(session, "VM.set_HVM_boot", param_values, 2, NULL, NULL);
    3.96 +    xen_call_(session, "VM.set_HVM_boot_params", param_values, 2, NULL, NULL);
    3.97 +    return session->ok;
    3.98 +}
    3.99 +
   3.100 +
   3.101 +bool
   3.102 +xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value)
   3.103 +{
   3.104 +    abstract_value param_values[] =
   3.105 +        {
   3.106 +            { .type = &abstract_type_string,
   3.107 +              .u.string_val = vm },
   3.108 +            { .type = &abstract_type_string,
   3.109 +              .u.string_val = key },
   3.110 +            { .type = &abstract_type_string,
   3.111 +              .u.string_val = value }
   3.112 +        };
   3.113 +
   3.114 +    xen_call_(session, "VM.add_to_HVM_boot_params", param_values, 3, NULL, NULL);
   3.115 +    return session->ok;
   3.116 +}
   3.117 +
   3.118 +
   3.119 +bool
   3.120 +xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key)
   3.121 +{
   3.122 +    abstract_value param_values[] =
   3.123 +        {
   3.124 +            { .type = &abstract_type_string,
   3.125 +              .u.string_val = vm },
   3.126 +            { .type = &abstract_type_string,
   3.127 +              .u.string_val = key }
   3.128 +        };
   3.129 +
   3.130 +    xen_call_(session, "VM.remove_from_HVM_boot_params", param_values, 2, NULL, NULL);
   3.131      return session->ok;
   3.132  }
   3.133  
     4.1 --- a/tools/libxen/test/test_bindings.c	Thu Feb 01 15:03:37 2007 +0000
     4.2 +++ b/tools/libxen/test/test_bindings.c	Thu Feb 01 15:03:55 2007 +0000
     4.3 @@ -278,6 +278,8 @@ int main(int argc, char **argv)
     4.4  static xen_vm create_new_vm(xen_session *session)
     4.5  {
     4.6      xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1);
     4.7 +    vcpus_params->contents[0].key = strdup("weight");
     4.8 +    vcpus_params->contents[0].val = strdup("300");
     4.9      xen_vm_record vm_record =
    4.10          {
    4.11              .name_label = "NewVM",
    4.12 @@ -294,9 +296,10 @@ static xen_vm create_new_vm(xen_session 
    4.13              .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
    4.14              .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
    4.15              .actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
    4.16 -            .hvm_boot = "",
    4.17 -            //.pv_bootloader = "pygrub",
    4.18 -            .pv_kernel = "/boot/vmlinuz-2.6.18-xenU",
    4.19 +            .hvm_boot_policy = NULL,
    4.20 +            .hvm_boot_params = NULL,
    4.21 +            .pv_bootloader = "pygrub",
    4.22 +            .pv_kernel = "/boot/vmlinuz-2.6.16.33-xen",
    4.23              .pv_ramdisk = "",
    4.24              .pv_args = "root=/dev/sda1 ro",
    4.25              .pv_bootloader_args = ""
    4.26 @@ -306,6 +309,8 @@ static xen_vm create_new_vm(xen_session 
    4.27      xen_vm vm;
    4.28      xen_vm_create(session, &vm, &vm_record);
    4.29  
    4.30 +    xen_string_string_map_free(vcpus_params);
    4.31 +
    4.32      if (!session->ok)
    4.33      {
    4.34          fprintf(stderr, "VM creation failed.\n");
     5.1 --- a/tools/misc/Makefile	Thu Feb 01 15:03:37 2007 +0000
     5.2 +++ b/tools/misc/Makefile	Thu Feb 01 15:03:55 2007 +0000
     5.3 @@ -12,7 +12,7 @@ HDRS     = $(wildcard *.h)
     5.4  TARGETS  = xenperf xc_shadow
     5.5  
     5.6  INSTALL_BIN  = $(TARGETS) xencons
     5.7 -INSTALL_SBIN = netfix xm xen-bugtool xend xenperf
     5.8 +INSTALL_SBIN = netfix xm xen-bugtool xen-python-path xend xenperf
     5.9  
    5.10  .PHONY: all
    5.11  all: build
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tools/misc/xen-python-path	Thu Feb 01 15:03:55 2007 +0000
     6.3 @@ -0,0 +1,41 @@
     6.4 +#!/usr/bin/env python
     6.5 +#  -*- mode: python; -*-
     6.6 +#============================================================================
     6.7 +# This library is free software; you can redistribute it and/or
     6.8 +# modify it under the terms of version 2.1 of the GNU Lesser General Public
     6.9 +# License as published by the Free Software Foundation.
    6.10 +#
    6.11 +# This library is distributed in the hope that it will be useful,
    6.12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.14 +# Lesser General Public License for more details.
    6.15 +#
    6.16 +# You should have received a copy of the GNU Lesser General Public
    6.17 +# License along with this library; if not, write to the Free Software
    6.18 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    6.19 +#============================================================================
    6.20 +# Copyright (C) 2007 XenSource Inc.
    6.21 +#============================================================================
    6.22 +
    6.23 +
    6.24 +# Use the auxbin module in Xend to determine the correct Python path.  We
    6.25 +# take the first installed instance of auxbin that we find, and then run it
    6.26 +# to determine the correct path, appending that to sys.path.
    6.27 +
    6.28 +AUXBIN = 'xen/util/auxbin.py'
    6.29 +
    6.30 +import os
    6.31 +import os.path
    6.32 +import sys
    6.33 +
    6.34 +for p in ['python%s' % sys.version[:3], 'python']:
    6.35 +    for l in ['/usr/lib64', '/usr/lib']:
    6.36 +        d = os.path.join(l, p)
    6.37 +        if os.path.exists(os.path.join(d, AUXBIN)):
    6.38 +            sys.path.append(d)
    6.39 +            import xen.util.auxbin
    6.40 +            print os.path.join(xen.util.auxbin.libpath(), p)
    6.41 +            sys.exit(0)
    6.42 +
    6.43 +print >>sys.stderr, "Cannot find Xen Python modules."
    6.44 +sys.exit(1)
     7.1 --- a/tools/misc/xend	Thu Feb 01 15:03:37 2007 +0000
     7.2 +++ b/tools/misc/xend	Thu Feb 01 15:03:55 2007 +0000
     7.3 @@ -31,23 +31,13 @@ import signal
     7.4  import time
     7.5  import commands
     7.6  
     7.7 -
     7.8 -# Use the auxbin module in Xend to determine the correct Python path.  We
     7.9 -# take the first installed instance of auxbin that we find, and then run it
    7.10 -# to determine the correct path, appending that to sys.path.
    7.11 -
    7.12 -AUXBIN = 'xen/util/auxbin.py'
    7.13 +result = commands.getstatusoutput(os.path.join(os.path.dirname(sys.argv[0]),
    7.14 +                                               'xen-python-path'))
    7.15 +if result[0] != 0:
    7.16 +    print >>sys.stderr, result[1]
    7.17 +    sys.exit(1)
    7.18  
    7.19 -for p in ['python%s' % sys.version[:3], 'python']:
    7.20 -    for l in ['/usr/lib64', '/usr/lib']:
    7.21 -        d = os.path.join(l, p)
    7.22 -        if os.path.exists(os.path.join(d, AUXBIN)):
    7.23 -            sys.path.append(d)
    7.24 -            import xen.util.auxbin
    7.25 -            libpath = os.path.join(xen.util.auxbin.libpath(), p)
    7.26 -            sys.path = sys.path[:-1]
    7.27 -            sys.path.append(libpath)
    7.28 -            break
    7.29 +sys.path.append(result[1])
    7.30  
    7.31  from xen.xend.server import SrvDaemon
    7.32  
     8.1 --- a/tools/python/xen/xend/XendAPI.py	Thu Feb 01 15:03:37 2007 +0000
     8.2 +++ b/tools/python/xen/xend/XendAPI.py	Thu Feb 01 15:03:55 2007 +0000
     8.3 @@ -974,7 +974,8 @@ class XendAPI(object):
     8.4                    'PV_ramdisk',
     8.5                    'PV_args',
     8.6                    'PV_bootloader_args',
     8.7 -                  'HVM_boot',
     8.8 +                  'HVM_boot_policy',
     8.9 +                  'HVM_boot_params',
    8.10                    'platform_std_VGA',
    8.11                    'platform_serial',
    8.12                    'platform_localtime',
    8.13 @@ -1020,7 +1021,8 @@ class XendAPI(object):
    8.14          'PV_ramdisk',
    8.15          'PV_args',
    8.16          'PV_bootloader_args',
    8.17 -        'HVM_boot',
    8.18 +        'HVM_boot_policy',
    8.19 +        'HVM_boot_params',
    8.20          'platform_std_VGA',
    8.21          'platform_serial',
    8.22          'platform_localtime',
    8.23 @@ -1158,8 +1160,11 @@ class XendAPI(object):
    8.24      def VM_get_PV_bootloader_args(self, session, vm_ref):
    8.25          return self.VM_get('PV_bootloader_args', session, vm_ref)
    8.26  
    8.27 -    def VM_get_HVM_boot(self, session, vm_ref):
    8.28 -        return self.VM_get('HVM_boot', session, vm_ref)
    8.29 +    def VM_get_HVM_boot_policy(self, session, vm_ref):
    8.30 +        return self.VM_get('HVM_boot_policy', session, vm_ref)
    8.31 +    
    8.32 +    def VM_get_HVM_boot_params(self, session, vm_ref):
    8.33 +        return self.VM_get('HVM_boot_params', session, vm_ref)
    8.34      
    8.35      def VM_get_platform_std_VGA(self, session, vm_ref):
    8.36          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    8.37 @@ -1246,8 +1251,30 @@ class XendAPI(object):
    8.38              return xen_api_error(['VM_ON_CRASH_BEHAVIOUR_INVALID', vm_ref])
    8.39          return self.VM_set('actions_after_crash', session, vm_ref, action)
    8.40  
    8.41 -    def VM_set_HVM_boot(self, session, vm_ref, value):
    8.42 -        return self.VM_set('HVM_boot', session, vm_ref, value)
    8.43 +    def VM_set_HVM_boot_policy(self, session, vm_ref, value):
    8.44 +        if value != "" and value != "BIOS order":
    8.45 +            return xen_api_error(
    8.46 +                ['VALUE_NOT_SUPPORTED', 'VM.HVM_boot_policy', value,
    8.47 +                 'Xend supports only the "BIOS order" boot policy.'])
    8.48 +        else:
    8.49 +            return self.VM_set('HVM_boot_policy', session, vm_ref, value)
    8.50 +
    8.51 +    def VM_set_HVM_boot_params(self, session, vm_ref, value):
    8.52 +        return self.VM_set('HVM_boot_params', session, vm_ref, value)
    8.53 +
    8.54 +    def VM_add_to_HVM_boot_params(self, session, vm_ref, key, value):
    8.55 +        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    8.56 +        if 'HVM_boot_params' not in dom.info:
    8.57 +            dom.info['HVM_boot_params'] = {}
    8.58 +        dom.info['HVM_boot_params'][key] = value
    8.59 +        return xen_api_success_void()
    8.60 +
    8.61 +    def VM_remove_from_HVM_boot_params(self, session, vm_ref, key):
    8.62 +        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    8.63 +        if 'HVM_boot_params' in dom.info \
    8.64 +               and key in dom.info['HVM_boot_params']:
    8.65 +            del dom.info['HVM_boot_params'][key]
    8.66 +        return xen_api_success_void()
    8.67  
    8.68      def VM_set_PV_bootloader(self, session, vm_ref, value):
    8.69          return self.VM_set('PV_bootloader', session, vm_ref, value)
    8.70 @@ -1354,7 +1381,8 @@ class XendAPI(object):
    8.71              'PV_ramdisk': xeninfo.info.get('PV_ramdisk'),
    8.72              'PV_args': xeninfo.info.get('PV_args'),
    8.73              'PV_bootloader_args': xeninfo.info.get('PV_bootloader_args'),
    8.74 -            'HVM_boot': xeninfo.info.get('HVM_boot'),
    8.75 +            'HVM_boot_policy': xeninfo.info.get('HVM_boot_policy'),
    8.76 +            'HVM_boot_params': xeninfo.info.get('HVM_boot_params'),
    8.77              'platform_std_VGA': xeninfo.get_platform_std_vga(),
    8.78              'platform_serial': xeninfo.get_platform_serial(),
    8.79              'platform_localtime': xeninfo.get_platform_localtime(),
    8.80 @@ -1622,7 +1650,7 @@ class XendAPI(object):
    8.81          xendom = XendDomain.instance()
    8.82          return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
    8.83                                                                 'io_write_kbs'))
    8.84 -    
    8.85 +
    8.86      def VIF_get_all(self, session):
    8.87          xendom = XendDomain.instance()
    8.88          vifs = [d.get_vifs() for d in XendDomain.instance().list('all')]
     9.1 --- a/tools/python/xen/xend/XendConfig.py	Thu Feb 01 15:03:37 2007 +0000
     9.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Feb 01 15:03:55 2007 +0000
     9.3 @@ -28,7 +28,7 @@ from xen.xend.PrettyPrint import prettyp
     9.4  from xen.xend.XendConstants import DOM_STATE_HALTED
     9.5  
     9.6  log = logging.getLogger("xend.XendConfig")
     9.7 -log.setLevel(logging.WARN)
     9.8 +log.setLevel(logging.DEBUG)
     9.9  
    9.10  
    9.11  """
    9.12 @@ -164,7 +164,8 @@ XENAPI_CFG_TYPES = {
    9.13      'PV_ramdisk': str,
    9.14      'PV_args': str,
    9.15      'PV_bootloader_args': str,
    9.16 -    'HVM_boot': str,
    9.17 +    'HVM_boot_policy': str,
    9.18 +    'HVM_boot_params': dict,
    9.19      'platform_std_vga': bool0,
    9.20      'platform_serial': str,
    9.21      'platform_localtime': bool0,
    9.22 @@ -361,7 +362,8 @@ class XendConfig(dict):
    9.23              'PV_ramdisk': '',
    9.24              'PV_args': '',
    9.25              'PV_bootloader_args': '',
    9.26 -            'HVM_boot': '',
    9.27 +            'HVM_boot_policy': '',
    9.28 +            'HVM_boot_params': {},
    9.29              'memory_static_min': 0,
    9.30              'memory_dynamic_min': 0,
    9.31              'shadow_memory': 0,
    9.32 @@ -496,6 +498,12 @@ class XendConfig(dict):
    9.33                      log.warn("Unable to parse key %s: %s: %s" %
    9.34                               (key, str(val), e))
    9.35  
    9.36 +        # Compatibility hack -- can go soon.
    9.37 +        boot_order = sxp.child_value(sxp_cfg, 'HVM_boot')
    9.38 +        if boot_order:
    9.39 +            cfg['HVM_boot_policy'] = 'BIOS order'
    9.40 +            cfg['HVM_boot_params'] = { 'order' : boot_order }
    9.41 +
    9.42          # Parsing the device SXP's. In most cases, the SXP looks
    9.43          # like this:
    9.44          #
    9.45 @@ -768,7 +776,7 @@ class XendConfig(dict):
    9.46          if 'image' in xapi_dict:
    9.47              self['image'].update(xapi_dict['image'])
    9.48          else:
    9.49 -            hvm = self['HVM_boot'] != ''
    9.50 +            hvm = self['HVM_boot_policy'] != ''
    9.51              self['image']['type'] = hvm and 'hvm' or 'linux'
    9.52              if hvm:
    9.53                  self['image']['hvm'] = {'devices': {}}
    10.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Feb 01 15:03:37 2007 +0000
    10.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Feb 01 15:03:55 2007 +0000
    10.3 @@ -1648,14 +1648,15 @@ class XendDomainInfo:
    10.4          kernel          = self.info['PV_kernel']
    10.5          ramdisk         = self.info['PV_ramdisk']
    10.6          args            = self.info['PV_args']
    10.7 -        boot            = self.info['HVM_boot']
    10.8 +        boot            = self.info['HVM_boot_policy']
    10.9  
   10.10          if boot:
   10.11              # HVM booting.
   10.12              self.info['image']['type'] = 'hvm'
   10.13              if not 'devices' in self.info['image']:
   10.14                  self.info['image']['devices'] = {}
   10.15 -            self.info['image']['devices']['boot'] = boot
   10.16 +            self.info['image']['devices']['boot'] = \
   10.17 +                self.info['HVM_boot_params'].get('order', 'dc')
   10.18          elif not blexec and kernel:
   10.19              # Boot from dom0.  Nothing left to do -- the kernel and ramdisk
   10.20              # will be picked up by image.py.
    11.1 --- a/tools/python/xen/xm/messages/en/xen-xm.po	Thu Feb 01 15:03:37 2007 +0000
    11.2 +++ b/tools/python/xen/xm/messages/en/xen-xm.po	Thu Feb 01 15:03:55 2007 +0000
    11.3 @@ -19,7 +19,7 @@
    11.4  msgid ""
    11.5  msgstr ""
    11.6  "Project-Id-Version: Xen-xm 3.0\n"
    11.7 -"PO-Revision-Date: 2007-01-30 17:15+0000\n"
    11.8 +"PO-Revision-Date: 2007-01-31 12:34+0000\n"
    11.9  "Last-Translator: Ewan Mellor <ewan@xensource.com>\n"
   11.10  "Language-Team: xen-devel <xen-devel@lists.xensource.com>\n"
   11.11  "MIME-Version: 1.0\n"
   11.12 @@ -41,6 +41,9 @@ msgstr "The method %(1)s takes %(2)s arg
   11.13  msgid "SESSION_AUTHENTICATION_FAILED"
   11.14  msgstr "Permission denied."
   11.15  
   11.16 +msgid "VALUE_NOT_SUPPORTED"
   11.17 +msgstr "Value \"%(2)s\" for %(1)s is not supported by this server.  The server said \"%(3)s\"."
   11.18 +
   11.19  msgid "HOST_CPU_HANDLE_INVALID"
   11.20  msgstr "The host_cpu handle %(1)s is invalid."
   11.21  
    12.1 --- a/tools/xm-test/configure.ac	Thu Feb 01 15:03:37 2007 +0000
    12.2 +++ b/tools/xm-test/configure.ac	Thu Feb 01 15:03:55 2007 +0000
    12.3 @@ -11,10 +11,12 @@ AC_PROG_CC
    12.4  #AC_PROG_INSTALL
    12.5  AC_CHECK_PROG([LILO],	lilo,	lilo,	"no",	[$PATH])
    12.6  
    12.7 +XEN_PYTHON_PATH=$(/usr/sbin/xen-python-path)
    12.8 +
    12.9  # Right now, we can assume that the lib/ directory
   12.10  # is two levels above the tests
   12.11  TESTLIB=../../lib
   12.12 -TENV="PYTHONPATH=$PYTHONPATH:$TESTLIB"
   12.13 +TENV="PYTHONPATH=$PYTHONPATH:$TESTLIB:$XEN_PYTHON_PATH"
   12.14  
   12.15  AC_ARG_ENABLE(hvm-support,
   12.16  	[[  --enable-hvm-support           enable hardware virtual machine assist]],
    13.1 --- a/tools/xm-test/lib/XmTestLib/__init__.py	Thu Feb 01 15:03:37 2007 +0000
    13.2 +++ b/tools/xm-test/lib/XmTestLib/__init__.py	Thu Feb 01 15:03:55 2007 +0000
    13.3 @@ -3,26 +3,6 @@
    13.4  # Author: Dan Smith <danms@us.ibm.com>
    13.5  #
    13.6  
    13.7 -import os.path
    13.8 -import sys
    13.9 -
   13.10 -# Use the auxbin module in Xend to determine the correct Python path.  We
   13.11 -# take the first installed instance of auxbin that we find, and then run it
   13.12 -# to determine the correct path, appending that to sys.path.
   13.13 -
   13.14 -AUXBIN = 'xen/util/auxbin.py'
   13.15 -
   13.16 -for p in ['python%s' % sys.version[:3], 'python']:
   13.17 -    for l in ['/usr/lib64', '/usr/lib']:
   13.18 -        d = os.path.join(l, p)
   13.19 -        if os.path.exists(os.path.join(d, AUXBIN)):
   13.20 -            sys.path.append(d)
   13.21 -            import xen.util.auxbin
   13.22 -            libpath = xen.util.auxbin.libpath()
   13.23 -            sys.path = sys.path[:-1]
   13.24 -            sys.path.append(libpath)
   13.25 -            break
   13.26 -
   13.27  from Console import *
   13.28  from Test import *
   13.29  from Xm import *
    14.1 --- a/xen/arch/x86/dmi_scan.c	Thu Feb 01 15:03:37 2007 +0000
    14.2 +++ b/xen/arch/x86/dmi_scan.c	Thu Feb 01 15:03:55 2007 +0000
    14.3 @@ -159,7 +159,7 @@ static void __init dmi_save_ident(struct
    14.4  		return;
    14.5  	dmi_ident[slot] = alloc_bootmem(strlen(p)+1);
    14.6  	if(dmi_ident[slot])
    14.7 -		safe_strcpy(dmi_ident[slot], p);
    14.8 +		strlcpy(dmi_ident[slot], p, strlen(p)+1);
    14.9  	else
   14.10  		printk(KERN_ERR "dmi_save_ident: out of memory.\n");
   14.11  }
    15.1 --- a/xen/common/kexec.c	Thu Feb 01 15:03:37 2007 +0000
    15.2 +++ b/xen/common/kexec.c	Thu Feb 01 15:03:55 2007 +0000
    15.3 @@ -131,12 +131,20 @@ static __init int register_crashdump_tri
    15.4  
    15.5  static void setup_note(Elf_Note *n, const char *name, int type, int descsz)
    15.6  {
    15.7 -    safe_strcpy(ELFNOTE_NAME(n), name);
    15.8 -    n->namesz = strlen(name);
    15.9 +    int l = strlen(name) + 1;
   15.10 +    strlcpy(ELFNOTE_NAME(n), name, l);
   15.11 +    n->namesz = l;
   15.12      n->descsz = descsz;
   15.13      n->type = type;
   15.14  }
   15.15  
   15.16 +static int sizeof_note(const char *name, int descsz)
   15.17 +{
   15.18 +    return (sizeof(Elf_Note) +
   15.19 +            ELFNOTE_ALIGN(sizeof(name)) +
   15.20 +            ELFNOTE_ALIGN(descsz));
   15.21 +}
   15.22 +
   15.23  #define kexec_get(x)      kexec_get_##x
   15.24  
   15.25  #endif
   15.26 @@ -162,16 +170,17 @@ static int kexec_get(xen)(xen_kexec_rang
   15.27  static int kexec_get(cpu)(xen_kexec_range_t *range)
   15.28  {
   15.29      int nr = range->nr;
   15.30 -    int nr_bytes = sizeof(Elf_Note) * 2
   15.31 -        + ELFNOTE_ALIGN(sizeof(ELF_Prstatus))
   15.32 -        + ELFNOTE_ALIGN(sizeof(crash_xen_core_t));
   15.33 +    int nr_bytes = 0;
   15.34  
   15.35      if ( nr < 0 || nr >= num_present_cpus() )
   15.36          return -EINVAL;
   15.37  
   15.38 +    nr_bytes += sizeof_note("CORE", sizeof(ELF_Prstatus));
   15.39 +    nr_bytes += sizeof_note("Xen", sizeof(crash_xen_core_t));
   15.40 +
   15.41      /* The Xen info note is included in CPU0's range. */
   15.42      if ( nr == 0 )
   15.43 -        nr_bytes += sizeof(Elf_Note) + ELFNOTE_ALIGN(sizeof(crash_xen_info_t));
   15.44 +        nr_bytes += sizeof_note("Xen", sizeof(crash_xen_info_t));
   15.45  
   15.46      if ( per_cpu(crash_notes, nr) == NULL )
   15.47      {
    16.1 --- a/xen/include/xen/string.h	Thu Feb 01 15:03:37 2007 +0000
    16.2 +++ b/xen/include/xen/string.h	Thu Feb 01 15:03:55 2007 +0000
    16.3 @@ -82,8 +82,16 @@ extern void * memchr(const void *,int,__
    16.4  }
    16.5  #endif
    16.6  
    16.7 +#define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[])
    16.8 +
    16.9  /* safe_xxx always NUL-terminates and returns !=0 if result is truncated. */
   16.10 -#define safe_strcpy(d, s) (strlcpy(d, s, sizeof(d)) >= sizeof(d))
   16.11 -#define safe_strcat(d, s) (strlcat(d, s, sizeof(d)) >= sizeof(d))
   16.12 +#define safe_strcpy(d, s) ({                    \
   16.13 +    BUILD_BUG_ON(!is_char_array(d));            \
   16.14 +    (strlcpy(d, s, sizeof(d)) >= sizeof(d));    \
   16.15 +})
   16.16 +#define safe_strcat(d, s) ({                    \
   16.17 +    BUILD_BUG_ON(!is_char_array(d));            \
   16.18 +    (strlcat(d, s, sizeof(d)) >= sizeof(d));    \
   16.19 +})
   16.20  
   16.21  #endif /* _LINUX_STRING_H_ */