From f193e19536ce7c829d4077ea52c1fb73565add21 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 5 Sep 2008 11:35:43 +0000 Subject: [PATCH] Fix xen capabilities data creation --- ChangeLog | 6 ++++++ src/xen_internal.c | 18 ++++++++++++------ src/xen_internal.h | 5 +++-- src/xen_unified.c | 2 +- tests/xencapstest.c | 2 +- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16c3f049d2..052f05659d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Sep 5 12:33:26 BST 2008 Daniel P. Berrange + + * src/xen_unified.c, src/xen_internal.c, src/xen_internal.h, + tests/xencapstest.c: Pass connection object into capabilities + constructor since it needs to talk to XenD + Thu Sep 4 15:33:26 CEST 2008 Daniel Veillard * src/storage_backend_fs.c: fix a signed/unsigned issue breaking diff --git a/src/xen_internal.c b/src/xen_internal.c index 36c5bb74ff..3cfc5e3cfb 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -2159,7 +2159,8 @@ struct guest_arch { static virCapsPtr -xenHypervisorBuildCapabilities(const char *hostmachine, +xenHypervisorBuildCapabilities(virConnectPtr conn, + const char *hostmachine, int host_pae, char *hvm_type, struct guest_arch *guest_archs, @@ -2185,7 +2186,7 @@ xenHypervisorBuildCapabilities(const char *hostmachine, if (sys_interface_version >= 4) { - if (xenDaemonNodeGetTopology(NULL, caps) != 0) { + if (xenDaemonNodeGetTopology(conn, caps) != 0) { virCapabilitiesFree(caps); return NULL; } @@ -2271,7 +2272,8 @@ xenHypervisorBuildCapabilities(const char *hostmachine, * Return the capabilities of this hypervisor. */ virCapsPtr -xenHypervisorMakeCapabilitiesInternal(const char *hostmachine, +xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn, + const char *hostmachine, FILE *cpuinfo, FILE *capabilities) { char line[1024], *str, *token; @@ -2404,7 +2406,8 @@ xenHypervisorMakeCapabilitiesInternal(const char *hostmachine, } } - if ((caps = xenHypervisorBuildCapabilities(hostmachine, + if ((caps = xenHypervisorBuildCapabilities(conn, + hostmachine, host_pae, hvm_type, guest_archs, @@ -2425,7 +2428,7 @@ xenHypervisorMakeCapabilitiesInternal(const char *hostmachine, * Return the capabilities of this hypervisor. */ virCapsPtr -xenHypervisorMakeCapabilities(void) +xenHypervisorMakeCapabilities(virConnectPtr conn) { virCapsPtr caps; FILE *cpuinfo, *capabilities; @@ -2451,7 +2454,10 @@ xenHypervisorMakeCapabilities(void) } } - caps = xenHypervisorMakeCapabilitiesInternal(utsname.machine, cpuinfo, capabilities); + caps = xenHypervisorMakeCapabilitiesInternal(conn, + utsname.machine, + cpuinfo, + capabilities); if (cpuinfo) fclose(cpuinfo); diff --git a/src/xen_internal.h b/src/xen_internal.h index eeeaf7cfea..d685a6c426 100644 --- a/src/xen_internal.h +++ b/src/xen_internal.h @@ -17,7 +17,7 @@ extern struct xenUnifiedDriver xenHypervisorDriver; int xenHypervisorInit (void); -virCapsPtr xenHypervisorMakeCapabilities (void); +virCapsPtr xenHypervisorMakeCapabilities (virConnectPtr conn); /* The following calls are made directly by the Xen proxy: */ @@ -38,7 +38,8 @@ int xenHypervisorClose (virConnectPtr conn); int xenHypervisorGetVersion (virConnectPtr conn, unsigned long *hvVer); virCapsPtr - xenHypervisorMakeCapabilitiesInternal(const char *hostmachine, + xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn, + const char *hostmachine, FILE *cpuinfo, FILE *capabilities); char * diff --git a/src/xen_unified.c b/src/xen_unified.c index 17dc335d8c..58073915ba 100644 --- a/src/xen_unified.c +++ b/src/xen_unified.c @@ -333,7 +333,7 @@ xenUnifiedOpen (virConnectPtr conn, xmlURIPtr uri, virConnectAuthPtr auth, int f } } - if (!(priv->caps = xenHypervisorMakeCapabilities())) { + if (!(priv->caps = xenHypervisorMakeCapabilities(conn))) { DEBUG0("Failed to make capabilities"); goto fail; } diff --git a/tests/xencapstest.c b/tests/xencapstest.c index 2dd5bb51ef..1c173d3b4e 100644 --- a/tests/xencapstest.c +++ b/tests/xencapstest.c @@ -49,7 +49,7 @@ static int testCompareFiles(const char *hostmachine, if (!(fp2 = fopen(capabilities, "r"))) goto fail; - if (!(caps = xenHypervisorMakeCapabilitiesInternal(hostmachine, fp1, fp2))) + if (!(caps = xenHypervisorMakeCapabilitiesInternal(NULL, hostmachine, fp1, fp2))) goto fail; if (!(actualxml = virCapabilitiesFormatXML(caps)))