Hi Daniel,
That'd be great. I will use that 'probe' method. Is it included
in the latest libvirt 0.4.2 release?
Thanks,
Eunice
Daniel P. Berrange wrote:
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.