On Wed, Mar 17, 2010 at 11:24:03AM -0400, Laine Stump wrote:
On 03/17/2010 10:49 AM, Laine Stump wrote:
>
>>>+ if (ret == -1) {
>>>+ virReportSystemError(ret,
>>>+ _("Failed to truncate volume with "
>>>+ "path '%s' to %ju bytes:
'%s'\n"),
>>>+ vol->target.path, (intmax_t)size,
>>>+ virStrerror(errno, errbuf,
>>>sizeof(errbuf)));
>+ ret = ftruncate(fd, size);
>
>Likewise, this should be:
>
> virReportSystemError(errno,
> _("Failed to truncate volume with "
> "path '%s' to %ju bytes),
> vol->target.path, (intmax_t)size);
> virStrerror(errno, errbuf, sizeof(errbuf)));
Oops - that last line is (probably obviously) an artifact of cut-paste
that I meant to delete.
>
>>>+ fd = open(def->target.path, O_RDWR);
>>>+ if (fd == -1) {
>>>+ VIR_ERROR("Failed to open storage volume with path
'%s':
>>>'%s'",
>>>+ def->target.path,
>>>+ virStrerror(errno, errbuf, sizeof(errbuf)));
>+
>
>Not sure why you're using VIR_ERROR() + manually adding virStrerror()
>- isn't this the same thing as virReportSystemError?
I had meant to mention that I've seen this in at least one other place
as well. Is there any reason for using VIR_ERROR like this, or is it
just a historical artifact?
Not often. We use VIR_ERROR in contexts we don't want to report a problem
to the user, or where their is no end user to report to. MNost of the time
using virReportSystemError is the right answer
Regards,
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|