[Libvir] PATCH 2/2: Support QEMU (+KVM) in libvirt

Daniel Veillard veillard at redhat.com
Tue Jan 9 14:44:44 UTC 2007


On Fri, Jan 05, 2007 at 09:18:53PM +0000, Daniel P. Berrange wrote:
> The attached patch provides a new driver backend for libvirt which allows
> management of QEMU instances by talking to the libvirt QEMU daemon. It
> basically just marshalls libvirt API calls onto the wire & de-marshalls
> the reply. All the interesting functionality stuff is in the daemon.

  Okay, but I'm getting a bit lost about the potential daemons running,
there one can be autostarted, in the previous patch we also potentially
fork(fork(daemon)) so I'm wondering how many process are actually running
in the end, maybe I will need a couple of pictures, like in the current
architecture page http://libvirt.org/architecture.html (which will have
to be updated too :-)
  But this looks fun ! A lot of code looks familiar, seems there is many 
path we could identify as duplicate and put in a library ...


[...]
> +int qemudNodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED,
> +                     virNodeInfoPtr info){
> +    info->cores = 1;
> +    info->threads = 1;
> +    info->sockets = 1;
> +    info->nodes = 1;
> +    strcpy(info->model, "i686");
> +    info->mhz = 6000;
> +    info->cpus = 1;
> +    info->memory = 1024*1024;
> +    return 0;
> +}

  haha :-) At least worth a big TODO !

Shouldn't qemud_internal.c gets its own error reporting function like the
other _internal.c which does the right stuff, I only spotted returns of
error values, and this is linked to the client binary so this seems to be
missing, right ?

> Index: src/qemud_internal.h
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +  
> +    void qemudRegister(void);
> +
> +#ifdef __cplusplus

  ideally clean ;-)

> Index: src/virsh.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/virsh.c,v
> retrieving revision 1.41
> diff -u -p -r1.41 virsh.c
> --- src/virsh.c	22 Nov 2006 17:48:29 -0000	1.41
> +++ src/virsh.c	5 Jan 2007 21:09:08 -0000
> @@ -292,7 +292,7 @@ cmdConnect(vshControl * ctl, vshCmd * cm
>      
>      if (ctl->name)
>          free(ctl->name);
> -    ctl->name = vshCommandOptString(cmd, "name", NULL);
> +    ctl->name = vshStrdup(ctl, vshCommandOptString(cmd, "name", NULL));
>  
  I'm a bit lost on that one, was that a separate bug ? 
We switch from a static string to dynamically allocated one, right ?

>      if (!ro)
>          ctl->conn = virConnectOpen(ctl->name);
...
> Index: src/virterror.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/virterror.c,v
> retrieving revision 1.19
> diff -u -p -r1.19 virterror.c
> --- src/virterror.c	8 Nov 2006 16:55:20 -0000	1.19
> +++ src/virterror.c	5 Jan 2007 21:09:08 -0000
> @@ -268,6 +268,9 @@ virDefaultErrorFunc(virErrorPtr err)
>          case VIR_FROM_RPC:
>              dom = "XML-RPC ";
>              break;
> +        case VIR_FROM_QEMUD:
> +            dom = "QEMUD ";
> +            break;
>      }
>      if ((err->dom != NULL) && (err->code != VIR_ERR_INVALID_DOMAIN)) {
>          domain = err->dom->name;

  I guess some new error code will need to be added too once quemud_internal.c
is being updated ... Hum, how do we process errors provided by the server ?

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list