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

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



On Thu, Apr 10, 2008 at 06:34:31PM -0500, Eunice Moon wrote:
> 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?

This particularly area of code has changed since the LDoms code was first
written. There is now a 'probe' method in all the internal driver
APIs. If you implement the probe driver method for LDoms it will
automatically translate NULL / "" into ldoms:///  getting the effect
you desire without needing the #ifdefs

Regards,
Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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]