WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Merge

# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Date 1170342235 0
# Node ID d34d43fb88ae23e78ea90048d6c20a7255193836
# Parent  1c7efb60176c3542fe06eeec84c230aab5e38bc2
# Parent  a9f30d8eea7554845b18e75518d5b4c4fc97481f
Merge
---
 docs/xen-api/xenapi-datamodel.tex         |  190 +++++++++++++++++++++++++++---
 tools/libxen/include/xen_vm.h             |   61 +++++++--
 tools/libxen/src/xen_vm.c                 |  103 +++++++++++++---
 tools/libxen/test/test_bindings.c         |   11 +
 tools/misc/Makefile                       |    2 
 tools/misc/xen-python-path                |   41 ++++++
 tools/misc/xend                           |   22 ---
 tools/python/xen/xend/XendAPI.py          |   44 +++++-
 tools/python/xen/xend/XendConfig.py       |   16 +-
 tools/python/xen/xend/XendDomainInfo.py   |    5 
 tools/python/xen/xm/messages/en/xen-xm.po |    5 
 tools/xm-test/configure.ac                |    4 
 tools/xm-test/lib/XmTestLib/__init__.py   |   20 ---
 xen/arch/x86/dmi_scan.c                   |    2 
 xen/common/kexec.c                        |   21 ++-
 xen/include/xen/string.h                  |   12 +
 16 files changed, 446 insertions(+), 113 deletions(-)

diff -r 1c7efb60176c -r d34d43fb88ae docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Thu Feb 01 15:03:37 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Thu Feb 01 15:03:55 2007 +0000
@@ -1026,9 +1026,9 @@ virtual machine (or 'guest').
 virtual machine (or 'guest').
 
 VM booting is controlled by setting one of the two mutually exclusive
-groups: "PV", and "HVM".  If HVM.boot is the empty string, then paravirtual
-domain building and booting will be used; otherwise the VM will be loaded
-as an HVM domain, and booted using an emulated BIOS.
+groups: "PV", and "HVM".  If HVM.boot\_policy is the empty string, then
+paravirtual domain building and booting will be used; otherwise the VM will
+be loaded as an HVM domain, and booted using an emulated BIOS.
 
 When paravirtual booting is in use, the PV/bootloader field indicates the
 bootloader to use.  It may be "pygrub", in which case the platform's
@@ -1053,7 +1053,10 @@ PV/bootloader and PV/kernel are empty, t
 PV/bootloader and PV/kernel are empty, then the behaviour is as if
 PV/bootloader was specified as "pygrub".
 
-When using HVM booting, HVM/boot specifies the order of the boot devices.}} \\
+When using HVM booting, HVM/boot\_policy and HVM/boot\_params specify the
+boot handling.  Only one policy is currently defined: "BIOS order".  In
+this case, HVM/boot\_params should contain one key-value pair "order" = "N"
+where N is the string that will be passed to QEMU.}} \\
 \hline
 Quals & Field & Type & Description \\
 \hline
@@ -1089,7 +1092,8 @@ Quals & Field & Type & Description \\
 $\mathit{RW}$ &  {\tt PV/ramdisk} & string & path to the initrd \\
 $\mathit{RW}$ &  {\tt PV/args} & string & kernel command-line arguments \\
 $\mathit{RW}$ &  {\tt PV/bootloader\_args} & string & miscellaneous arguments 
for the bootloader \\
-$\mathit{RW}$ &  {\tt HVM/boot} & string & device boot order \\
+$\mathit{RW}$ &  {\tt HVM/boot\_policy} & string & HVM boot policy \\
+$\mathit{RW}$ &  {\tt HVM/boot\_params} & (string $\rightarrow$ string) Map & 
HVM boot params \\
 $\mathit{RW}$ &  {\tt platform/std\_VGA} & bool & emulate standard VGA instead 
of cirrus logic \\
 $\mathit{RW}$ &  {\tt platform/serial} & string & redirect serial port to pty 
\\
 $\mathit{RW}$ &  {\tt platform/localtime} & bool & set RTC to local time \\
@@ -3297,13 +3301,13 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_HVM\_boot}
-
-{\bf Overview:} 
-Get the HVM/boot field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_HVM_boot (session_id s, VM ref self)\end{verbatim}
+\subsubsection{RPC name:~get\_HVM\_boot\_policy}
+
+{\bf Overview:} 
+Get the HVM/boot\_policy field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} string get_HVM_boot_policy (session_id s, VM ref 
self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -3329,13 +3333,13 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~set\_HVM\_boot}
-
-{\bf Overview:} 
-Set the HVM/boot field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_HVM_boot (session_id s, VM ref self, string 
value)\end{verbatim}
+\subsubsection{RPC name:~set\_HVM\_boot\_policy}
+
+{\bf Overview:} 
+Set the HVM/boot\_policy field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_HVM_boot_policy (session_id s, VM ref self, string 
value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -3348,6 +3352,143 @@ Set the HVM/boot field of the given VM.
 {\tt VM ref } & self & reference to the object \\ \hline 
 
 {\tt string } & value & New value to set \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_HVM\_boot\_params}
+
+{\bf Overview:} 
+Get the HVM/boot\_params field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} ((string -> string) Map) get_HVM_boot_params (session_id s, 
VM ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+ 
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_HVM\_boot\_params}
+
+{\bf Overview:} 
+Set the HVM/boot\_params field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_HVM_boot_params (session_id s, VM ref self, (string 
-> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+ 
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline 
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~add\_to\_HVM\_boot\_params}
+
+{\bf Overview:} 
+Add the given key-value pair to the HVM/boot\_params field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void add_to_HVM_boot_params (session_id s, VM ref self, 
string key, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+ 
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline 
+
+{\tt string } & key & Key to add \\ \hline 
+
+{\tt string } & value & Value to add \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_HVM\_boot\_params}
+
+{\bf Overview:} 
+Remove the given key and its corresponding value from the HVM/boot\_params
+field of the given VM.  If the key is not in that Map, then do nothing.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void remove_from_HVM_boot_params (session_id s, VM ref self, 
string key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+ 
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline 
+
+{\tt string } & key & Key to remove \\ \hline 
 
 \end{tabular}
 
@@ -11758,6 +11899,17 @@ The handle parameter echoes the bad valu
 \begin{verbatim}TASK_HANDLE_INVALID(handle)\end{verbatim}
 \begin{center}\rule{10em}{0.1pt}\end{center}
 
+\subsubsection{VALUE\_NOT\_SUPPORTED}
+
+You attempted to set a value that is not supported by this implementation. 
+The fully-qualified field name and the value that you tried to set are
+returned.  Also returned is a developer-only diagnostic reason.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}VALUE_NOT_SUPPORTED(field, value, reason)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
 \subsubsection{VBD\_HANDLE\_INVALID}
 
 You gave an invalid VBD handle.  The VBD may have recently been deleted. 
diff -r 1c7efb60176c -r d34d43fb88ae tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h     Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/libxen/include/xen_vm.h     Thu Feb 01 15:03:55 2007 +0000
@@ -42,9 +42,9 @@
  * A virtual machine (or 'guest').
  * 
  * VM booting is controlled by setting one of the two mutually exclusive
- * groups: "PV", and "HVM".  If HVM.boot is the empty string, then paravirtual
- * domain building and booting will be used; otherwise the VM will be loaded
- * as an HVM domain, and booted using an emulated BIOS.
+ * groups: "PV", and "HVM".  If HVM.boot_policy is the empty string, then
+ * paravirtual domain building and booting will be used; otherwise the VM will
+ * be loaded as an HVM domain, and booted using an emulated BIOS.
  * 
  * When paravirtual booting is in use, the PV/bootloader field indicates the
  * bootloader to use.  It may be "pygrub", in which case the platform's
@@ -69,7 +69,10 @@
  * PV/bootloader and PV/kernel are empty, then the behaviour is as if
  * PV/bootloader was specified as "pygrub".
  * 
- * When using HVM booting, HVM/boot specifies the order of the boot devices.
+ * When using HVM booting, HVM/boot_policy and HVM/boot_params specify the
+ * boot handling.  Only one policy is currently defined: "BIOS order".  In
+ * this case, HVM/boot_params should contain one key-value pair "order" = "N"
+ * where N is the string that will be passed to QEMU..
  */
 
 
@@ -136,7 +139,8 @@ typedef struct xen_vm_record
     char *pv_ramdisk;
     char *pv_args;
     char *pv_bootloader_args;
-    char *hvm_boot;
+    char *hvm_boot_policy;
+    xen_string_string_map *hvm_boot_params;
     bool platform_std_vga;
     char *platform_serial;
     bool platform_localtime;
@@ -490,10 +494,17 @@ xen_vm_get_pv_bootloader_args(xen_sessio
 
 
 /**
- * Get the HVM/boot field of the given VM.
- */
-extern bool
-xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm);
+ * Get the HVM/boot_policy field of the given VM.
+ */
+extern bool
+xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Get the HVM/boot_params field of the given VM.
+ */
+extern bool
+xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map 
**result, xen_vm vm);
 
 
 /**
@@ -731,10 +742,34 @@ xen_vm_set_pv_bootloader_args(xen_sessio
 
 
 /**
- * Set the HVM/boot field of the given VM.
- */
-extern bool
-xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot);
+ * Set the HVM/boot_policy field of the given VM.
+ */
+extern bool
+xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy);
+
+
+/**
+ * Set the HVM/boot_params field of the given VM.
+ */
+extern bool
+xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, 
xen_string_string_map *boot_params);
+
+
+/**
+ * Add the given key-value pair to the HVM/boot_params field of the
+ * given VM.
+ */
+extern bool
+xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * HVM/boot_params field of the given VM.  If the key is not in that Map, then
+ * do nothing.
+ */
+extern bool
+xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key);
 
 
 /**
diff -r 1c7efb60176c -r d34d43fb88ae tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/libxen/src/xen_vm.c Thu Feb 01 15:03:55 2007 +0000
@@ -145,9 +145,12 @@ static const struct_member xen_vm_record
         { .key = "PV_bootloader_args",
           .type = &abstract_type_string,
           .offset = offsetof(xen_vm_record, pv_bootloader_args) },
-        { .key = "HVM_boot",
+        { .key = "HVM_boot_policy",
           .type = &abstract_type_string,
-          .offset = offsetof(xen_vm_record, hvm_boot) },
+          .offset = offsetof(xen_vm_record, hvm_boot_policy) },
+        { .key = "HVM_boot_params",
+          .type = &abstract_type_string_string_map,
+          .offset = offsetof(xen_vm_record, hvm_boot_params) },
         { .key = "platform_std_VGA",
           .type = &abstract_type_bool,
           .offset = offsetof(xen_vm_record, platform_std_vga) },
@@ -216,7 +219,8 @@ xen_vm_record_free(xen_vm_record *record
     free(record->pv_ramdisk);
     free(record->pv_args);
     free(record->pv_bootloader_args);
-    free(record->hvm_boot);
+    free(record->hvm_boot_policy);
+    xen_string_string_map_free(record->hvm_boot_params);
     free(record->platform_serial);
     free(record->pci_bus);
     xen_string_string_map_free(record->tools_version);
@@ -824,7 +828,7 @@ xen_vm_get_pv_bootloader_args(xen_sessio
 
 
 bool
-xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm)
+xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm)
 {
     abstract_value param_values[] =
         {
@@ -835,7 +839,24 @@ xen_vm_get_hvm_boot(xen_session *session
     abstract_type result_type = abstract_type_string;
 
     *result = NULL;
-    XEN_CALL_("VM.get_HVM_boot");
+    XEN_CALL_("VM.get_HVM_boot_policy");
+    return session->ok;
+}
+
+
+bool
+xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map 
**result, xen_vm vm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm }
+        };
+
+    abstract_type result_type = abstract_type_string_string_map;
+
+    *result = NULL;
+    XEN_CALL_("VM.get_HVM_boot_params");
     return session->ok;
 }
 
@@ -1376,17 +1397,67 @@ xen_vm_set_pv_bootloader_args(xen_sessio
 
 
 bool
-xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_string,
-              .u.string_val = boot }
-        };
-
-    xen_call_(session, "VM.set_HVM_boot", param_values, 2, NULL, NULL);
+xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string,
+              .u.string_val = boot_policy }
+        };
+
+    xen_call_(session, "VM.set_HVM_boot_policy", param_values, 2, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, 
xen_string_string_map *boot_params)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string_string_map,
+              .u.set_val = (arbitrary_set *)boot_params }
+        };
+
+    xen_call_(session, "VM.set_HVM_boot_params", param_values, 2, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char 
*value)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string,
+              .u.string_val = key },
+            { .type = &abstract_type_string,
+              .u.string_val = value }
+        };
+
+    xen_call_(session, "VM.add_to_HVM_boot_params", param_values, 3, NULL, 
NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string,
+              .u.string_val = key }
+        };
+
+    xen_call_(session, "VM.remove_from_HVM_boot_params", param_values, 2, 
NULL, NULL);
     return session->ok;
 }
 
diff -r 1c7efb60176c -r d34d43fb88ae tools/libxen/test/test_bindings.c
--- a/tools/libxen/test/test_bindings.c Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/libxen/test/test_bindings.c Thu Feb 01 15:03:55 2007 +0000
@@ -278,6 +278,8 @@ static xen_vm create_new_vm(xen_session 
 static xen_vm create_new_vm(xen_session *session)
 {
     xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1);
+    vcpus_params->contents[0].key = strdup("weight");
+    vcpus_params->contents[0].val = strdup("300");
     xen_vm_record vm_record =
         {
             .name_label = "NewVM",
@@ -294,9 +296,10 @@ static xen_vm create_new_vm(xen_session 
             .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
             .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
             .actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
-            .hvm_boot = "",
-            //.pv_bootloader = "pygrub",
-            .pv_kernel = "/boot/vmlinuz-2.6.18-xenU",
+            .hvm_boot_policy = NULL,
+            .hvm_boot_params = NULL,
+            .pv_bootloader = "pygrub",
+            .pv_kernel = "/boot/vmlinuz-2.6.16.33-xen",
             .pv_ramdisk = "",
             .pv_args = "root=/dev/sda1 ro",
             .pv_bootloader_args = ""
@@ -305,6 +308,8 @@ static xen_vm create_new_vm(xen_session 
 
     xen_vm vm;
     xen_vm_create(session, &vm, &vm_record);
+
+    xen_string_string_map_free(vcpus_params);
 
     if (!session->ok)
     {
diff -r 1c7efb60176c -r d34d43fb88ae tools/misc/Makefile
--- a/tools/misc/Makefile       Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/misc/Makefile       Thu Feb 01 15:03:55 2007 +0000
@@ -12,7 +12,7 @@ TARGETS  = xenperf xc_shadow
 TARGETS  = xenperf xc_shadow
 
 INSTALL_BIN  = $(TARGETS) xencons
-INSTALL_SBIN = netfix xm xen-bugtool xend xenperf
+INSTALL_SBIN = netfix xm xen-bugtool xen-python-path xend xenperf
 
 .PHONY: all
 all: build
diff -r 1c7efb60176c -r d34d43fb88ae tools/misc/xen-python-path
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/misc/xen-python-path        Thu Feb 01 15:03:55 2007 +0000
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+#  -*- mode: python; -*-
+#============================================================================
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of version 2.1 of the GNU Lesser General Public
+# License as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#============================================================================
+# Copyright (C) 2007 XenSource Inc.
+#============================================================================
+
+
+# Use the auxbin module in Xend to determine the correct Python path.  We
+# take the first installed instance of auxbin that we find, and then run it
+# to determine the correct path, appending that to sys.path.
+
+AUXBIN = 'xen/util/auxbin.py'
+
+import os
+import os.path
+import sys
+
+for p in ['python%s' % sys.version[:3], 'python']:
+    for l in ['/usr/lib64', '/usr/lib']:
+        d = os.path.join(l, p)
+        if os.path.exists(os.path.join(d, AUXBIN)):
+            sys.path.append(d)
+            import xen.util.auxbin
+            print os.path.join(xen.util.auxbin.libpath(), p)
+            sys.exit(0)
+
+print >>sys.stderr, "Cannot find Xen Python modules."
+sys.exit(1)
diff -r 1c7efb60176c -r d34d43fb88ae tools/misc/xend
--- a/tools/misc/xend   Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/misc/xend   Thu Feb 01 15:03:55 2007 +0000
@@ -31,23 +31,13 @@ import time
 import time
 import commands
 
+result = commands.getstatusoutput(os.path.join(os.path.dirname(sys.argv[0]),
+                                               'xen-python-path'))
+if result[0] != 0:
+    print >>sys.stderr, result[1]
+    sys.exit(1)
 
-# Use the auxbin module in Xend to determine the correct Python path.  We
-# take the first installed instance of auxbin that we find, and then run it
-# to determine the correct path, appending that to sys.path.
-
-AUXBIN = 'xen/util/auxbin.py'
-
-for p in ['python%s' % sys.version[:3], 'python']:
-    for l in ['/usr/lib64', '/usr/lib']:
-        d = os.path.join(l, p)
-        if os.path.exists(os.path.join(d, AUXBIN)):
-            sys.path.append(d)
-            import xen.util.auxbin
-            libpath = os.path.join(xen.util.auxbin.libpath(), p)
-            sys.path = sys.path[:-1]
-            sys.path.append(libpath)
-            break
+sys.path.append(result[1])
 
 from xen.xend.server import SrvDaemon
 
diff -r 1c7efb60176c -r d34d43fb88ae tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Thu Feb 01 15:03:55 2007 +0000
@@ -974,7 +974,8 @@ class XendAPI(object):
                   'PV_ramdisk',
                   'PV_args',
                   'PV_bootloader_args',
-                  'HVM_boot',
+                  'HVM_boot_policy',
+                  'HVM_boot_params',
                   'platform_std_VGA',
                   'platform_serial',
                   'platform_localtime',
@@ -1020,7 +1021,8 @@ class XendAPI(object):
         'PV_ramdisk',
         'PV_args',
         'PV_bootloader_args',
-        'HVM_boot',
+        'HVM_boot_policy',
+        'HVM_boot_params',
         'platform_std_VGA',
         'platform_serial',
         'platform_localtime',
@@ -1158,8 +1160,11 @@ class XendAPI(object):
     def VM_get_PV_bootloader_args(self, session, vm_ref):
         return self.VM_get('PV_bootloader_args', session, vm_ref)
 
-    def VM_get_HVM_boot(self, session, vm_ref):
-        return self.VM_get('HVM_boot', session, vm_ref)
+    def VM_get_HVM_boot_policy(self, session, vm_ref):
+        return self.VM_get('HVM_boot_policy', session, vm_ref)
+    
+    def VM_get_HVM_boot_params(self, session, vm_ref):
+        return self.VM_get('HVM_boot_params', session, vm_ref)
     
     def VM_get_platform_std_VGA(self, session, vm_ref):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
@@ -1246,8 +1251,30 @@ class XendAPI(object):
             return xen_api_error(['VM_ON_CRASH_BEHAVIOUR_INVALID', vm_ref])
         return self.VM_set('actions_after_crash', session, vm_ref, action)
 
-    def VM_set_HVM_boot(self, session, vm_ref, value):
-        return self.VM_set('HVM_boot', session, vm_ref, value)
+    def VM_set_HVM_boot_policy(self, session, vm_ref, value):
+        if value != "" and value != "BIOS order":
+            return xen_api_error(
+                ['VALUE_NOT_SUPPORTED', 'VM.HVM_boot_policy', value,
+                 'Xend supports only the "BIOS order" boot policy.'])
+        else:
+            return self.VM_set('HVM_boot_policy', session, vm_ref, value)
+
+    def VM_set_HVM_boot_params(self, session, vm_ref, value):
+        return self.VM_set('HVM_boot_params', session, vm_ref, value)
+
+    def VM_add_to_HVM_boot_params(self, session, vm_ref, key, value):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        if 'HVM_boot_params' not in dom.info:
+            dom.info['HVM_boot_params'] = {}
+        dom.info['HVM_boot_params'][key] = value
+        return xen_api_success_void()
+
+    def VM_remove_from_HVM_boot_params(self, session, vm_ref, key):
+        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
+        if 'HVM_boot_params' in dom.info \
+               and key in dom.info['HVM_boot_params']:
+            del dom.info['HVM_boot_params'][key]
+        return xen_api_success_void()
 
     def VM_set_PV_bootloader(self, session, vm_ref, value):
         return self.VM_set('PV_bootloader', session, vm_ref, value)
@@ -1354,7 +1381,8 @@ class XendAPI(object):
             'PV_ramdisk': xeninfo.info.get('PV_ramdisk'),
             'PV_args': xeninfo.info.get('PV_args'),
             'PV_bootloader_args': xeninfo.info.get('PV_bootloader_args'),
-            'HVM_boot': xeninfo.info.get('HVM_boot'),
+            'HVM_boot_policy': xeninfo.info.get('HVM_boot_policy'),
+            'HVM_boot_params': xeninfo.info.get('HVM_boot_params'),
             'platform_std_VGA': xeninfo.get_platform_std_vga(),
             'platform_serial': xeninfo.get_platform_serial(),
             'platform_localtime': xeninfo.get_platform_localtime(),
@@ -1622,7 +1650,7 @@ class XendAPI(object):
         xendom = XendDomain.instance()
         return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
                                                                'io_write_kbs'))
-    
+
     def VIF_get_all(self, session):
         xendom = XendDomain.instance()
         vifs = [d.get_vifs() for d in XendDomain.instance().list('all')]
diff -r 1c7efb60176c -r d34d43fb88ae tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Thu Feb 01 15:03:55 2007 +0000
@@ -28,7 +28,7 @@ from xen.xend.XendConstants import DOM_S
 from xen.xend.XendConstants import DOM_STATE_HALTED
 
 log = logging.getLogger("xend.XendConfig")
-log.setLevel(logging.WARN)
+log.setLevel(logging.DEBUG)
 
 
 """
@@ -164,7 +164,8 @@ XENAPI_CFG_TYPES = {
     'PV_ramdisk': str,
     'PV_args': str,
     'PV_bootloader_args': str,
-    'HVM_boot': str,
+    'HVM_boot_policy': str,
+    'HVM_boot_params': dict,
     'platform_std_vga': bool0,
     'platform_serial': str,
     'platform_localtime': bool0,
@@ -361,7 +362,8 @@ class XendConfig(dict):
             'PV_ramdisk': '',
             'PV_args': '',
             'PV_bootloader_args': '',
-            'HVM_boot': '',
+            'HVM_boot_policy': '',
+            'HVM_boot_params': {},
             'memory_static_min': 0,
             'memory_dynamic_min': 0,
             'shadow_memory': 0,
@@ -495,6 +497,12 @@ class XendConfig(dict):
                 except (TypeError, ValueError), e:
                     log.warn("Unable to parse key %s: %s: %s" %
                              (key, str(val), e))
+
+        # Compatibility hack -- can go soon.
+        boot_order = sxp.child_value(sxp_cfg, 'HVM_boot')
+        if boot_order:
+            cfg['HVM_boot_policy'] = 'BIOS order'
+            cfg['HVM_boot_params'] = { 'order' : boot_order }
 
         # Parsing the device SXP's. In most cases, the SXP looks
         # like this:
@@ -768,7 +776,7 @@ class XendConfig(dict):
         if 'image' in xapi_dict:
             self['image'].update(xapi_dict['image'])
         else:
-            hvm = self['HVM_boot'] != ''
+            hvm = self['HVM_boot_policy'] != ''
             self['image']['type'] = hvm and 'hvm' or 'linux'
             if hvm:
                 self['image']['hvm'] = {'devices': {}}
diff -r 1c7efb60176c -r d34d43fb88ae tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu Feb 01 15:03:55 2007 +0000
@@ -1648,14 +1648,15 @@ class XendDomainInfo:
         kernel          = self.info['PV_kernel']
         ramdisk         = self.info['PV_ramdisk']
         args            = self.info['PV_args']
-        boot            = self.info['HVM_boot']
+        boot            = self.info['HVM_boot_policy']
 
         if boot:
             # HVM booting.
             self.info['image']['type'] = 'hvm'
             if not 'devices' in self.info['image']:
                 self.info['image']['devices'] = {}
-            self.info['image']['devices']['boot'] = boot
+            self.info['image']['devices']['boot'] = \
+                self.info['HVM_boot_params'].get('order', 'dc')
         elif not blexec and kernel:
             # Boot from dom0.  Nothing left to do -- the kernel and ramdisk
             # will be picked up by image.py.
diff -r 1c7efb60176c -r d34d43fb88ae tools/python/xen/xm/messages/en/xen-xm.po
--- a/tools/python/xen/xm/messages/en/xen-xm.po Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/python/xen/xm/messages/en/xen-xm.po Thu Feb 01 15:03:55 2007 +0000
@@ -19,7 +19,7 @@ msgid ""
 msgid ""
 msgstr ""
 "Project-Id-Version: Xen-xm 3.0\n"
-"PO-Revision-Date: 2007-01-30 17:15+0000\n"
+"PO-Revision-Date: 2007-01-31 12:34+0000\n"
 "Last-Translator: Ewan Mellor <ewan@xxxxxxxxxxxxx>\n"
 "Language-Team: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>\n"
 "MIME-Version: 1.0\n"
@@ -40,6 +40,9 @@ msgstr "The method %(1)s takes %(2)s arg
 
 msgid "SESSION_AUTHENTICATION_FAILED"
 msgstr "Permission denied."
+
+msgid "VALUE_NOT_SUPPORTED"
+msgstr "Value \"%(2)s\" for %(1)s is not supported by this server.  The server 
said \"%(3)s\"."
 
 msgid "HOST_CPU_HANDLE_INVALID"
 msgstr "The host_cpu handle %(1)s is invalid."
diff -r 1c7efb60176c -r d34d43fb88ae tools/xm-test/configure.ac
--- a/tools/xm-test/configure.ac        Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/xm-test/configure.ac        Thu Feb 01 15:03:55 2007 +0000
@@ -11,10 +11,12 @@ AC_PROG_CC
 #AC_PROG_INSTALL
 AC_CHECK_PROG([LILO],  lilo,   lilo,   "no",   [$PATH])
 
+XEN_PYTHON_PATH=$(/usr/sbin/xen-python-path)
+
 # Right now, we can assume that the lib/ directory
 # is two levels above the tests
 TESTLIB=../../lib
-TENV="PYTHONPATH=$PYTHONPATH:$TESTLIB"
+TENV="PYTHONPATH=$PYTHONPATH:$TESTLIB:$XEN_PYTHON_PATH"
 
 AC_ARG_ENABLE(hvm-support,
        [[  --enable-hvm-support           enable hardware virtual machine 
assist]],
diff -r 1c7efb60176c -r d34d43fb88ae tools/xm-test/lib/XmTestLib/__init__.py
--- a/tools/xm-test/lib/XmTestLib/__init__.py   Thu Feb 01 15:03:37 2007 +0000
+++ b/tools/xm-test/lib/XmTestLib/__init__.py   Thu Feb 01 15:03:55 2007 +0000
@@ -2,26 +2,6 @@
 # Copyright (C) International Business Machines Corp., 2005
 # Author: Dan Smith <danms@xxxxxxxxxx>
 #
-
-import os.path
-import sys
-
-# Use the auxbin module in Xend to determine the correct Python path.  We
-# take the first installed instance of auxbin that we find, and then run it
-# to determine the correct path, appending that to sys.path.
-
-AUXBIN = 'xen/util/auxbin.py'
-
-for p in ['python%s' % sys.version[:3], 'python']:
-    for l in ['/usr/lib64', '/usr/lib']:
-        d = os.path.join(l, p)
-        if os.path.exists(os.path.join(d, AUXBIN)):
-            sys.path.append(d)
-            import xen.util.auxbin
-            libpath = xen.util.auxbin.libpath()
-            sys.path = sys.path[:-1]
-            sys.path.append(libpath)
-            break
 
 from Console import *
 from Test import *
diff -r 1c7efb60176c -r d34d43fb88ae xen/arch/x86/dmi_scan.c
--- a/xen/arch/x86/dmi_scan.c   Thu Feb 01 15:03:37 2007 +0000
+++ b/xen/arch/x86/dmi_scan.c   Thu Feb 01 15:03:55 2007 +0000
@@ -159,7 +159,7 @@ static void __init dmi_save_ident(struct
                return;
        dmi_ident[slot] = alloc_bootmem(strlen(p)+1);
        if(dmi_ident[slot])
-               safe_strcpy(dmi_ident[slot], p);
+               strlcpy(dmi_ident[slot], p, strlen(p)+1);
        else
                printk(KERN_ERR "dmi_save_ident: out of memory.\n");
 }
diff -r 1c7efb60176c -r d34d43fb88ae xen/common/kexec.c
--- a/xen/common/kexec.c        Thu Feb 01 15:03:37 2007 +0000
+++ b/xen/common/kexec.c        Thu Feb 01 15:03:55 2007 +0000
@@ -131,10 +131,18 @@ __initcall(register_crashdump_trigger);
 
 static void setup_note(Elf_Note *n, const char *name, int type, int descsz)
 {
-    safe_strcpy(ELFNOTE_NAME(n), name);
-    n->namesz = strlen(name);
+    int l = strlen(name) + 1;
+    strlcpy(ELFNOTE_NAME(n), name, l);
+    n->namesz = l;
     n->descsz = descsz;
     n->type = type;
+}
+
+static int sizeof_note(const char *name, int descsz)
+{
+    return (sizeof(Elf_Note) +
+            ELFNOTE_ALIGN(sizeof(name)) +
+            ELFNOTE_ALIGN(descsz));
 }
 
 #define kexec_get(x)      kexec_get_##x
@@ -162,16 +170,17 @@ static int kexec_get(cpu)(xen_kexec_rang
 static int kexec_get(cpu)(xen_kexec_range_t *range)
 {
     int nr = range->nr;
-    int nr_bytes = sizeof(Elf_Note) * 2
-        + ELFNOTE_ALIGN(sizeof(ELF_Prstatus))
-        + ELFNOTE_ALIGN(sizeof(crash_xen_core_t));
+    int nr_bytes = 0;
 
     if ( nr < 0 || nr >= num_present_cpus() )
         return -EINVAL;
 
+    nr_bytes += sizeof_note("CORE", sizeof(ELF_Prstatus));
+    nr_bytes += sizeof_note("Xen", sizeof(crash_xen_core_t));
+
     /* The Xen info note is included in CPU0's range. */
     if ( nr == 0 )
-        nr_bytes += sizeof(Elf_Note) + ELFNOTE_ALIGN(sizeof(crash_xen_info_t));
+        nr_bytes += sizeof_note("Xen", sizeof(crash_xen_info_t));
 
     if ( per_cpu(crash_notes, nr) == NULL )
     {
diff -r 1c7efb60176c -r d34d43fb88ae xen/include/xen/string.h
--- a/xen/include/xen/string.h  Thu Feb 01 15:03:37 2007 +0000
+++ b/xen/include/xen/string.h  Thu Feb 01 15:03:55 2007 +0000
@@ -82,8 +82,16 @@ extern void * memchr(const void *,int,__
 }
 #endif
 
+#define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[])
+
 /* safe_xxx always NUL-terminates and returns !=0 if result is truncated. */
-#define safe_strcpy(d, s) (strlcpy(d, s, sizeof(d)) >= sizeof(d))
-#define safe_strcat(d, s) (strlcat(d, s, sizeof(d)) >= sizeof(d))
+#define safe_strcpy(d, s) ({                    \
+    BUILD_BUG_ON(!is_char_array(d));            \
+    (strlcpy(d, s, sizeof(d)) >= sizeof(d));    \
+})
+#define safe_strcat(d, s) ({                    \
+    BUILD_BUG_ON(!is_char_array(d));            \
+    (strlcat(d, s, sizeof(d)) >= sizeof(d));    \
+})
 
 #endif /* _LINUX_STRING_H_ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>