From: Osier Yang Date: Thu, 1 Sep 2011 07:24:59 +0000 (+0800) Subject: storage: Fix incorrect error codes X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ffafede112a49982c26d00a04ef1f82bbf41d9c8;p=libvirt.git storage: Fix incorrect error codes Commit 0376f4a69b intended to fix incorrect use of VIR_ERR_NO_SUPPORT, but replacing it with VIR_ERR_OPERATION_INVALID is not proper either. --- diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 72b37a1ba3..d125504b44 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -387,7 +387,7 @@ virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED, virCheckFlags(0, -1); if (vol->target.encryption != NULL) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("storage pool does not support encrypted " "volumes")); goto cleanup; @@ -461,7 +461,7 @@ virStorageGenerateQcowEncryption(virConnectPtr conn, conn->secretDriver->lookupByUUID == NULL || conn->secretDriver->defineXML == NULL || conn->secretDriver->setValue == NULL) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, "%s", + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("secret storage not supported")); goto cleanup; } @@ -740,7 +740,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, if (vol->target.format != VIR_STORAGE_FILE_QCOW && vol->target.format != VIR_STORAGE_FILE_QCOW2) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("qcow volume encryption unsupported with " "volume format %s"), type); return -1; @@ -748,7 +748,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, enc = vol->target.encryption; if (enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_QCOW && enc->format != VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported volume encryption format %d"), vol->target.encryption->format); return -1; @@ -880,13 +880,13 @@ virStorageBackendCreateQcowCreate(virConnectPtr conn ATTRIBUTE_UNUSED, return -1; } if (vol->backingStore.path != NULL) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, "%s", + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("copy-on-write image not supported with " "qcow-create")); return -1; } if (vol->target.encryption != NULL) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("encrypted volumes not supported with " "qcow-create")); return -1; diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 0eb34b9ca6..c08a10b215 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -574,7 +574,7 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED, }; if (vol->target.encryption != NULL) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("storage pool does not support encrypted " "volumes")); return -1; diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 4f53d3fcf8..61d86d207b 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -866,7 +866,7 @@ _virStorageBackendFileSystemVolBuild(virConnectPtr conn, if (inputvol) { if (vol->target.encryption != NULL) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("storage pool does not support " "building encrypted volumes from " "other volumes")); diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index a35b360251..4f42047cb3 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -584,7 +584,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn, const char **cmdargv = cmdargvnew; if (vol->target.encryption != NULL) { - virStorageReportError(VIR_ERR_OPERATION_INVALID, + virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("storage pool does not support encrypted " "volumes")); return -1;