[libvirt] [PATCH 08/13] Replace use of virStorageReportError with virReportError

Daniel P. Berrange berrange at redhat.com
Wed Jul 18 18:38:31 UTC 2012


On Wed, Jul 18, 2012 at 12:05:20PM -0600, Eric Blake wrote:
> On 07/18/2012 05:52 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > Update the storage driver to use virReportError instead of
> > the virStorageReportError custom macro
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> 
> Still big, but not as big as 7/13.  Again, mostly mechanical, and I
> didn't spot any blatant problems.
> 
> ACK.
> 
> > +++ b/src/storage/storage_backend_rbd.c
> > @@ -145,8 +145,8 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
> >                                pool->def->source.hosts[i].name,
> >                                pool->def->source.hosts[i].port);
> >          } else {
> > -            virStorageReportError(VIR_ERR_INTERNAL_ERROR,
> > -                                  _("received malformed monitor, check the XML definition"));
> > +            virReportError(VIR_ERR_INTERNAL_ERROR,
> > +                           _("received malformed monitor, check the XML definition"));
> 
> Another case of missing "%s", worth a separate cleanup patch.  [hmm,
> wonder how hard it would be to make cfg.mk detect a message without a
> '%' as part of syntax-check, rather than the current approach of
> building with NLS disabled to trigger a gcc warning]

I've pushed a fix for this bug /before/ applying this change.


> > +++ b/src/storage/storage_driver.c
> > @@ -475,7 +475,7 @@ static int storagePoolIsActive(virStoragePoolPtr pool)
> >      obj = virStoragePoolObjFindByUUID(&driver->pools, pool->uuid);
> >      storageDriverUnlock(driver);
> >      if (!obj) {
> > -        virStorageReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
> > +        virReportError(VIR_ERR_NO_STORAGE_POOL, NULL);
> 
> While this still gives a working error message, it's pretty weak, and
> I've noticed that at least on FreeBSD, the gcc version tends to issue
> warnings about a NULL format string.

Yeah, there are quite a few areas of the code which pass a NULL
error string that I've seen. Another thing to put on the TODO
list....



Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list