[libvirt] [PATCH] libxl: support <hap> feature
Joao Martins
joao.m.martins at oracle.com
Wed Feb 3 21:20:19 UTC 2016
On 02/03/2016 04:12 AM, Jim Fehlig wrote:
> Even though the libxl driver advertises <hap> in capabilities,
> it is ignored when set in domXML. Enable hap in the
> libxl_domain_create_info struct when <hap> is specified in domXML.
>
> The xm/xl <-> domXML parser/formatter already supports hap but
> lacked a test with hap enabled. Add a hap test.
>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
> src/libxl/libxl_conf.c | 8 ++++--
> tests/xlconfigdata/test-fullvirt-hap.cfg | 27 ++++++++++++++++++++
> tests/xlconfigdata/test-fullvirt-hap.xml | 42 ++++++++++++++++++++++++++++++++
> tests/xlconfigtest.c | 1 +
> 4 files changed, 76 insertions(+), 2 deletions(-)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 6320421..a531fdb 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -507,10 +507,14 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx,
>
> libxl_domain_create_info_init(c_info);
>
> - if (def->os.type == VIR_DOMAIN_OSTYPE_HVM)
> + if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
> c_info->type = LIBXL_DOMAIN_TYPE_HVM;
> - else
> + libxl_defbool_set(&c_info->hap,
> + def->features[VIR_DOMAIN_FEATURE_HAP] ==
> + VIR_TRISTATE_SWITCH_ON);
> + } else {
> c_info->type = LIBXL_DOMAIN_TYPE_PV;
> + }
>
> if (VIR_STRDUP(c_info->name, def->name) < 0)
> goto error;
> diff --git a/tests/xlconfigdata/test-fullvirt-hap.cfg b/tests/xlconfigdata/test-fullvirt-hap.cfg
> new file mode 100644
> index 0000000..aa1d79f
> --- /dev/null
> +++ b/tests/xlconfigdata/test-fullvirt-hap.cfg
> @@ -0,0 +1,27 @@
> +name = "XenGuest2"
> +uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
> +maxmem = 579
> +memory = 394
> +vcpus = 1
> +pae = 1
> +acpi = 1
> +apic = 1
> +hap = 1
> +viridian = 0
> +rtc_timeoffset = 0
> +localtime = 0
> +on_poweroff = "destroy"
> +on_reboot = "restart"
> +on_crash = "restart"
> +device_model = "/usr/lib/xen/bin/qemu-system-i386"
> +sdl = 0
> +vnc = 1
> +vncunused = 1
> +vnclisten = "127.0.0.1"
> +vncpasswd = "123poi"
> +vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
> +parallel = "none"
> +serial = "none"
> +builder = "hvm"
> +boot = "d"
> +disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,backendtype=phy" ]
> diff --git a/tests/xlconfigdata/test-fullvirt-hap.xml b/tests/xlconfigdata/test-fullvirt-hap.xml
> new file mode 100644
> index 0000000..f50b672
> --- /dev/null
> +++ b/tests/xlconfigdata/test-fullvirt-hap.xml
> @@ -0,0 +1,42 @@
> +<domain type='xen'>
> + <name>XenGuest2</name>
> + <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
> + <memory unit='KiB'>592896</memory>
> + <currentMemory unit='KiB'>403456</currentMemory>
> + <vcpu placement='static'>1</vcpu>
> + <os>
> + <type arch='x86_64' machine='xenfv'>hvm</type>
> + <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader>
> + <boot dev='cdrom'/>
> + </os>
> + <features>
> + <acpi/>
> + <apic/>
> + <pae/>
> + <hap/>
> + </features>
> + <clock offset='variable' adjustment='0' basis='utc'/>
> + <on_poweroff>destroy</on_poweroff>
> + <on_reboot>restart</on_reboot>
> + <on_crash>restart</on_crash>
> + <devices>
> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator>
> + <disk type='block' device='disk'>
> + <driver name='phy' type='raw'/>
> + <source dev='/dev/HostVG/XenGuest2'/>
> + <target dev='hda' bus='ide'/>
> + <address type='drive' controller='0' bus='0' target='0' unit='0'/>
> + </disk>
> + <interface type='bridge'>
> + <mac address='00:16:3e:66:92:9c'/>
> + <source bridge='xenbr1'/>
> + <script path='vif-bridge'/>
> + <model type='e1000'/>
> + </interface>
> + <input type='mouse' bus='ps2'/>
> + <input type='keyboard' bus='ps2'/>
> + <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123poi'>
> + <listen type='address' address='127.0.0.1'/>
> + </graphics>
> + </devices>
> +</domain>
> diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
> index bad69ca..3962e70 100644
> --- a/tests/xlconfigtest.c
> +++ b/tests/xlconfigtest.c
> @@ -209,6 +209,7 @@ mymain(void)
> DO_TEST("vif-rate");
>
> DO_TEST("paravirt-cmdline");
> + DO_TEST("fullvirt-hap");
> DO_TEST_FORMAT("paravirt-cmdline-extra-root");
> DO_TEST_FORMAT("paravirt-cmdline-bogus-extra-root");
>
>
FWIW looks good and also:
Tested-by: Joao Martins <joao.m.martins at oracle.com>
Regards,
Joao
More information about the libvir-list
mailing list