ia64/xen-unstable

changeset 13042:0ee4e33b4401

Implement new booting parameters for Xen-API, and backwards compatibility for
the old bootloader settings.

We now have two mutually exclusive config groups HVM and PV, with HVM/boot
and PV/{bootloader,kernel,ramdisk,args,bootloader_args}.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Dec 14 18:24:14 2006 +0000 (2006-12-14)
parents da0849b74170
children bd102b60c43b
files tools/libxen/include/xen_vm.h tools/libxen/src/xen_vm.c tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendBootloader.py tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/image.py
line diff
     1.1 --- a/tools/libxen/include/xen_vm.h	Thu Dec 14 17:43:41 2006 +0000
     1.2 +++ b/tools/libxen/include/xen_vm.h	Thu Dec 14 18:24:14 2006 +0000
     1.3 @@ -19,7 +19,6 @@
     1.4  #ifndef XEN_VM_H
     1.5  #define XEN_VM_H
     1.6  
     1.7 -#include "xen_boot_type.h"
     1.8  #include "xen_common.h"
     1.9  #include "xen_console_decl.h"
    1.10  #include "xen_cpu_feature.h"
    1.11 @@ -36,9 +35,36 @@
    1.12  
    1.13  
    1.14  /*
    1.15 - * The VM class. 
    1.16 - *  
    1.17 + * The VM class.
    1.18 + * 
    1.19   * A virtual machine (or 'guest').
    1.20 + * 
    1.21 + * VM booting is controlled by setting one of the two mutually exclusive
    1.22 + * groups: "PV", and "HVM".  If HVM.boot is the empty string, then paravirtual
    1.23 + * domain building and booting will be used; otherwise the VM will be loaded
    1.24 + * as an HVM domain, and booted using an emulated BIOS.
    1.25 + * 
    1.26 + * When paravirtual booting is in use, the PV/bootloader field indicates the
    1.27 + * bootloader to use.  It may be "pygrub", in which case the platform's
    1.28 + * default installation of pygrub will be used, or a full path within the
    1.29 + * control domain to some other bootloader.  The other fields, PV/kernel,
    1.30 + * PV/ramdisk, PV/args and PV/bootloader_args will be passed to the bootloader
    1.31 + * unmodified, and interpretation of those fields is then specific to the
    1.32 + * bootloader itself, including the possibility that the bootloader will
    1.33 + * ignore some or all of those given values.
    1.34 + * 
    1.35 + * If the bootloader is pygrub, then the menu.lst is parsed if present in the
    1.36 + * guest's filesystem, otherwise the specified kernel and ramdisk are used, or
    1.37 + * an autodetected kernel is used if nothing is specified and autodetection is
    1.38 + * possible.  PV/args is appended to the kernel command line, no matter which
    1.39 + * mechanism is used for finding the kernel.
    1.40 + * 
    1.41 + * If PV/bootloader is empty but PV/kernel is specified, then the kernel and
    1.42 + * ramdisk values will be treated as paths within the control domain.  If both
    1.43 + * PV/bootloader and PV/kernel are empty, then the behaviour is as if
    1.44 + * PV/bootloader was specified as "pygrub".
    1.45 + * 
    1.46 + * When using HVM booting, HVM/boot specifies the order of the boot devices.
    1.47   */
    1.48  
    1.49  
    1.50 @@ -102,18 +128,17 @@ typedef struct xen_vm_record
    1.51      struct xen_vif_record_opt_set *vifs;
    1.52      struct xen_vbd_record_opt_set *vbds;
    1.53      struct xen_vtpm_record_opt_set *vtpms;
    1.54 -    char *bios_boot;
    1.55 +    char *pv_bootloader;
    1.56 +    char *pv_kernel;
    1.57 +    char *pv_ramdisk;
    1.58 +    char *pv_args;
    1.59 +    char *pv_bootloader_args;
    1.60 +    char *hvm_boot;
    1.61      bool platform_std_vga;
    1.62      char *platform_serial;
    1.63      bool platform_localtime;
    1.64      bool platform_clock_offset;
    1.65      bool platform_enable_audio;
    1.66 -    char *builder;
    1.67 -    enum xen_boot_type boot_method;
    1.68 -    char *kernel_kernel;
    1.69 -    char *kernel_initrd;
    1.70 -    char *kernel_args;
    1.71 -    char *grub_cmdline;
    1.72      char *pci_bus;
    1.73      xen_string_string_map *tools_version;
    1.74      xen_string_string_map *otherconfig;
    1.75 @@ -439,10 +464,45 @@ xen_vm_get_vtpms(xen_session *session, s
    1.76  
    1.77  
    1.78  /**
    1.79 - * Get the bios/boot field of the given VM.
    1.80 + * Get the PV/bootloader field of the given VM.
    1.81 + */
    1.82 +extern bool
    1.83 +xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm);
    1.84 +
    1.85 +
    1.86 +/**
    1.87 + * Get the PV/kernel field of the given VM.
    1.88 + */
    1.89 +extern bool
    1.90 +xen_vm_get_pv_kernel(xen_session *session, char **result, xen_vm vm);
    1.91 +
    1.92 +
    1.93 +/**
    1.94 + * Get the PV/ramdisk field of the given VM.
    1.95   */
    1.96  extern bool
    1.97 -xen_vm_get_bios_boot(xen_session *session, char **result, xen_vm vm);
    1.98 +xen_vm_get_pv_ramdisk(xen_session *session, char **result, xen_vm vm);
    1.99 +
   1.100 +
   1.101 +/**
   1.102 + * Get the PV/args field of the given VM.
   1.103 + */
   1.104 +extern bool
   1.105 +xen_vm_get_pv_args(xen_session *session, char **result, xen_vm vm);
   1.106 +
   1.107 +
   1.108 +/**
   1.109 + * Get the PV/bootloader_args field of the given VM.
   1.110 + */
   1.111 +extern bool
   1.112 +xen_vm_get_pv_bootloader_args(xen_session *session, char **result, xen_vm vm);
   1.113 +
   1.114 +
   1.115 +/**
   1.116 + * Get the HVM/boot field of the given VM.
   1.117 + */
   1.118 +extern bool
   1.119 +xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm);
   1.120  
   1.121  
   1.122  /**
   1.123 @@ -481,48 +541,6 @@ xen_vm_get_platform_enable_audio(xen_ses
   1.124  
   1.125  
   1.126  /**
   1.127 - * Get the builder field of the given VM.
   1.128 - */
   1.129 -extern bool
   1.130 -xen_vm_get_builder(xen_session *session, char **result, xen_vm vm);
   1.131 -
   1.132 -
   1.133 -/**
   1.134 - * Get the boot_method field of the given VM.
   1.135 - */
   1.136 -extern bool
   1.137 -xen_vm_get_boot_method(xen_session *session, enum xen_boot_type *result, xen_vm vm);
   1.138 -
   1.139 -
   1.140 -/**
   1.141 - * Get the kernel/kernel field of the given VM.
   1.142 - */
   1.143 -extern bool
   1.144 -xen_vm_get_kernel_kernel(xen_session *session, char **result, xen_vm vm);
   1.145 -
   1.146 -
   1.147 -/**
   1.148 - * Get the kernel/initrd field of the given VM.
   1.149 - */
   1.150 -extern bool
   1.151 -xen_vm_get_kernel_initrd(xen_session *session, char **result, xen_vm vm);
   1.152 -
   1.153 -
   1.154 -/**
   1.155 - * Get the kernel/args field of the given VM.
   1.156 - */
   1.157 -extern bool
   1.158 -xen_vm_get_kernel_args(xen_session *session, char **result, xen_vm vm);
   1.159 -
   1.160 -
   1.161 -/**
   1.162 - * Get the grub/cmdline field of the given VM.
   1.163 - */
   1.164 -extern bool
   1.165 -xen_vm_get_grub_cmdline(xen_session *session, char **result, xen_vm vm);
   1.166 -
   1.167 -
   1.168 -/**
   1.169   * Get the PCI_bus field of the given VM.
   1.170   */
   1.171  extern bool
   1.172 @@ -688,10 +706,45 @@ xen_vm_set_actions_after_crash(xen_sessi
   1.173  
   1.174  
   1.175  /**
   1.176 - * Set the bios/boot field of the given VM.
   1.177 + * Set the PV/bootloader field of the given VM.
   1.178 + */
   1.179 +extern bool
   1.180 +xen_vm_set_pv_bootloader(xen_session *session, xen_vm vm, char *bootloader);
   1.181 +
   1.182 +
   1.183 +/**
   1.184 + * Set the PV/kernel field of the given VM.
   1.185 + */
   1.186 +extern bool
   1.187 +xen_vm_set_pv_kernel(xen_session *session, xen_vm vm, char *kernel);
   1.188 +
   1.189 +
   1.190 +/**
   1.191 + * Set the PV/ramdisk field of the given VM.
   1.192   */
   1.193  extern bool
   1.194 -xen_vm_set_bios_boot(xen_session *session, xen_vm vm, char *boot);
   1.195 +xen_vm_set_pv_ramdisk(xen_session *session, xen_vm vm, char *ramdisk);
   1.196 +
   1.197 +
   1.198 +/**
   1.199 + * Set the PV/args field of the given VM.
   1.200 + */
   1.201 +extern bool
   1.202 +xen_vm_set_pv_args(xen_session *session, xen_vm vm, char *args);
   1.203 +
   1.204 +
   1.205 +/**
   1.206 + * Set the PV/bootloader_args field of the given VM.
   1.207 + */
   1.208 +extern bool
   1.209 +xen_vm_set_pv_bootloader_args(xen_session *session, xen_vm vm, char *bootloader_args);
   1.210 +
   1.211 +
   1.212 +/**
   1.213 + * Set the HVM/boot field of the given VM.
   1.214 + */
   1.215 +extern bool
   1.216 +xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot);
   1.217  
   1.218  
   1.219  /**
   1.220 @@ -730,48 +783,6 @@ xen_vm_set_platform_enable_audio(xen_ses
   1.221  
   1.222  
   1.223  /**
   1.224 - * Set the builder field of the given VM.
   1.225 - */
   1.226 -extern bool
   1.227 -xen_vm_set_builder(xen_session *session, xen_vm vm, char *builder);
   1.228 -
   1.229 -
   1.230 -/**
   1.231 - * Set the boot_method field of the given VM.
   1.232 - */
   1.233 -extern bool
   1.234 -xen_vm_set_boot_method(xen_session *session, xen_vm vm, enum xen_boot_type boot_method);
   1.235 -
   1.236 -
   1.237 -/**
   1.238 - * Set the kernel/kernel field of the given VM.
   1.239 - */
   1.240 -extern bool
   1.241 -xen_vm_set_kernel_kernel(xen_session *session, xen_vm vm, char *kernel);
   1.242 -
   1.243 -
   1.244 -/**
   1.245 - * Set the kernel/initrd field of the given VM.
   1.246 - */
   1.247 -extern bool
   1.248 -xen_vm_set_kernel_initrd(xen_session *session, xen_vm vm, char *initrd);
   1.249 -
   1.250 -
   1.251 -/**
   1.252 - * Set the kernel/args field of the given VM.
   1.253 - */
   1.254 -extern bool
   1.255 -xen_vm_set_kernel_args(xen_session *session, xen_vm vm, char *args);
   1.256 -
   1.257 -
   1.258 -/**
   1.259 - * Set the grub/cmdline field of the given VM.
   1.260 - */
   1.261 -extern bool
   1.262 -xen_vm_set_grub_cmdline(xen_session *session, xen_vm vm, char *cmdline);
   1.263 -
   1.264 -
   1.265 -/**
   1.266   * Set the otherConfig field of the given VM.
   1.267   */
   1.268  extern bool
   1.269 @@ -814,8 +825,8 @@ xen_vm_unpause(xen_session *session, xen
   1.270  
   1.271  /**
   1.272   * Attempt to cleanly shutdown the specified VM. (Note: this may not be
   1.273 - * supported---e.g. if a guest agent is not installed). 
   1.274 - *  
   1.275 + * supported---e.g. if a guest agent is not installed).
   1.276 + * 
   1.277   * Once shutdown has been completed perform poweroff action specified in guest
   1.278   * configuration.
   1.279   */
   1.280 @@ -825,8 +836,8 @@ xen_vm_clean_shutdown(xen_session *sessi
   1.281  
   1.282  /**
   1.283   * Attempt to cleanly shutdown the specified VM (Note: this may not be
   1.284 - * supported---e.g. if a guest agent is not installed). 
   1.285 - *  
   1.286 + * supported---e.g. if a guest agent is not installed).
   1.287 + * 
   1.288   * Once shutdown has been completed perform reboot action specified in guest
   1.289   * configuration.
   1.290   */
     2.1 --- a/tools/libxen/src/xen_vm.c	Thu Dec 14 17:43:41 2006 +0000
     2.2 +++ b/tools/libxen/src/xen_vm.c	Thu Dec 14 18:24:14 2006 +0000
     2.3 @@ -20,7 +20,6 @@
     2.4  #include <stddef.h>
     2.5  #include <stdlib.h>
     2.6  
     2.7 -#include "xen_boot_type_internal.h"
     2.8  #include "xen_common.h"
     2.9  #include "xen_console.h"
    2.10  #include "xen_cpu_feature.h"
    2.11 @@ -136,9 +135,24 @@ static const struct_member xen_vm_record
    2.12          { .key = "VTPMs",
    2.13            .type = &abstract_type_ref_set,
    2.14            .offset = offsetof(xen_vm_record, vtpms) },
    2.15 -        { .key = "bios_boot",
    2.16 +        { .key = "PV_bootloader",
    2.17 +          .type = &abstract_type_string,
    2.18 +          .offset = offsetof(xen_vm_record, pv_bootloader) },
    2.19 +        { .key = "PV_kernel",
    2.20 +          .type = &abstract_type_string,
    2.21 +          .offset = offsetof(xen_vm_record, pv_kernel) },
    2.22 +        { .key = "PV_ramdisk",
    2.23            .type = &abstract_type_string,
    2.24 -          .offset = offsetof(xen_vm_record, bios_boot) },
    2.25 +          .offset = offsetof(xen_vm_record, pv_ramdisk) },
    2.26 +        { .key = "PV_args",
    2.27 +          .type = &abstract_type_string,
    2.28 +          .offset = offsetof(xen_vm_record, pv_args) },
    2.29 +        { .key = "PV_bootloader_args",
    2.30 +          .type = &abstract_type_string,
    2.31 +          .offset = offsetof(xen_vm_record, pv_bootloader_args) },
    2.32 +        { .key = "HVM_boot",
    2.33 +          .type = &abstract_type_string,
    2.34 +          .offset = offsetof(xen_vm_record, hvm_boot) },
    2.35          { .key = "platform_std_VGA",
    2.36            .type = &abstract_type_bool,
    2.37            .offset = offsetof(xen_vm_record, platform_std_vga) },
    2.38 @@ -154,24 +168,6 @@ static const struct_member xen_vm_record
    2.39          { .key = "platform_enable_audio",
    2.40            .type = &abstract_type_bool,
    2.41            .offset = offsetof(xen_vm_record, platform_enable_audio) },
    2.42 -        { .key = "builder",
    2.43 -          .type = &abstract_type_string,
    2.44 -          .offset = offsetof(xen_vm_record, builder) },
    2.45 -        { .key = "boot_method",
    2.46 -          .type = &xen_boot_type_abstract_type_,
    2.47 -          .offset = offsetof(xen_vm_record, boot_method) },
    2.48 -        { .key = "kernel_kernel",
    2.49 -          .type = &abstract_type_string,
    2.50 -          .offset = offsetof(xen_vm_record, kernel_kernel) },
    2.51 -        { .key = "kernel_initrd",
    2.52 -          .type = &abstract_type_string,
    2.53 -          .offset = offsetof(xen_vm_record, kernel_initrd) },
    2.54 -        { .key = "kernel_args",
    2.55 -          .type = &abstract_type_string,
    2.56 -          .offset = offsetof(xen_vm_record, kernel_args) },
    2.57 -        { .key = "grub_cmdline",
    2.58 -          .type = &abstract_type_string,
    2.59 -          .offset = offsetof(xen_vm_record, grub_cmdline) },
    2.60          { .key = "PCI_bus",
    2.61            .type = &abstract_type_string,
    2.62            .offset = offsetof(xen_vm_record, pci_bus) },
    2.63 @@ -216,13 +212,13 @@ xen_vm_record_free(xen_vm_record *record
    2.64      xen_vif_record_opt_set_free(record->vifs);
    2.65      xen_vbd_record_opt_set_free(record->vbds);
    2.66      xen_vtpm_record_opt_set_free(record->vtpms);
    2.67 -    free(record->bios_boot);
    2.68 +    free(record->pv_bootloader);
    2.69 +    free(record->pv_kernel);
    2.70 +    free(record->pv_ramdisk);
    2.71 +    free(record->pv_args);
    2.72 +    free(record->pv_bootloader_args);
    2.73 +    free(record->hvm_boot);
    2.74      free(record->platform_serial);
    2.75 -    free(record->builder);
    2.76 -    free(record->kernel_kernel);
    2.77 -    free(record->kernel_initrd);
    2.78 -    free(record->kernel_args);
    2.79 -    free(record->grub_cmdline);
    2.80      free(record->pci_bus);
    2.81      xen_string_string_map_free(record->tools_version);
    2.82      xen_string_string_map_free(record->otherconfig);
    2.83 @@ -786,7 +782,41 @@ xen_vm_get_vtpms(xen_session *session, s
    2.84  
    2.85  
    2.86  bool
    2.87 -xen_vm_get_bios_boot(xen_session *session, char **result, xen_vm vm)
    2.88 +xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm)
    2.89 +{
    2.90 +    abstract_value param_values[] =
    2.91 +        {
    2.92 +            { .type = &abstract_type_string,
    2.93 +              .u.string_val = vm }
    2.94 +        };
    2.95 +
    2.96 +    abstract_type result_type = abstract_type_string;
    2.97 +
    2.98 +    *result = NULL;
    2.99 +    XEN_CALL_("VM.get_PV_bootloader");
   2.100 +    return session->ok;
   2.101 +}
   2.102 +
   2.103 +
   2.104 +bool
   2.105 +xen_vm_get_pv_kernel(xen_session *session, char **result, xen_vm vm)
   2.106 +{
   2.107 +    abstract_value param_values[] =
   2.108 +        {
   2.109 +            { .type = &abstract_type_string,
   2.110 +              .u.string_val = vm }
   2.111 +        };
   2.112 +
   2.113 +    abstract_type result_type = abstract_type_string;
   2.114 +
   2.115 +    *result = NULL;
   2.116 +    XEN_CALL_("VM.get_PV_kernel");
   2.117 +    return session->ok;
   2.118 +}
   2.119 +
   2.120 +
   2.121 +bool
   2.122 +xen_vm_get_pv_ramdisk(xen_session *session, char **result, xen_vm vm)
   2.123  {
   2.124      abstract_value param_values[] =
   2.125          {
   2.126 @@ -797,7 +827,58 @@ xen_vm_get_bios_boot(xen_session *sessio
   2.127      abstract_type result_type = abstract_type_string;
   2.128  
   2.129      *result = NULL;
   2.130 -    XEN_CALL_("VM.get_bios_boot");
   2.131 +    XEN_CALL_("VM.get_PV_ramdisk");
   2.132 +    return session->ok;
   2.133 +}
   2.134 +
   2.135 +
   2.136 +bool
   2.137 +xen_vm_get_pv_args(xen_session *session, char **result, xen_vm vm)
   2.138 +{
   2.139 +    abstract_value param_values[] =
   2.140 +        {
   2.141 +            { .type = &abstract_type_string,
   2.142 +              .u.string_val = vm }
   2.143 +        };
   2.144 +
   2.145 +    abstract_type result_type = abstract_type_string;
   2.146 +
   2.147 +    *result = NULL;
   2.148 +    XEN_CALL_("VM.get_PV_args");
   2.149 +    return session->ok;
   2.150 +}
   2.151 +
   2.152 +
   2.153 +bool
   2.154 +xen_vm_get_pv_bootloader_args(xen_session *session, char **result, xen_vm vm)
   2.155 +{
   2.156 +    abstract_value param_values[] =
   2.157 +        {
   2.158 +            { .type = &abstract_type_string,
   2.159 +              .u.string_val = vm }
   2.160 +        };
   2.161 +
   2.162 +    abstract_type result_type = abstract_type_string;
   2.163 +
   2.164 +    *result = NULL;
   2.165 +    XEN_CALL_("VM.get_PV_bootloader_args");
   2.166 +    return session->ok;
   2.167 +}
   2.168 +
   2.169 +
   2.170 +bool
   2.171 +xen_vm_get_hvm_boot(xen_session *session, char **result, xen_vm vm)
   2.172 +{
   2.173 +    abstract_value param_values[] =
   2.174 +        {
   2.175 +            { .type = &abstract_type_string,
   2.176 +              .u.string_val = vm }
   2.177 +        };
   2.178 +
   2.179 +    abstract_type result_type = abstract_type_string;
   2.180 +
   2.181 +    *result = NULL;
   2.182 +    XEN_CALL_("VM.get_HVM_boot");
   2.183      return session->ok;
   2.184  }
   2.185  
   2.186 @@ -884,108 +965,6 @@ xen_vm_get_platform_enable_audio(xen_ses
   2.187  
   2.188  
   2.189  bool
   2.190 -xen_vm_get_builder(xen_session *session, char **result, xen_vm vm)
   2.191 -{
   2.192 -    abstract_value param_values[] =
   2.193 -        {
   2.194 -            { .type = &abstract_type_string,
   2.195 -              .u.string_val = vm }
   2.196 -        };
   2.197 -
   2.198 -    abstract_type result_type = abstract_type_string;
   2.199 -
   2.200 -    *result = NULL;
   2.201 -    XEN_CALL_("VM.get_builder");
   2.202 -    return session->ok;
   2.203 -}
   2.204 -
   2.205 -
   2.206 -bool
   2.207 -xen_vm_get_boot_method(xen_session *session, enum xen_boot_type *result, xen_vm vm)
   2.208 -{
   2.209 -    abstract_value param_values[] =
   2.210 -        {
   2.211 -            { .type = &abstract_type_string,
   2.212 -              .u.string_val = vm }
   2.213 -        };
   2.214 -
   2.215 -    abstract_type result_type = xen_boot_type_abstract_type_;
   2.216 -    char *result_str = NULL;
   2.217 -    XEN_CALL_("VM.get_boot_method");
   2.218 -    *result = xen_boot_type_from_string(session, result_str);
   2.219 -    return session->ok;
   2.220 -}
   2.221 -
   2.222 -
   2.223 -bool
   2.224 -xen_vm_get_kernel_kernel(xen_session *session, char **result, xen_vm vm)
   2.225 -{
   2.226 -    abstract_value param_values[] =
   2.227 -        {
   2.228 -            { .type = &abstract_type_string,
   2.229 -              .u.string_val = vm }
   2.230 -        };
   2.231 -
   2.232 -    abstract_type result_type = abstract_type_string;
   2.233 -
   2.234 -    *result = NULL;
   2.235 -    XEN_CALL_("VM.get_kernel_kernel");
   2.236 -    return session->ok;
   2.237 -}
   2.238 -
   2.239 -
   2.240 -bool
   2.241 -xen_vm_get_kernel_initrd(xen_session *session, char **result, xen_vm vm)
   2.242 -{
   2.243 -    abstract_value param_values[] =
   2.244 -        {
   2.245 -            { .type = &abstract_type_string,
   2.246 -              .u.string_val = vm }
   2.247 -        };
   2.248 -
   2.249 -    abstract_type result_type = abstract_type_string;
   2.250 -
   2.251 -    *result = NULL;
   2.252 -    XEN_CALL_("VM.get_kernel_initrd");
   2.253 -    return session->ok;
   2.254 -}
   2.255 -
   2.256 -
   2.257 -bool
   2.258 -xen_vm_get_kernel_args(xen_session *session, char **result, xen_vm vm)
   2.259 -{
   2.260 -    abstract_value param_values[] =
   2.261 -        {
   2.262 -            { .type = &abstract_type_string,
   2.263 -              .u.string_val = vm }
   2.264 -        };
   2.265 -
   2.266 -    abstract_type result_type = abstract_type_string;
   2.267 -
   2.268 -    *result = NULL;
   2.269 -    XEN_CALL_("VM.get_kernel_args");
   2.270 -    return session->ok;
   2.271 -}
   2.272 -
   2.273 -
   2.274 -bool
   2.275 -xen_vm_get_grub_cmdline(xen_session *session, char **result, xen_vm vm)
   2.276 -{
   2.277 -    abstract_value param_values[] =
   2.278 -        {
   2.279 -            { .type = &abstract_type_string,
   2.280 -              .u.string_val = vm }
   2.281 -        };
   2.282 -
   2.283 -    abstract_type result_type = abstract_type_string;
   2.284 -
   2.285 -    *result = NULL;
   2.286 -    XEN_CALL_("VM.get_grub_cmdline");
   2.287 -    return session->ok;
   2.288 -}
   2.289 -
   2.290 -
   2.291 -bool
   2.292  xen_vm_get_pci_bus(xen_session *session, char **result, xen_vm vm)
   2.293  {
   2.294      abstract_value param_values[] =
   2.295 @@ -1357,7 +1336,87 @@ xen_vm_set_actions_after_crash(xen_sessi
   2.296  
   2.297  
   2.298  bool
   2.299 -xen_vm_set_bios_boot(xen_session *session, xen_vm vm, char *boot)
   2.300 +xen_vm_set_pv_bootloader(xen_session *session, xen_vm vm, char *bootloader)
   2.301 +{
   2.302 +    abstract_value param_values[] =
   2.303 +        {
   2.304 +            { .type = &abstract_type_string,
   2.305 +              .u.string_val = vm },
   2.306 +            { .type = &abstract_type_string,
   2.307 +              .u.string_val = bootloader }
   2.308 +        };
   2.309 +
   2.310 +    xen_call_(session, "VM.set_PV_bootloader", param_values, 2, NULL, NULL);
   2.311 +    return session->ok;
   2.312 +}
   2.313 +
   2.314 +
   2.315 +bool
   2.316 +xen_vm_set_pv_kernel(xen_session *session, xen_vm vm, char *kernel)
   2.317 +{
   2.318 +    abstract_value param_values[] =
   2.319 +        {
   2.320 +            { .type = &abstract_type_string,
   2.321 +              .u.string_val = vm },
   2.322 +            { .type = &abstract_type_string,
   2.323 +              .u.string_val = kernel }
   2.324 +        };
   2.325 +
   2.326 +    xen_call_(session, "VM.set_PV_kernel", param_values, 2, NULL, NULL);
   2.327 +    return session->ok;
   2.328 +}
   2.329 +
   2.330 +
   2.331 +bool
   2.332 +xen_vm_set_pv_ramdisk(xen_session *session, xen_vm vm, char *ramdisk)
   2.333 +{
   2.334 +    abstract_value param_values[] =
   2.335 +        {
   2.336 +            { .type = &abstract_type_string,
   2.337 +              .u.string_val = vm },
   2.338 +            { .type = &abstract_type_string,
   2.339 +              .u.string_val = ramdisk }
   2.340 +        };
   2.341 +
   2.342 +    xen_call_(session, "VM.set_PV_ramdisk", param_values, 2, NULL, NULL);
   2.343 +    return session->ok;
   2.344 +}
   2.345 +
   2.346 +
   2.347 +bool
   2.348 +xen_vm_set_pv_args(xen_session *session, xen_vm vm, char *args)
   2.349 +{
   2.350 +    abstract_value param_values[] =
   2.351 +        {
   2.352 +            { .type = &abstract_type_string,
   2.353 +              .u.string_val = vm },
   2.354 +            { .type = &abstract_type_string,
   2.355 +              .u.string_val = args }
   2.356 +        };
   2.357 +
   2.358 +    xen_call_(session, "VM.set_PV_args", param_values, 2, NULL, NULL);
   2.359 +    return session->ok;
   2.360 +}
   2.361 +
   2.362 +
   2.363 +bool
   2.364 +xen_vm_set_pv_bootloader_args(xen_session *session, xen_vm vm, char *bootloader_args)
   2.365 +{
   2.366 +    abstract_value param_values[] =
   2.367 +        {
   2.368 +            { .type = &abstract_type_string,
   2.369 +              .u.string_val = vm },
   2.370 +            { .type = &abstract_type_string,
   2.371 +              .u.string_val = bootloader_args }
   2.372 +        };
   2.373 +
   2.374 +    xen_call_(session, "VM.set_PV_bootloader_args", param_values, 2, NULL, NULL);
   2.375 +    return session->ok;
   2.376 +}
   2.377 +
   2.378 +
   2.379 +bool
   2.380 +xen_vm_set_hvm_boot(xen_session *session, xen_vm vm, char *boot)
   2.381  {
   2.382      abstract_value param_values[] =
   2.383          {
   2.384 @@ -1367,7 +1426,7 @@ xen_vm_set_bios_boot(xen_session *sessio
   2.385                .u.string_val = boot }
   2.386          };
   2.387  
   2.388 -    xen_call_(session, "VM.set_bios_boot", param_values, 2, NULL, NULL);
   2.389 +    xen_call_(session, "VM.set_HVM_boot", param_values, 2, NULL, NULL);
   2.390      return session->ok;
   2.391  }
   2.392  
   2.393 @@ -1453,102 +1512,6 @@ xen_vm_set_platform_enable_audio(xen_ses
   2.394  
   2.395  
   2.396  bool
   2.397 -xen_vm_set_builder(xen_session *session, xen_vm vm, char *builder)
   2.398 -{
   2.399 -    abstract_value param_values[] =
   2.400 -        {
   2.401 -            { .type = &abstract_type_string,
   2.402 -              .u.string_val = vm },
   2.403 -            { .type = &abstract_type_string,
   2.404 -              .u.string_val = builder }
   2.405 -        };
   2.406 -
   2.407 -    xen_call_(session, "VM.set_builder", param_values, 2, NULL, NULL);
   2.408 -    return session->ok;
   2.409 -}
   2.410 -
   2.411 -
   2.412 -bool
   2.413 -xen_vm_set_boot_method(xen_session *session, xen_vm vm, enum xen_boot_type boot_method)
   2.414 -{
   2.415 -    abstract_value param_values[] =
   2.416 -        {
   2.417 -            { .type = &abstract_type_string,
   2.418 -              .u.string_val = vm },
   2.419 -            { .type = &xen_boot_type_abstract_type_,
   2.420 -              .u.string_val = xen_boot_type_to_string(boot_method) }
   2.421 -        };
   2.422 -
   2.423 -    xen_call_(session, "VM.set_boot_method", param_values, 2, NULL, NULL);
   2.424 -    return session->ok;
   2.425 -}
   2.426 -
   2.427 -
   2.428 -bool
   2.429 -xen_vm_set_kernel_kernel(xen_session *session, xen_vm vm, char *kernel)
   2.430 -{
   2.431 -    abstract_value param_values[] =
   2.432 -        {
   2.433 -            { .type = &abstract_type_string,
   2.434 -              .u.string_val = vm },
   2.435 -            { .type = &abstract_type_string,
   2.436 -              .u.string_val = kernel }
   2.437 -        };
   2.438 -
   2.439 -    xen_call_(session, "VM.set_kernel_kernel", param_values, 2, NULL, NULL);
   2.440 -    return session->ok;
   2.441 -}
   2.442 -
   2.443 -
   2.444 -bool
   2.445 -xen_vm_set_kernel_initrd(xen_session *session, xen_vm vm, char *initrd)
   2.446 -{
   2.447 -    abstract_value param_values[] =
   2.448 -        {
   2.449 -            { .type = &abstract_type_string,
   2.450 -              .u.string_val = vm },
   2.451 -            { .type = &abstract_type_string,
   2.452 -              .u.string_val = initrd }
   2.453 -        };
   2.454 -
   2.455 -    xen_call_(session, "VM.set_kernel_initrd", param_values, 2, NULL, NULL);
   2.456 -    return session->ok;
   2.457 -}
   2.458 -
   2.459 -
   2.460 -bool
   2.461 -xen_vm_set_kernel_args(xen_session *session, xen_vm vm, char *args)
   2.462 -{
   2.463 -    abstract_value param_values[] =
   2.464 -        {
   2.465 -            { .type = &abstract_type_string,
   2.466 -              .u.string_val = vm },
   2.467 -            { .type = &abstract_type_string,
   2.468 -              .u.string_val = args }
   2.469 -        };
   2.470 -
   2.471 -    xen_call_(session, "VM.set_kernel_args", param_values, 2, NULL, NULL);
   2.472 -    return session->ok;
   2.473 -}
   2.474 -
   2.475 -
   2.476 -bool
   2.477 -xen_vm_set_grub_cmdline(xen_session *session, xen_vm vm, char *cmdline)
   2.478 -{
   2.479 -    abstract_value param_values[] =
   2.480 -        {
   2.481 -            { .type = &abstract_type_string,
   2.482 -              .u.string_val = vm },
   2.483 -            { .type = &abstract_type_string,
   2.484 -              .u.string_val = cmdline }
   2.485 -        };
   2.486 -
   2.487 -    xen_call_(session, "VM.set_grub_cmdline", param_values, 2, NULL, NULL);
   2.488 -    return session->ok;
   2.489 -}
   2.490 -
   2.491 -
   2.492 -bool
   2.493  xen_vm_set_otherconfig(xen_session *session, xen_vm vm, xen_string_string_map *otherconfig)
   2.494  {
   2.495      abstract_value param_values[] =
     3.1 --- a/tools/python/xen/xend/XendAPI.py	Thu Dec 14 17:43:41 2006 +0000
     3.2 +++ b/tools/python/xen/xend/XendAPI.py	Thu Dec 14 18:24:14 2006 +0000
     3.3 @@ -118,11 +118,16 @@ def valid_vm(func):
     3.4      @param func: function with params: (self, session, vm_ref)
     3.5      @rtype: callable object
     3.6      """    
     3.7 -    def check_vm_ref(self, session, vm_ref, *args, **kwargs):
     3.8 +    def check_vm_ref(self, session, *args, **kwargs):
     3.9 +        if len(args) == 0:
    3.10 +            return {'Status': 'Failure',
    3.11 +                    'ErrorDescription': XEND_ERROR_VM_INVALID}
    3.12 +
    3.13 +        vm_ref = args[0]
    3.14          xendom = XendDomain.instance()
    3.15          if type(vm_ref) == type(str()) and \
    3.16                 xendom.is_valid_vm(vm_ref):
    3.17 -            return func(self, session, vm_ref, *args, **kwargs)
    3.18 +            return func(self, session, *args, **kwargs)
    3.19          else:
    3.20              return {'Status': 'Failure',
    3.21                      'ErrorDescription': XEND_ERROR_VM_INVALID}
    3.22 @@ -590,19 +595,18 @@ class XendAPI:
    3.23                    'actions_after_reboot',
    3.24                    'actions_after_suspend',
    3.25                    'actions_after_crash',
    3.26 -                  'bios_boot',
    3.27 +                  'PV_bootloader',
    3.28 +                  'PV_kernel',
    3.29 +                  'PV_ramdisk',
    3.30 +                  'PV_args',
    3.31 +                  'PV_bootloader_args',
    3.32 +                  'HVM_boot',
    3.33                    'platform_std_VGA',
    3.34                    'platform_serial',
    3.35                    'platform_localtime',
    3.36                    'platform_clock_offset',
    3.37                    'platform_enable_audio',
    3.38                    'platform_keymap',
    3.39 -                  'builder',
    3.40 -                  'boot_method',
    3.41 -                  'kernel_kernel',
    3.42 -                  'kernel_initrd',
    3.43 -                  'kernel_args',
    3.44 -                  'grub_cmdline',
    3.45                    'otherConfig']
    3.46  
    3.47      VM_methods = ['clone',
    3.48 @@ -638,22 +642,30 @@ class XendAPI:
    3.49          'actions_after_reboot',
    3.50          'actions_after_suspend',
    3.51          'actions_after_crash',
    3.52 -        'bios_boot',
    3.53 +        'PV_bootloader',
    3.54 +        'PV_kernel',
    3.55 +        'PV_ramdisk',
    3.56 +        'PV_args',
    3.57 +        'PV_bootloader_args',
    3.58 +        'HVM_boot',
    3.59          'platform_std_VGA',
    3.60          'platform_serial',
    3.61          'platform_localtime',
    3.62          'platform_clock_offset',
    3.63          'platform_enable_audio',
    3.64          'platform_keymap',
    3.65 -        'builder',
    3.66 -        'boot_method',
    3.67 -        'kernel_kernel',
    3.68 -        'kernel_initrd',
    3.69 -        'kernel_args',
    3.70          'grub_cmdline',
    3.71          'PCI_bus',
    3.72          'otherConfig']
    3.73          
    3.74 +    def VM_get(self, name, session, vm_ref):
    3.75 +        return xen_api_success(
    3.76 +            XendDomain.instance().get_vm_by_uuid(vm_ref).info[name])
    3.77 +
    3.78 +    def VM_set(self, name, session, vm_ref, value):
    3.79 +        XendDomain.instance().get_vm_by_uuid(vm_ref).info[name] = value
    3.80 +        return xen_api_success_void()
    3.81 +
    3.82      # attributes (ro)
    3.83      def VM_get_power_state(self, session, vm_ref):
    3.84          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    3.85 @@ -767,9 +779,23 @@ class XendAPI:
    3.86          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    3.87          return xen_api_success(dom.get_on_crash())
    3.88      
    3.89 -    def VM_get_bios_boot(self, session, vm_ref):
    3.90 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
    3.91 -        return xen_api_success(dom.get_bios_boot())
    3.92 +    def VM_get_PV_bootloader(self, session, vm_ref):
    3.93 +        return self.VM_get('PV_bootloader', session, vm_ref)
    3.94 +    
    3.95 +    def VM_get_PV_kernel(self, session, vm_ref):
    3.96 +        return self.VM_get('PV_kernel', session, vm_ref)
    3.97 +    
    3.98 +    def VM_get_PV_ramdisk(self, session, vm_ref):
    3.99 +        return self.VM_get('PV_ramdisk', session, vm_ref)
   3.100 +    
   3.101 +    def VM_get_PV_args(self, session, vm_ref):
   3.102 +        return self.VM_get('PV_args', session, vm_ref)
   3.103 +
   3.104 +    def VM_get_PV_bootloader_args(self, session, vm_ref):
   3.105 +        return self.VM_get('PV_bootloader_args', session, vm_ref)
   3.106 +
   3.107 +    def VM_get_HVM_boot(self, session, vm_ref):
   3.108 +        return self.VM_get('HVM_boot', session, vm_ref)
   3.109      
   3.110      def VM_get_platform_std_VGA(self, session, vm_ref):
   3.111          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.112 @@ -795,34 +821,10 @@ class XendAPI:
   3.113          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.114          return xen_api_todo()
   3.115      
   3.116 -    def VM_get_builder(self, session, vm_ref):
   3.117 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.118 -        return xen_api_success(dom.get_builder())
   3.119 -    
   3.120 -    def VM_get_boot_method(self, session, vm_ref):
   3.121 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.122 -        return xen_api_success(dom.get_boot_method())
   3.123 -    
   3.124 -    def VM_get_kernel_kernel(self, session, vm_ref):
   3.125 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.126 -        return xen_api_success('')
   3.127 -    
   3.128 -    def VM_get_kernel_initrd(self, session, vm_ref):
   3.129 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.130 -        return xen_api_success('')
   3.131 -    
   3.132 -    def VM_get_kernel_args(self, session, vm_ref):
   3.133 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.134 -        return xen_api_success('')
   3.135 -    
   3.136 -    def VM_get_grub_cmdline(self, session, vm_ref):
   3.137 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.138 -        return xen_api_success('')
   3.139 -    
   3.140      def VM_get_otherConfig(self, session, vm_ref):
   3.141          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.142          return xen_api_todo()
   3.143 -    
   3.144 +
   3.145      def VM_set_name_label(self, session, vm_ref, label):
   3.146          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.147          dom.setName(label)
   3.148 @@ -879,11 +881,25 @@ class XendAPI:
   3.149      def VM_set_actions_after_crash(self, session, vm_ref):
   3.150          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.151          return xen_api_success_void()
   3.152 -    
   3.153 -    def VM_set_bios_boot(self, session, vm_ref):
   3.154 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.155 -        return xen_api_success_void()
   3.156 -    
   3.157 +
   3.158 +    def VM_set_HVM_boot(self, session, vm_ref, value):
   3.159 +        return self.VM_set('HVM_boot', session, vm_ref, value)
   3.160 +
   3.161 +    def VM_set_PV_bootloader(self, session, vm_ref, value):
   3.162 +        return self.VM_set('PV_bootloader', session, vm_ref, value)
   3.163 +
   3.164 +    def VM_set_PV_kernel(self, session, vm_ref, value):
   3.165 +        return self.VM_set('PV_kernel', session, vm_ref, value)
   3.166 +
   3.167 +    def VM_set_PV_ramdisk(self, session, vm_ref, value):
   3.168 +        return self.VM_set('PV_ramdisk', session, vm_ref, value)
   3.169 +
   3.170 +    def VM_set_PV_args(self, session, vm_ref, value):
   3.171 +        return self.VM_set('PV_args', session, vm_ref, value)
   3.172 +
   3.173 +    def VM_set_PV_bootloader_args(self, session, vm_ref, value):
   3.174 +        return self.VM_set('PV_bootloader_args', session, vm_ref, value)
   3.175 +
   3.176      def VM_set_platform_std_VGA(self, session, vm_ref):
   3.177          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.178          return xen_api_success_void()
   3.179 @@ -904,30 +920,6 @@ class XendAPI:
   3.180          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.181          return xen_api_success_void()
   3.182      
   3.183 -    def VM_set_builder(self, session, vm_ref):
   3.184 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.185 -        return xen_api_success_void()
   3.186 -    
   3.187 -    def VM_set_boot_method(self, session, vm_ref):
   3.188 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.189 -        return xen_api_success_void()
   3.190 -    
   3.191 -    def VM_set_kernel_kernel(self, session, vm_ref):
   3.192 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.193 -        return xen_api_success_void()
   3.194 -    
   3.195 -    def VM_set_kernel_initrd(self, session, vm_ref):
   3.196 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.197 -        return xen_api_success_void()
   3.198 -    
   3.199 -    def VM_set_kernel_args(self, session, vm_ref):
   3.200 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.201 -        return xen_api_success_void()
   3.202 -    
   3.203 -    def VM_set_grub_cmdline(self, session, vm_ref):
   3.204 -        dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.205 -        return xen_api_success_void()
   3.206 -    
   3.207      def VM_set_otherConfig(self, session, vm_ref):
   3.208          dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
   3.209          return xen_api_success_void()
   3.210 @@ -986,19 +978,18 @@ class XendAPI:
   3.211              'VIFs': xeninfo.get_vifs(),
   3.212              'VBDs': xeninfo.get_vbds(),
   3.213              'VTPMs': xeninfo.get_vtpms(),
   3.214 -            'bios_boot': xeninfo.get_bios_boot(),
   3.215 +            'PV_bootloader': xeninfo.info.get('PV_bootloader'),
   3.216 +            'PV_kernel': xeninfo.info.get('PV_kernel'),
   3.217 +            'PV_ramdisk': xeninfo.info.get('PV_ramdisk'),
   3.218 +            'PV_args': xeninfo.info.get('PV_args'),
   3.219 +            'PV_bootloader_args': xeninfo.info.get('PV_bootloader_args'),
   3.220 +            'HVM_boot': xeninfo.info.get('HVM_boot'),
   3.221              'platform_std_VGA': xeninfo.get_platform_std_vga(),
   3.222              'platform_serial': xeninfo.get_platform_serial(),
   3.223              'platform_localtime': xeninfo.get_platform_localtime(),
   3.224              'platform_clock_offset': xeninfo.get_platform_clock_offset(),
   3.225              'platform_enable_audio': xeninfo.get_platform_enable_audio(),
   3.226              'platform_keymap': xeninfo.get_platform_keymap(),
   3.227 -            'builder': xeninfo.get_builder(),
   3.228 -            'boot_method': xeninfo.get_boot_method(),
   3.229 -            'kernel_kernel': xeninfo.get_kernel_image(),
   3.230 -            'kernel_initrd': xeninfo.get_kernel_initrd(),
   3.231 -            'kernel_args': xeninfo.get_kernel_args(),
   3.232 -            'grub_cmdline': xeninfo.get_grub_cmdline(),
   3.233              'PCI_bus': xeninfo.get_pci_bus(),
   3.234              'tools_version': xeninfo.get_tools_version(),
   3.235              'otherConfig': xeninfo.get_other_config()
     4.1 --- a/tools/python/xen/xend/XendBootloader.py	Thu Dec 14 17:43:41 2006 +0000
     4.2 +++ b/tools/python/xen/xend/XendBootloader.py	Thu Dec 14 18:24:14 2006 +0000
     4.3 @@ -21,7 +21,8 @@ from xen.util import mkdir
     4.4  from XendLogging import log
     4.5  from XendError import VmError
     4.6  
     4.7 -def bootloader(blexec, disk, quiet = 0, blargs = None, imgcfg = None):
     4.8 +def bootloader(blexec, disk, quiet = False, blargs = '', kernel = '',
     4.9 +               ramdisk = '', kernel_args = ''):
    4.10      """Run the boot loader executable on the given disk and return a
    4.11      config image.
    4.12      @param blexec  Binary to use as the boot loader
    4.13 @@ -55,18 +56,19 @@ def bootloader(blexec, disk, quiet = 0, 
    4.14          if quiet:
    4.15              args.append("-q")
    4.16          args.append("--output=%s" % fifo)
    4.17 -        if blargs is not None:
    4.18 +        if blargs:
    4.19              args.extend(shlex.split(blargs))
    4.20          args.append(disk)
    4.21  
    4.22          try:
    4.23 +            log.debug("Launching bootloader as %s." % str(args))
    4.24              os.execvp(args[0], args)
    4.25          except OSError, e:
    4.26              print e
    4.27              pass
    4.28          os._exit(1)
    4.29  
    4.30 -    while 1:
    4.31 +    while True:
    4.32          try:
    4.33              r = os.open(fifo, os.O_RDONLY)
    4.34          except OSError, e:
    4.35 @@ -74,7 +76,7 @@ def bootloader(blexec, disk, quiet = 0, 
    4.36                  continue
    4.37          break
    4.38      ret = ""
    4.39 -    while 1:
    4.40 +    while True:
    4.41          select.select([r], [], [])
    4.42          s = os.read(r, 1024)
    4.43          ret = ret + s
    4.44 @@ -94,9 +96,4 @@ def bootloader(blexec, disk, quiet = 0, 
    4.45      pin.input(ret)
    4.46      pin.input_eof()
    4.47      blcfg = pin.val
    4.48 -
    4.49 -    if imgcfg is None:
    4.50 -        return blcfg
    4.51 -    else:
    4.52 -        c = sxp.merge(blcfg, imgcfg)
    4.53 -        return c
    4.54 +    return blcfg
     5.1 --- a/tools/python/xen/xend/XendConfig.py	Thu Dec 14 17:43:41 2006 +0000
     5.2 +++ b/tools/python/xen/xend/XendConfig.py	Thu Dec 14 18:24:14 2006 +0000
     5.3 @@ -103,7 +103,7 @@ XENAPI_HVM_CFG = {
     5.4      'platform_keymap' : 'keymap',
     5.5  }    
     5.6  
     5.7 -# List of XendConfig configuration keys that have no equivalent
     5.8 +# List of XendConfig configuration keys that have no direct equivalent
     5.9  # in the old world.
    5.10  
    5.11  XENAPI_CFG_TYPES = {
    5.12 @@ -132,19 +132,18 @@ XENAPI_CFG_TYPES = {
    5.13      'actions_after_crash': str,
    5.14      'tpm_instance': int,
    5.15      'tpm_backend': int,    
    5.16 -    'bios_boot': str,
    5.17 +    'PV_bootloader': str,
    5.18 +    'PV_kernel': str,
    5.19 +    'PV_initrd': str,
    5.20 +    'PV_args': str,
    5.21 +    'PV_bootloader_args': str,
    5.22 +    'HVM_boot': str,
    5.23      'platform_std_vga': bool0,
    5.24      'platform_serial': str,
    5.25      'platform_localtime': bool0,
    5.26      'platform_clock_offset': bool0,
    5.27      'platform_enable_audio': bool0,
    5.28      'platform_keymap': str,
    5.29 -    'boot_method': str,
    5.30 -    'builder': str,
    5.31 -    'kernel_kernel': str,
    5.32 -    'kernel_initrd': str,
    5.33 -    'kernel_args': str,
    5.34 -    'grub_cmdline': str,
    5.35      'pci_bus': str,
    5.36      'tools_version': dict,
    5.37      'otherconfig': dict,
    5.38 @@ -160,8 +159,6 @@ LEGACY_UNSUPPORTED_BY_XENAPI_CFG = [
    5.39      'vcpu_avail',
    5.40      'cpu_weight',
    5.41      'cpu_cap',
    5.42 -    'bootloader',
    5.43 -    'bootloader_args',
    5.44      'features',
    5.45      # read/write
    5.46      'on_xend_start',
    5.47 @@ -188,8 +185,6 @@ LEGACY_CFG_TYPES = {
    5.48      'cpu_cap':         int,
    5.49      'cpu_weight':      int,
    5.50      'cpu_time':      float,
    5.51 -    'bootloader':      str,
    5.52 -    'bootloader_args': str,
    5.53      'features':        str,
    5.54      'localtime':       int,
    5.55      'name':        str,
    5.56 @@ -331,16 +326,18 @@ class XendConfig(dict):
    5.57              'actions_after_crash': 'restart',
    5.58              'actions_after_suspend': '',
    5.59              'features': '',
    5.60 -            'builder': 'linux',
    5.61 +            'PV_bootloader': '',
    5.62 +            'PV_kernel': '',
    5.63 +            'PV_ramdisk': '',
    5.64 +            'PV_args': '',
    5.65 +            'PV_bootloader_args': '',
    5.66 +            'HVM_boot': '',
    5.67              'memory_static_min': 0,
    5.68              'memory_dynamic_min': 0,
    5.69              'shadow_memory': 0,
    5.70              'memory_static_max': 0,
    5.71              'memory_dynamic_max': 0,
    5.72              'memory_actual': 0,
    5.73 -            'boot_method': None,
    5.74 -            'bootloader': None,
    5.75 -            'bootloader_args': None,
    5.76              'devices': {},
    5.77              'image': {},
    5.78              'security': None,
    5.79 @@ -383,10 +380,6 @@ class XendConfig(dict):
    5.80                  raise XendConfigError('Invalid event handling mode: ' +
    5.81                                        event)
    5.82  
    5.83 -    def _builder_sanity_check(self):
    5.84 -        if self['builder'] not in ('hvm', 'linux'):
    5.85 -            raise XendConfigError('Invalid builder configuration')
    5.86 -
    5.87      def _vcpus_sanity_check(self):
    5.88          if self.get('vcpus_number') != None:
    5.89              self['vcpu_avail'] = (1 << self['vcpus_number']) - 1
    5.90 @@ -398,7 +391,6 @@ class XendConfig(dict):
    5.91      def validate(self):
    5.92          self._memory_sanity_check()
    5.93          self._actions_sanity_check()
    5.94 -        self._builder_sanity_check()
    5.95          self._vcpus_sanity_check()
    5.96          self._uuid_sanity_check()
    5.97  
    5.98 @@ -598,23 +590,12 @@ class XendConfig(dict):
    5.99              except KeyError:
   5.100                  pass
   5.101  
   5.102 -        # Convert Legacy "image" config to Xen API kernel_*
   5.103 -        # configuration
   5.104 +        self['PV_bootloader']      = cfg.get('bootloader',      '')
   5.105 +        self['PV_bootloader_args'] = cfg.get('bootloader_args', '')
   5.106 +        
   5.107          image_sxp = sxp.child_value(sxp_cfg, 'image', [])
   5.108          if image_sxp:
   5.109 -            self['kernel_kernel'] = sxp.child_value(image_sxp, 'kernel','')
   5.110 -            self['kernel_initrd'] = sxp.child_value(image_sxp, 'ramdisk','')
   5.111 -            kernel_args = sxp.child_value(image_sxp, 'args', '')
   5.112 -
   5.113 -            # attempt to extract extra arguments from SXP config
   5.114 -            arg_ip = sxp.child_value(image_sxp, 'ip')
   5.115 -            if arg_ip and not re.search(r'ip=[^ ]+', kernel_args):
   5.116 -                kernel_args += ' ip=%s' % arg_ip
   5.117 -            arg_root = sxp.child_value(image_sxp, 'root')
   5.118 -            if arg_root and not re.search(r'root=[^ ]+', kernel_args):
   5.119 -                kernel_args += ' root=%s' % arg_root
   5.120 -            
   5.121 -            self['kernel_args'] = kernel_args
   5.122 +            self.update_with_image_sxp(image_sxp)
   5.123  
   5.124          # Convert Legacy HVM parameters to Xen API configuration
   5.125          self['platform_std_vga'] = bool0(cfg.get('stdvga', 0))
   5.126 @@ -622,15 +603,6 @@ class XendConfig(dict):
   5.127          self['platform_localtime'] = bool0(cfg.get('localtime', 0))
   5.128          self['platform_enable_audio'] = bool0(cfg.get('soundhw', 0))
   5.129  
   5.130 -        # Convert path to bootloader to boot_method
   5.131 -        if not cfg.get('bootloader'):
   5.132 -            if self.get('kernel_kernel','').endswith('hvmloader'):
   5.133 -                self['boot_method'] = 'bios'
   5.134 -            else:
   5.135 -                self['boot_method'] = 'kernel_external'
   5.136 -        else:
   5.137 -            self['boot_method'] = 'grub'
   5.138 -
   5.139          # make sure a sane maximum is set
   5.140          if self['memory_static_max'] <= 0:
   5.141              self['memory_static_max'] = self['memory_static_min']
   5.142 @@ -705,9 +677,6 @@ class XendConfig(dict):
   5.143          if backend:
   5.144              self['backend'] = backend
   5.145  
   5.146 -        if self['image'].has_key('hvm'):
   5.147 -            self['builder'] = 'hvm'
   5.148 -            
   5.149          # Parse and convert other Non Xen API parameters.
   5.150          def _set_cfg_if_exists(sxp_arg):
   5.151              val = sxp.child_value(sxp_cfg, sxp_arg)
   5.152 @@ -717,7 +686,6 @@ class XendConfig(dict):
   5.153                  else:
   5.154                      self[sxp_arg] = val
   5.155  
   5.156 -        _set_cfg_if_exists('bootloader')
   5.157          _set_cfg_if_exists('shadow_memory')
   5.158          _set_cfg_if_exists('security')
   5.159          _set_cfg_if_exists('features')
   5.160 @@ -741,8 +709,9 @@ class XendConfig(dict):
   5.161          """
   5.162  
   5.163          # populate image
   5.164 -        self['image']['type'] = self['builder']
   5.165 -        if self['builder'] == 'hvm':
   5.166 +        hvm = self['HVM_boot'] != ''
   5.167 +        self['image']['type'] = hvm and 'hvm' or 'linux'
   5.168 +        if hvm:
   5.169              self['image']['hvm'] = {}
   5.170              for xapi, cfgapi in XENAPI_HVM_CFG.items():
   5.171                  self['image']['hvm'][cfgapi] = self[xapi]
   5.172 @@ -780,8 +749,10 @@ class XendConfig(dict):
   5.173          @type xapi: dict
   5.174          """
   5.175          for key, val in xapi.items():
   5.176 -            key = key.lower()
   5.177              type_conv = XENAPI_CFG_TYPES.get(key)
   5.178 +            if type_conv is None:
   5.179 +                key = key.lower()
   5.180 +                type_conv = XENAPI_CFG_TYPES.get(key)
   5.181              if callable(type_conv):
   5.182                  self[key] = type_conv(val)
   5.183              else:
   5.184 @@ -1100,8 +1071,8 @@ class XendConfig(dict):
   5.185      def update_with_image_sxp(self, image_sxp):
   5.186          # Convert Legacy "image" config to Xen API kernel_*
   5.187          # configuration
   5.188 -        self['kernel_kernel'] = sxp.child_value(image_sxp, 'kernel','')
   5.189 -        self['kernel_initrd'] = sxp.child_value(image_sxp, 'ramdisk','')
   5.190 +        self['PV_kernel'] = sxp.child_value(image_sxp, 'kernel','')
   5.191 +        self['PV_ramdisk'] = sxp.child_value(image_sxp, 'ramdisk','')
   5.192          kernel_args = sxp.child_value(image_sxp, 'args', '')
   5.193          
   5.194          # attempt to extract extra arguments from SXP config
   5.195 @@ -1111,7 +1082,7 @@ class XendConfig(dict):
   5.196          arg_root = sxp.child_value(image_sxp, 'root')
   5.197          if arg_root and not re.search(r'root=', kernel_args):
   5.198              kernel_args += ' root=%s' % arg_root
   5.199 -        self['kernel_args'] = kernel_args
   5.200 +        self['PV_args'] = kernel_args
   5.201  
   5.202          # Store image SXP in python dictionary format
   5.203          image = {}
     6.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Dec 14 17:43:41 2006 +0000
     6.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Dec 14 18:24:14 2006 +0000
     6.3 @@ -51,6 +51,7 @@ from xen.xend.XendConstants import *
     6.4  from xen.xend.XendAPIConstants import *
     6.5  
     6.6  MIGRATE_TIMEOUT = 30.0
     6.7 +BOOTLOADER_LOOPBACK_DEVICE = '/dev/xvdp'
     6.8  
     6.9  xc = xen.lowlevel.xc.xc()
    6.10  xroot = XendRoot.instance()
    6.11 @@ -438,6 +439,7 @@ class XendDomainInfo:
    6.12              xc.domain_pause(self.domid)
    6.13              self._stateSet(DOM_STATE_PAUSED)
    6.14          except Exception, ex:
    6.15 +            log.exception(ex)
    6.16              raise XendError("Domain unable to be paused: %s" % str(ex))
    6.17  
    6.18      def unpause(self):
    6.19 @@ -449,6 +451,7 @@ class XendDomainInfo:
    6.20              xc.domain_unpause(self.domid)
    6.21              self._stateSet(DOM_STATE_RUNNING)
    6.22          except Exception, ex:
    6.23 +            log.exception(ex)
    6.24              raise XendError("Domain unable to be unpaused: %s" % str(ex))
    6.25  
    6.26      def send_sysrq(self, key):
    6.27 @@ -467,7 +470,8 @@ class XendDomainInfo:
    6.28          dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
    6.29          dev_config_dict = self.info['devices'][dev_uuid][1]
    6.30          log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
    6.31 -        devid = self._createDevice(dev_type, dev_config_dict)
    6.32 +        dev_config_dict['devid'] = devid = \
    6.33 +             self._createDevice(dev_type, dev_config_dict)
    6.34          self._waitForDevice(dev_type, devid)
    6.35          return self.getDeviceController(dev_type).sxpr(devid)
    6.36  
    6.37 @@ -504,7 +508,7 @@ class XendDomainInfo:
    6.38          for devclass in XendDevices.valid_devices():
    6.39              self.getDeviceController(devclass).waitForDevices()
    6.40  
    6.41 -    def destroyDevice(self, deviceClass, devid, force=None):
    6.42 +    def destroyDevice(self, deviceClass, devid, force = False):
    6.43          try:
    6.44              devid = int(devid)
    6.45          except ValueError:
    6.46 @@ -972,7 +976,8 @@ class XendDomainInfo:
    6.47              self.refresh_shutdown_lock.release()
    6.48  
    6.49          if restart_reason:
    6.50 -            self._maybeRestart(restart_reason)
    6.51 +            threading.Thread(target = self._maybeRestart,
    6.52 +                             args = (restart_reason,)).start()
    6.53  
    6.54  
    6.55      #
    6.56 @@ -1015,7 +1020,6 @@ class XendDomainInfo:
    6.57          """
    6.58          from xen.xend import XendDomain
    6.59          
    6.60 -        self._configureBootloader()
    6.61          config = self.sxpr()
    6.62  
    6.63          if self._infoIsSet('cpus') and len(self.info['cpus']) != 0:
    6.64 @@ -1141,6 +1145,10 @@ class XendDomainInfo:
    6.65      def _waitForDevice(self, deviceClass, devid):
    6.66          return self.getDeviceController(deviceClass).waitForDevice(devid)
    6.67  
    6.68 +    def _waitForDeviceUUID(self, dev_uuid):
    6.69 +        deviceClass, config = self.info['devices'].get(dev_uuid)
    6.70 +        self._waitForDevice(deviceClass, config['devid'])
    6.71 +
    6.72      def _reconfigureDevice(self, deviceClass, devid, devconfig):
    6.73          return self.getDeviceController(deviceClass).reconfigureDevice(
    6.74              devid, devconfig)
    6.75 @@ -1244,6 +1252,8 @@ class XendDomainInfo:
    6.76  
    6.77          log.debug('XendDomainInfo.constructDomain')
    6.78  
    6.79 +        self.shutdownStartTime = None
    6.80 +
    6.81          image_cfg = self.info.get('image', {})
    6.82          hvm = image_cfg.has_key('hvm')
    6.83  
    6.84 @@ -1288,10 +1298,7 @@ class XendDomainInfo:
    6.85                    self.domid,
    6.86                    self.info['cpu_weight'])
    6.87  
    6.88 -        # if we have a boot loader but no image, then we need to set things
    6.89 -        # up by running the boot loader non-interactively
    6.90 -        if self.info.get('bootloader'):
    6.91 -            self._configureBootloader()
    6.92 +        self._configureBootloader()
    6.93  
    6.94          if not self._infoIsSet('image'):
    6.95              raise VmError('Missing image in configuration')
    6.96 @@ -1352,17 +1359,14 @@ class XendDomainInfo:
    6.97  
    6.98              self._createDevices()
    6.99  
   6.100 -            if self.info['bootloader']:
   6.101 -                self.image.cleanupBootloading()
   6.102 +            self.image.cleanupBootloading()
   6.103  
   6.104              self.info['start_time'] = time.time()
   6.105  
   6.106              self._stateSet(DOM_STATE_RUNNING)
   6.107          except RuntimeError, exn:
   6.108              log.exception("XendDomainInfo.initDomain: exception occurred")
   6.109 -            if self.info['bootloader'] not in (None, 'kernel_external') \
   6.110 -                   and self.image is not None:
   6.111 -                self.image.cleanupBootloading()
   6.112 +            self.image.cleanupBootloading()
   6.113              raise VmError(str(exn))
   6.114  
   6.115  
   6.116 @@ -1493,33 +1497,78 @@ class XendDomainInfo:
   6.117  
   6.118      def _configureBootloader(self):
   6.119          """Run the bootloader if we're configured to do so."""
   6.120 -        if not self.info.get('bootloader'):
   6.121 -            return
   6.122 -        blcfg = None
   6.123 +
   6.124 +        blexec          = self.info['PV_bootloader']
   6.125 +        bootloader_args = self.info['PV_bootloader_args']
   6.126 +        kernel          = self.info['PV_kernel']
   6.127 +        ramdisk         = self.info['PV_ramdisk']
   6.128 +        args            = self.info['PV_args']
   6.129 +        boot            = self.info['HVM_boot']
   6.130  
   6.131 -        # FIXME: this assumes that we want to use the first disk device
   6.132 -        for (devtype, devinfo) in self.info.all_devices_sxpr():
   6.133 -            if not devtype or not devinfo or devtype not in ('vbd', 'tap'):
   6.134 -                continue
   6.135 -            disk = None
   6.136 -            for param in devinfo:
   6.137 -                if param[0] == 'uname':
   6.138 -                    disk = param[1]
   6.139 -                    break
   6.140 +        if boot:
   6.141 +            # HVM booting.
   6.142 +            self.info['image']['type'] = 'hvm'
   6.143 +            self.info['image']['devices']['boot'] = boot
   6.144 +        elif not blexec and kernel:
   6.145 +            # Boot from dom0.  Nothing left to do -- the kernel and ramdisk
   6.146 +            # will be picked up by image.py.
   6.147 +            pass
   6.148 +        else:
   6.149 +            # Boot using bootloader
   6.150 +            if not blexec or blexec == 'pygrub':
   6.151 +                blexec = '/usr/bin/pygrub'
   6.152 +
   6.153 +            blcfg = None
   6.154 +            for (devtype, devinfo) in self.info.all_devices_sxpr():
   6.155 +                if not devtype or not devinfo or devtype not in ('vbd', 'tap'):
   6.156 +                    continue
   6.157 +                disk = None
   6.158 +                for param in devinfo:
   6.159 +                    if param[0] == 'uname':
   6.160 +                        disk = param[1]
   6.161 +                        break
   6.162  
   6.163 -            if disk is None:
   6.164 -                continue
   6.165 -            fn = blkdev_uname_to_file(disk)
   6.166 -            blcfg = bootloader(self.info['bootloader'], fn, 1,
   6.167 -                               self.info['bootloader_args'],
   6.168 -                               self.info['image'])
   6.169 -            break
   6.170 -        if blcfg is None:
   6.171 -            msg = "Had a bootloader specified, but can't find disk"
   6.172 -            log.error(msg)
   6.173 -            raise VmError(msg)
   6.174 +                if disk is None:
   6.175 +                    continue
   6.176 +                fn = blkdev_uname_to_file(disk)
   6.177 +                mounted = devtype == 'tap' and not os.stat(fn).st_rdev
   6.178 +                if mounted:
   6.179 +                    # This is a file, not a device.  pygrub can cope with a
   6.180 +                    # file if it's raw, but if it's QCOW or other such formats
   6.181 +                    # used through blktap, then we need to mount it first.
   6.182 +
   6.183 +                    log.info("Mounting %s on %s." %
   6.184 +                             (fn, BOOTLOADER_LOOPBACK_DEVICE))
   6.185 +
   6.186 +                    vbd = {
   6.187 +                        'mode': 'RO',
   6.188 +                        'device': BOOTLOADER_LOOPBACK_DEVICE,
   6.189 +                        }
   6.190 +
   6.191 +                    from xen.xend import XendDomain
   6.192 +                    dom0 = XendDomain.instance().privilegedDomain()
   6.193 +                    dom0._waitForDeviceUUID(dom0.create_vbd_with_vdi(vbd, fn))
   6.194 +                    fn = BOOTLOADER_LOOPBACK_DEVICE
   6.195 +
   6.196 +                try:
   6.197 +                    blcfg = bootloader(blexec, fn, True,
   6.198 +                                       bootloader_args, kernel, ramdisk, args)
   6.199 +                finally:
   6.200 +                    if mounted:
   6.201 +                        log.info("Unmounting %s from %s." %
   6.202 +                                 (fn, BOOTLOADER_LOOPBACK_DEVICE))
   6.203 +
   6.204 +                        dom0.destroyDevice('tap', '/dev/xvdp')
   6.205 +
   6.206 +                break
   6.207 +
   6.208 +            if blcfg is None:
   6.209 +                msg = "Had a bootloader specified, but can't find disk"
   6.210 +                log.error(msg)
   6.211 +                raise VmError(msg)
   6.212          
   6.213 -        self.info.update_with_image_sxp(blcfg)
   6.214 +            self.info.update_with_image_sxp(blcfg)
   6.215 +
   6.216  
   6.217      # 
   6.218      # VM Functions
   6.219 @@ -1764,8 +1813,6 @@ class XendDomainInfo:
   6.220          return '' # TODO
   6.221      def get_power_state(self):
   6.222          return XEN_API_VM_POWER_STATE[self.state]
   6.223 -    def get_bios_boot(self):
   6.224 -        return '' # TODO
   6.225      def get_platform_std_vga(self):
   6.226          return self.info.get('platform_std_vga', False)    
   6.227      def get_platform_keymap(self):
   6.228 @@ -1780,18 +1827,6 @@ class XendDomainInfo:
   6.229          return self.info.get('platform_enable_audio', False)
   6.230      def get_platform_keymap(self):
   6.231          return self.info.get('platform_keymap', '')
   6.232 -    def get_builder(self):
   6.233 -        return self.info.get('builder', 0)
   6.234 -    def get_boot_method(self):
   6.235 -        return self.info.get('boot_method', XEN_API_BOOT_TYPE[2])
   6.236 -    def get_kernel_image(self):
   6.237 -        return self.info.get('kernel_kernel', '')
   6.238 -    def get_kernel_initrd(self):
   6.239 -        return self.info.get('kernel_initrd', '')
   6.240 -    def get_kernel_args(self):
   6.241 -        return self.info.get('kernel_args', '')
   6.242 -    def get_grub_cmdline(self):
   6.243 -        return '' # TODO
   6.244      def get_pci_bus(self):
   6.245          return '' # TODO
   6.246      def get_tools_version(self):
   6.247 @@ -1950,10 +1985,9 @@ class XendDomainInfo:
   6.248          if not dev_uuid:
   6.249              raise XendError('Failed to create device')
   6.250          
   6.251 -        if self.state in (XEN_API_VM_POWER_STATE_RUNNING,):
   6.252 -            sxpr = self.info.device_sxpr(dev_uuid)
   6.253 -            devid = self.getDeviceController('vbd').createDevice(sxpr)
   6.254 -            raise XendError("Device creation failed")
   6.255 +        if self.state == XEN_API_VM_POWER_STATE_RUNNING:
   6.256 +            _, config = self.info['devices'][dev_uuid]
   6.257 +            config['devid'] = self.getDeviceController('vbd').createDevice(config)
   6.258  
   6.259          return dev_uuid
   6.260  
   6.261 @@ -1971,10 +2005,9 @@ class XendDomainInfo:
   6.262          if not dev_uuid:
   6.263              raise XendError('Failed to create device')
   6.264  
   6.265 -        if self.state in (XEN_API_VM_POWER_STATE_RUNNING,):
   6.266 -            sxpr = self.info.device_sxpr(dev_uuid)
   6.267 -            devid = self.getDeviceController('tap').createDevice(sxpr)
   6.268 -            raise XendError("Device creation failed")
   6.269 +        if self.state == XEN_API_VM_POWER_STATE_RUNNING:
   6.270 +            _, config = self.info['devices'][dev_uuid]
   6.271 +            config['devid'] = self.getDeviceController('tap').createDevice(config)
   6.272  
   6.273          return dev_uuid
   6.274  
   6.275 @@ -1989,10 +2022,9 @@ class XendDomainInfo:
   6.276          if not dev_uuid:
   6.277              raise XendError('Failed to create device')
   6.278          
   6.279 -        if self.state in (XEN_API_VM_POWER_STATE_RUNNING,):
   6.280 -            sxpr = self.info.device_sxpr(dev_uuid)
   6.281 -            devid = self.getDeviceController('vif').createDevice(sxpr)
   6.282 -            raise XendError("Device creation failed")
   6.283 +        if self.state == XEN_API_VM_POWER_STATE_RUNNING:
   6.284 +            _, config = self.info['devices'][dev_uuid]
   6.285 +            config['devid'] = self.getDeviceController('vif').createDevice(config)
   6.286  
   6.287          return dev_uuid
   6.288  
     7.1 --- a/tools/python/xen/xend/image.py	Thu Dec 14 17:43:41 2006 +0000
     7.2 +++ b/tools/python/xen/xend/image.py	Thu Dec 14 18:24:14 2006 +0000
     7.3 @@ -68,6 +68,7 @@ class ImageHandler:
     7.4      def __init__(self, vm, vmConfig, imageConfig, deviceConfig):
     7.5          self.vm = vm
     7.6  
     7.7 +        self.bootloader = None
     7.8          self.kernel = None
     7.9          self.ramdisk = None
    7.10          self.cmdline = None
    7.11 @@ -76,9 +77,10 @@ class ImageHandler:
    7.12  
    7.13      def configure(self, vmConfig, imageConfig, _):
    7.14          """Config actions common to all unix-like domains."""
    7.15 -        self.kernel = vmConfig['kernel_kernel']
    7.16 -        self.cmdline = vmConfig['kernel_args']
    7.17 -        self.ramdisk = vmConfig['kernel_initrd']
    7.18 +        self.bootloader = vmConfig['PV_bootloader']
    7.19 +        self.kernel = vmConfig['PV_kernel']
    7.20 +        self.cmdline = vmConfig['PV_args']
    7.21 +        self.ramdisk = vmConfig['PV_ramdisk']
    7.22          self.vm.storeVm(("image/ostype", self.ostype),
    7.23                          ("image/kernel", self.kernel),
    7.24                          ("image/cmdline", self.cmdline),
    7.25 @@ -86,8 +88,9 @@ class ImageHandler:
    7.26  
    7.27  
    7.28      def cleanupBootloading(self):
    7.29 -        self.unlink(self.kernel)
    7.30 -        self.unlink(self.ramdisk)
    7.31 +        if self.bootloader:
    7.32 +            self.unlink(self.kernel)
    7.33 +            self.unlink(self.ramdisk)
    7.34  
    7.35  
    7.36      def unlink(self, f):