[libvirt] Storage Backend Error Handling Consistency

Richard Laager rlaager at wiktel.com
Wed Mar 2 03:07:29 UTC 2016


These two blocks exist in different storage backends' createVol
implementations:

    if (vol->target.format != VIR_STORAGE_FILE_RAW) {
        virReportError(VIR_ERR_NO_SUPPORT, "%s",
                       _("only RAW volumes are supported by this storage pool"));
        return -VIR_ERR_NO_SUPPORT;
    }

    if (vol->target.encryption != NULL) {
        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                       "%s", _("storage pool does not support encrypted "
                               "volumes"));
        return -1;
    }

My hunch is that the second example (VIR_ERR_CONFIG_UNSUPPORTED and
returning -1) is correct in both of these cases.

Related... Which backends should be restricted to only raw? That code
is from storage_backend_rbd.c, which seems to be the only one
restricted in that way. But does it make sense to allow !raw on LVM (or
ZFS), for example?

Whatever the correct answer, I'm looking to submit one or more patches.

-- 
Richard




More information about the libvir-list mailing list