[libvirt] [PATCH] Improve error reporting for virConnectGetHostname calls
Daniel P. Berrange
berrange at redhat.com
Wed Oct 28 14:44:05 UTC 2009
On Wed, Oct 28, 2009 at 03:32:32PM +0100, Chris Lalancette wrote:
> Cole Robinson wrote:
>
> >
> > static int umlListDomains(virConnectPtr conn, int *ids, int nids) {
> > diff --git a/src/util/util.c b/src/util/util.c
> > index 98f8a14..49eac6d 100644
> > --- a/src/util/util.c
> > +++ b/src/util/util.c
> > @@ -1804,30 +1804,42 @@ int virDiskNameToIndex(const char *name) {
> > #define AI_CANONIDN 0
> > #endif
> >
> > -char *virGetHostname(void)
> > +char *virGetHostname(virConnectPtr conn)
>
> To be honest, I'm not sure we even need to add the "conn" parameter here. I
> seem to remember DanB saying that it was only needed in very few circumstances
> anymore. Can't we just call "virReportSystemError(NULL)", etc? That keeps this
> function signature a bit simpler. (It's not a deal-breaker in any case, just
> nice to not have to require this parameter)
That's correct, we should avoid adding virConnectPtr to any new /existing
internal APIs where-ever possible. The only real exception is if the
internal function needs to invoke one of the other public driver APis
directly.
Daniel
--
|: Red Hat, Engineering, London -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 :|
More information about the libvir-list
mailing list