[Libvir] [PATCH][RFC] libvirt ldoms support

Eunice Moon Eunice.Moon at Sun.COM
Thu Apr 10 23:34:31 UTC 2008


Hi,

The following was not included in the ldom patch, but I would
appreciate your advice.

Xen is the default hypervisor for virsh and if the user doesn't
specify in the command line option, the virsh connects to xen.
But, for the SPARC platforms, xen is not supported.  So I would
like to add the #ifdef WITH_LDOMS block in do_open()
(in src/libvirt.c) to default to ldoms if the user doesn't specify
with --connect when running virsh on the SPARC platforms.

static virConnectPtr
do_open (const char *name,
          virConnectAuthPtr auth,
          int flags)
{
     int i, res;
     virConnectPtr ret = NULL;
     xmlURIPtr uri;

#ifdef WITH_LDOMS                           =====>
     /* Convert NULL or "" to ldoms:/// */   =====>
     if (!name || name[0] == '\0')
         name = "ldoms:///";                 =====>
#else                                       =====>
     /* Convert NULL or "" to xen:/// for back compat */
     if (!name || name[0] == '\0')
         name = "xen:///";
#endif
..

Would this kind of branching in the common code be acceptable?

Thanks,
Eunice

Daniel Veillard wrote:
>   In general libvirt code should never rely on WITH_LDOMS conditional
> compilation except for:
>      - the registration of the ldom driver 
>        virInitialize() in src/libvirt.c
>      - in the ldom specific files
>      - potentially in some of the storage or xml back-end for a bit of
>        specific processing
> but really it should never affect virsh.c, or the API files.
> 




More information about the libvir-list mailing list