On Fri, Jan 13, 2017 at 07:59:08 -0500, John Ferlan wrote: > If neither BLKID or PARTED is available and we're not writing, then > just return 0 which allows the underlying storage pool to generate > a failur. If both are unavailable and we're writing, then generate failure > a more generic error message. > > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > src/storage/storage_backend.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c > index 18433e9..6bdfbf1 100644 > --- a/src/storage/storage_backend.c > +++ b/src/storage/storage_backend.c > @@ -2842,9 +2842,6 @@ virStorageBackendBLKIDFindEmpty(const char *device ATTRIBUTE_UNUSED, > const char *format ATTRIBUTE_UNUSED, > bool writelabel ATTRIBUTE_UNUSED) > { > - virReportError(VIR_ERR_OPERATION_INVALID, "%s", > - _("probing for filesystems is unsupported " > - "by this build")); > return -2; > } > > @@ -2868,11 +2865,10 @@ virStorageBackendPARTEDValidLabel(const char *device ATTRIBUTE_UNUSED, > const char *format ATTRIBUTE_UNUSED, > bool writelabel ATTRIBUTE_UNUSED) > { > - virReportError(VIR_ERR_OPERATION_INVALID, "%s", > - _("PARTED is unsupported by this build")); > - return -1; > + return -2; > } > > + > #endif /* #if WITH_STORAGE_DISK */ > > > @@ -2898,5 +2894,17 @@ virStorageBackendDeviceIsEmpty(const char *devpath, > writelabel)) == -2) > ret = virStorageBackendPARTEDValidLabel(devpath, format, writelabel); > > + /* Neither BLKID nor PARTED available, but we're not writing, > + * so no mechanism to check, so allow a lower layer to reject. */ I think you removed too many words here when compared to the commit message so it stopped making sense. > + if (ret == -2 && !writelabel) > + return 0; > + > + if (ret == -2) { > + virReportError(VIR_ERR_OPERATION_INVALID, > + _("Unable to probe '%s' for existing data, " > + "requires create/build using overwrite"), I'd state "forced overwrite is necessary" or something along that points to the flag even for direct API users. ACK
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list