[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v3 4/8] Qemu Monitor API entry point.



On Fri, Jul 02, 2010 at 11:18:21AM -0400, Chris Lalancette wrote:
> Add the library entry point for the new virDomainQemuMonitorCommand()
> entry point.  Because this is not part of the "normal" libvirt API,
> it gets its own header file, library file, and will eventually
> get it's own over-the-wire protocol later in the series.
> 
> Changes since v1:
>  - Go back to using the virDriver table for qemuDomainMonitorCommand, due to
>    linking issues
>  - Added versioning information to the libvirt-qemu.so
> 

> diff --git a/src/libvirt-qemu.c b/src/libvirt-qemu.c
> new file mode 100644
> index 0000000..2d43e13
> --- /dev/null
> +++ b/src/libvirt-qemu.c
> @@ -0,0 +1,97 @@
> +#include <config.h>


This file is missing the standard LGPL header.

> +
> +#include "virterror_internal.h"
> +#include "logging.h"
> +#include "datatypes.h"
> +#include "libvirt/libvirt-qemu.h"
> +
> +/**
> + * virLibConnError:
> + * @conn: the connection if available
> + * @error: the error number
> + * @info: extra information string
> + *
> + * Handle an error at the connection level
> + */
> +static void
> +virLibConnError(virConnectPtr conn, virErrorNumber error, const char *info)
> +{
> +    const char *errmsg;
> +
> +    if (error == VIR_ERR_OK)
> +        return;
> +
> +    errmsg = virErrorMsg(error, info);
> +    virRaiseError(conn, NULL, NULL, VIR_FROM_NONE, error, VIR_ERR_ERROR,
> +                  errmsg, info, NULL, 0, 0, errmsg, info);
> +}
> +
> +/**
> + * virLibDomainError:
> + * @domain: the domain if available
> + * @error: the error number
> + * @info: extra information string
> + *
> + * Handle an error at the connection level
> + */
> +static void
> +virLibDomainError(virDomainPtr domain, virErrorNumber error,
> +                  const char *info)
> +{
> +    virConnectPtr conn = NULL;
> +    const char *errmsg;
> +
> +    if (error == VIR_ERR_OK)
> +        return;
> +
> +    errmsg = virErrorMsg(error, info);
> +    if (error != VIR_ERR_INVALID_DOMAIN) {
> +        conn = domain->conn;
> +    }
> +    virRaiseError(conn, domain, NULL, VIR_FROM_DOM, error, VIR_ERR_ERROR,
> +                  errmsg, info, NULL, 0, 0, errmsg, info);
> +}


Although the current libvirt.c does this, best to avoid creating
function wrappers for error reporting, because it means the source
file location information is lost. Instead #define a macro as with
other driver files.

> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index 849c163..77035ff 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -393,16 +393,15 @@ LIBVIRT_0.8.0 {
>          virDomainSnapshotFree;
>  } LIBVIRT_0.7.7;
>  
> -
>  LIBVIRT_0.8.1 {
>      global:
>          virDomainGetBlockInfo;
>  } LIBVIRT_0.8.0;
>  
> -
>  LIBVIRT_0.8.2 {
>      global:
>          virDomainCreateWithFlags;
> +        virDomainQemuMonitorCommand;
>  } LIBVIRT_0.8.1;

Now we've released 0.8.2, need to add a 0.8.3 here


Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]