PVHv2 toolstack leftovers
cover PVHv2 toolstack leftovers
Hello,
The following series contains a bugfix for libxc when creating PVH guests, and two patches to fix and expand the example configuration files.
My opinion is that all three should be accepted for 4.10. The first one because it's a bugfix, and the rest are just documentation fixes.
Thanks, Roger.
Roger Pau Monne (3):
libxc: panic when trying to create a PVH guest without kernel support
examples: fix HVM config file example
examples: add a PVH guest config file template
tools/examples/xlexample.hvm | 2 +- tools/examples/xlexample.pvhlinux | 42 +++++++++++++++++++++++++++++++++++++++ tools/libxc/xc_dom_elfloader.c | 7 +++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tools/examples/xlexample.pvhlinux
Signature · 7 lines
2.13.5 (Apple Git-94) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/3 libxc: panic when trying to create a PVH guest without kernel support
Previously when trying to boot a PV capable but not PVH capable kernel inside of a PVH container xc_dom_guest_type would succeed and return a PV guest type, which would lead to failures later on in the build process.
Instead provide a clear error message when trying to create a PVH guest using a kernel that doesn't support PVH.
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
--- tools/libxc/xc_dom_elfloader.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/libxc/xc_dom_elfloader.c +7 -0
@@ -59,6 +59,13 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,if ( dom->container_type ==XC_DOM_HVM_CONTAINER && dom->parms.phys_entry !=UNSET_ADDR32 )return "hvm-3.0-x86_32" ; +if ( dom->container_type ==XC_DOM_HVM_CONTAINER ) + { +xc_dom_panic (dom->xch,XC_INVALID_KERNEL , +"%s: image not capable of booting inside a HVM container" , + __FUNCTION__); +return "xen-3.0-unknown" ; + }switch ( machine ) {
Signature · 7 lines
2.13.5 (Apple Git-94) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
Roger Pau Monne writes ("[PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support"):
Quoted 7 lines
Previously when trying to boot a PV capable but not PVH capable kernel inside of a PVH container
xc_dom_guest_typewould succeed and return a PV guest type, which would lead to failures later on in the build process.Instead provide a clear error message when trying to create a PVH guest using a kernel that doesn't support PVH.
All three:
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
In reply to Roger Pau MonneRoger Pau Monne:
Quoted 24 lines
Previously when trying to boot a PV capable but not PVH capable kernel inside of a PVH container
xc_dom_guest_typewould succeed and return a PV guest type, which would lead to failures later on in the build process.Instead provide a clear error message when trying to create a PVH guest using a kernel that doesn't support PVH.
Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>--- tools/libxc/xc_dom_elfloader.c | 7 +++++++ 1 file changed, 7 insertions(+)tools/libxc/xc_dom_elfloader.c +0
-0@@ -59,6 +59,13 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,if ( dom->container_type ==XC_DOM_HVM_CONTAINER && dom->parms.phys_entry !=UNSET_ADDR32 )return "hvm-3.0-x86_32" ;
tools/libxc/xc_dom_elfloader.c static char *xc_dom_guest_type(struct xc_dom_image *dom, · line 71
Quoted 10 lines
tools/libxc/xc_dom_elfloader.c +7
-0+if ( dom->container_type ==XC_DOM_HVM_CONTAINER ) + { +xc_dom_panic (dom->xch,XC_INVALID_KERNEL , +"%s: image not capable of booting inside a HVM container" , + __FUNCTION__); +return "xen-3.0-unknown" ; + }switch ( machine ) {
With this xc_dom_parse_elf_kernel() still returns success and the domain build fails only later because of the "xen-3.0-unknown" type. Why not fail directly in xc_dom_parse_elf_kernel() like for elf files which miss the DomU feature?
And while we are at it: libxl__build_dom() expects that xc_dom_parse_elf_kernel() sets an errno. Currently this can contain an unrelated error since it does not get set when returning -EINVAL.
The following seems to work fine for me:
tools/libxc/xc_dom_elfloader.c +4 -1
@@ -64,7 +64,8 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,xc_dom_panic (dom->xch,XC_INVALID_KERNEL ,"%s: image not capable of booting inside a HVM container" , __FUNCTION__); -return "xen-3.0-unknown" ; + errno =EINVAL ; +return NULL ; } switch ( machine )
@@ -195,6 +196,8 @@ static elf_errorstatus xc_dom_parse_elf_kernel(struct xc_dom_image *dom) dom->kernel_seg.vend = dom->parms.virt_kend; dom->guest_type =xc_dom_guest_type (dom, elf); +if (dom->guest_type ==NULL ) +return -EINVAL ;DOMPRINTF ("%s: %s: 0x%" PRIx64" -> 0x%" PRIx64"" , __FUNCTION__, dom->guest_type, dom->kernel_seg.vstart, dom->kernel_seg.vend);
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH for-4.10 1/3] libxc: panic when trying to create a PVH guest without kernel support
Quoted 33 lines · On Fri, Jan 19, 2018 at 06:11:00AM +0000, HW42 wrote:
Roger Pau Monne:
Quoted 32 lines
Previously when trying to boot a PV capable but not PVH capable kernel inside of a PVH container
xc_dom_guest_typewould succeed and return a PV guest type, which would lead to failures later on in the build process.Instead provide a clear error message when trying to create a PVH guest using a kernel that doesn't support PVH.
Signed-off-by Roger Pau Monné <[email protected]>---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>--- tools/libxc/xc_dom_elfloader.c | 7 +++++++ 1 file changed, 7 insertions(+)tools/libxc/xc_dom_elfloader.c +7
-0@@ -59,6 +59,13 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,if ( dom->container_type ==XC_DOM_HVM_CONTAINER && dom->parms.phys_entry !=UNSET_ADDR32 )return "hvm-3.0-x86_32" ; +if ( dom->container_type ==XC_DOM_HVM_CONTAINER ) + { +xc_dom_panic (dom->xch,XC_INVALID_KERNEL , +"%s: image not capable of booting inside a HVM container" , + __FUNCTION__); +return "xen-3.0-unknown" ; + }
Quoted 7 lines
tools/libxc/xc_dom_elfloader.c static char *xc_dom_guest_type(struct xc_dom_image *dom, · line 71
Quoted 2 lines
tools/libxc/xc_dom_elfloader.c +0
-0switch ( machine ) {With this
xc_dom_parse_elf_kernel()still returns success and the domain build fails only later because of the "xen-3.0-unknown" type. Why not fail directly inxc_dom_parse_elf_kernel()like for elf files which miss the DomU feature?
This doesn't seem to be how xc_dom_guest_type works ATM. There's also a case below that also returns "xen-3.0-unknown", so iff you really want to change the first return of "xen-3.0-unknown" you should also change the one below AFAICT.
Quoted 3 lines
And while we are at it:
libxl__build_dom()expects thatxc_dom_parse_elf_kernel()sets an errno. Currently this can contain an unrelated error since it does not get set when returning-EINVAL.
Error handling in libxc is all fuzzy, as noted at the top of xc_dom_parse_elf_kernel:
/*
* This function sometimes returns -1 for error and sometimes
* an errno value. ?!?!
*/
The general consensus is that either you set errno = -EFOO and return -1, or simnply return -EFOO.
I can review the patches, but you will have to formally post them.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/3 examples: fix HVM config file example
In reply to Roger Pau MonneTo use the new 'type' option.
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
--- tools/examples/xlexample.hvm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/examples/xlexample.hvm +1 -1
@@ -6,7 +6,7 @@ # HVM guest. For a more complete guide see xl.cfg(5) # This configures an HVM rather than PV guest -builder = "hvm" +type = "hvm" # Guest name name = "example.hvm"
Signature · 7 lines
2.13.5 (Apple Git-94) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 3/3 examples: add a PVH guest config file template
In reply to Roger Pau Monne---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
--- tools/examples/xlexample.pvhlinux | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tools/examples/xlexample.pvhlinux
tools/examples/xlexample.pvhlinux new file +42 -0
@@ -0,0 +1,42 @@ +# ===================================================================== +# Example PVH Linux guest configuration +# ===================================================================== +# +# This is a fairly minimal example of what is required for a +# PVH Linux guest. For a more complete guide see xl.cfg(5) + +# This configures a PVH rather than PV guest +type = "pvh" + +# Guest name +name = "example.pvhlinux" + +# 128-bit UUID for the domain as a hexadecimal number. +# Use "uuidgen" to generate one if required. +# The default behavior is to generate a new UUID each time the guest is started. +#uuid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" + +# Kernel image to boot +kernel = "/boot/vmlinuz" + +# Ramdisk (optional) +#ramdisk = "/boot/initrd.gz" + +# Kernel command line options +extra = "root=/dev/xvda1" + +# Initial memory allocation (MB) +memory = 512 + +# Number of VCPUS +vcpus = 4 + +# Network devices +# A list of 'vifspec' entries as described in +# docs/misc/xl-network-configuration.markdown +vif = [ '' ] + +# Disk Devices +# A list of `diskspec' entries as described in +# docs/misc/xl-disk-configuration.txt +disk = [ '/dev/zvol/tank/guest-volume,raw,xvda,rw' ]
Signature · 7 lines
2.13.5 (Apple Git-94) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel