[libvirt] [PATCH v3 05/13] Public API implementation
Daniel Veillard
veillard at redhat.com
Wed Dec 16 15:24:14 UTC 2009
On Wed, Dec 16, 2009 at 12:04:02AM +0100, Jiri Denemark wrote:
>
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
> src/libvirt.c | 41 +++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 41 insertions(+), 0 deletions(-)
>
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 103b331..4d9cb33 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -10706,3 +10706,44 @@ error:
> virSetConnError(conn);
> return -1;
> }
> +
> +
> +/**
> + * virConnectCompareCPU:
> + * @conn: virConnect connection
> + * @xml: XML describing the CPU to compare with host CPU
> + *
> + * Returns comparison result according to enum virCPUCompareResult
> + */
> +int
> +virConnectCompareCPU(virConnectPtr conn, const char *xmlDesc)
> +{
> + VIR_DEBUG("conn=%p, xmlDesc=%s", conn, xmlDesc);
> +
> + virResetLastError();
> +
> + if (!VIR_IS_CONNECT(conn)) {
> + virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
> + return VIR_CPU_COMPARE_ERROR;
> + }
> + if (xmlDesc == NULL) {
> + virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
> + goto error;
> + }
> +
> + if (conn->driver->cpuCompare) {
> + int ret;
> +
> + ret = conn->driver->cpuCompare(conn, xmlDesc);
> + if (ret == VIR_CPU_COMPARE_ERROR)
> + goto error;
> + return ret;
> + }
> +
> + virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
> +
> +error:
> + /* Copy to connection error object for back compatibility */
> + virSetConnError(conn);
> + return VIR_CPU_COMPARE_ERROR;
> +}
As of patch 3 I would prefer a flags there. ACK once done or justified
against
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list