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<[email protected]>
---
  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   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to