[libvirt] [PATCH v2 2/2] Xen: Fake versions in xencapstest

Eric Blake eblake at redhat.com
Fri Oct 14 15:28:19 UTC 2011


On 10/14/2011 06:10 AM, Philipp Hahn wrote:
> virInitialize() → xenRegister() → xenhypervisorInit() determins the

s/determins/determines/

> version of the Hypervisor. This breaks xencapstest when building as root
> on a dom0 system, since xenHypervisorBuildCapabilities() adds the "hap"
> and "viridian" features based on the detected version.
>
> Add an optional parameter to xenhypervisorInit() to disable automatic
> detection of the Hypervisor version. The passed in arguments are used
> instead.
>
> Signed-off-by: Philipp Hahn<hahn at univention.de>
> ---
>   src/xen/xen_driver.c     |    2 +-
>   src/xen/xen_hypervisor.c |   14 ++++++++++++--
>   src/xen/xen_hypervisor.h |    2 +-
>   tests/xencapstest.c      |   10 ++++++++++
>   4 files changed, 24 insertions(+), 4 deletions(-)

Yay - the override approach is much nicer than skipping the test.  Glad 
it was this easy to figure out.

> +++ b/src/xen/xen_hypervisor.c
> @@ -1951,12 +1951,16 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
>
>   /**
>    * xenHypervisorInit:
> + * @override_versions: pointer to optional struct xenHypervisorVersions with
> + *     version informations used instead of automatic version detection.

s/informations/information/

> +++ b/tests/xencapstest.c
> @@ -145,11 +145,21 @@ static int testXenppc64(const void *data ATTRIBUTE_UNUSED) {
>   }
>
>
> +/* Fake initialization data for xenHypervisorInit(). Must be initialized
> + * explicitly before the implicit call via virInitialize(). */
> +static struct xenHypervisorVersions hv_versions = {
> +	.hv = 0,
> +	.hypervisor = 2,
> +	.sys_interface = -1,
> +	.dom_interface = -1

Trailing commas make it easier to expand this in the future, if we ever 
need to.  And again, no tabs.

ACK with nits fixed, and pushed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list