[libvirt] [PATCH V3 4/6] libxl: implement connectGetDomainCapabilities
Jim Fehlig
jfehlig at suse.com
Tue Jun 14 15:06:51 UTC 2016
Roman Bogorodskiy wrote:
> Jim Fehlig wrote:
>
>> Add domain capabilities for PV and HVM domains.
>>
>> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>> ---
>>
>> V3:
>> - Change introduction of connectGetDomainCapabilities to 1.3.6
>>
>> src/libxl/libxl_capabilities.c | 140 +++++++++++++++++++++++++++++
>> src/libxl/libxl_capabilities.h | 7 ++
>> src/libxl/libxl_driver.c | 74 +++++++++++++++
>> tests/Makefile.am | 5 ++
>> tests/domaincapsschemadata/libxl-xenfv.xml | 68 ++++++++++++++
>> tests/domaincapsschemadata/libxl-xenpv.xml | 58 ++++++++++++
>> tests/domaincapstest.c | 61 +++++++++++++
>> tests/testutilsxen.h | 1 +
>> 8 files changed, 414 insertions(+)
>
> ...
>
>> --- a/tests/domaincapstest.c
>> +++ b/tests/domaincapstest.c
>> @@ -162,10 +162,41 @@ fillQemuCaps(virDomainCapsPtr domCaps,
>> #endif /* WITH_QEMU */
>>
>>
>> +#ifdef WITH_LIBXL
>> +# include "testutilsxen.h"
>> +
>> +static int
>> +fillXenCaps(virDomainCapsPtr domCaps)
>> +{
>> + virFirmwarePtr *firmwares;
>> + int ret = -1;
>> +
>> + if (VIR_ALLOC_N(firmwares, 2) < 0)
>> + return ret;
>> +
>> + if (VIR_ALLOC(firmwares[0]) < 0 || VIR_ALLOC(firmwares[1]) < 0)
>> + goto cleanup;
>> + if (VIR_STRDUP(firmwares[0]->name, "/usr/lib/xen/boot/hvmloader") < 0 ||
>> + VIR_STRDUP(firmwares[1]->name, "/usr/lib/xen/boot/ovmf.bin") < 0)
>> + goto cleanup;
>> +
>> + if (libxlMakeDomainCapabilities(domCaps, firmwares, 2) < 0)
>> + goto cleanup;
>> +
>> + ret = 0;
>> +
>> + cleanup:
>> + virFirmwareFreeList(firmwares, 2);
>> + return ret;
>> +}
>> +#endif /* WITH_LIBXL */
>> +
>> +
>> enum testCapsType {
>> CAPS_NONE,
>> CAPS_ALL,
>> CAPS_QEMU,
>> + CAPS_LIBXL,
>> };
>>
>> struct testData {
>> @@ -213,6 +244,13 @@ test_virDomainCapsFormat(const void *opaque)
>> goto cleanup;
>> #endif
>> break;
>> +
>> + case CAPS_LIBXL:
>> +#if WITH_LIBXL
>> + if (fillXenCaps(domCaps) < 0)
>> + goto cleanup;
>> +#endif
>> + break;
>> }
>>
>> if (!(domCapsXML = virDomainCapsFormat(domCaps)))
>> @@ -280,6 +318,20 @@ mymain(void)
>> VIR_FREE(name); \
>> } while (0)
>>
>> +#define DO_TEST_LIBXL(Name, Emulator, Machine, Arch, Type) \
>> + do { \
>> + struct testData data = { \
>> + .name = Name, \
>> + .emulator = Emulator, \
>> + .machine = Machine, \
>> + .arch = Arch, \
>> + .type = Type, \
>> + .capsType = CAPS_LIBXL, \
>> + }; \
>> + if (virTestRun(Name, test_virDomainCapsFormat, &data) < 0) \
>> + ret = -1; \
>> + } while (0)
>> +
>> DO_TEST("basic", "/bin/emulatorbin", "my-machine-type",
>> "x86_64", VIR_DOMAIN_VIRT_UML, CAPS_NONE);
>> DO_TEST("full", "/bin/emulatorbin", "my-machine-type",
>> @@ -313,6 +365,15 @@ mymain(void)
>>
>> #endif /* WITH_QEMU */
>>
>> +#if WITH_LIBXL
>> +
>> + DO_TEST_LIBXL("libxl-xenpv", "/usr/bin/qemu-system-x86_64",
>> + "xenpv", "x86_64", VIR_DOMAIN_VIRT_XEN);
>> + DO_TEST_LIBXL("libxl-xenfv", "/usr/bin/qemu-system-x86_64",
>> + "xenfv", "x86_64", VIR_DOMAIN_VIRT_XEN);
>> +
>> +#endif /* WITH_LIBXL */
>> +
>> return ret;
>> }
>>
>> diff --git a/tests/testutilsxen.h b/tests/testutilsxen.h
>> index c78350d..8b997c3 100644
>> --- a/tests/testutilsxen.h
>> +++ b/tests/testutilsxen.h
>> @@ -2,6 +2,7 @@
>> # define _TESTUTILSXEN_H_
>>
>> # include "capabilities.h"
>> +# include "libxl/libxl_capabilities.h"
>>
>> virCapsPtr testXenCapsInit(void);
>
> This breaks build without xl:
>
> gmake[2]: Entering directory '/usr/home/novel/code/libvirt/tests'
> CC vircapstest.o
> In file included from vircapstest.c:25:
> In file included from ./testutilsxen.h:5:
> ../src/libxl/libxl_capabilities.h:26:11: fatal error: 'libxl.h' file not found
> # include <libxl.h>
> ^
> 1 error generated.
> Makefile:4935: recipe for target 'vircapstest.o' failed
Sorry. My pre-commit checklist needs to grow to include testing broader changes
like this using '--without-xen --without-libxl'. Anyhow, it looks like Martin
already pushed a fix for this (thanks Martin!).
Regards,
Jim
More information about the libvir-list
mailing list