Re: [PATCH 6/8] storage: Cleanup improper VIR_ERR_NO_SUPPORT use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



于 2011年08月25日 05:42, Daniel P. Berrange 写道:
On Tue, Aug 23, 2011 at 05:39:43PM +0800, Osier Yang wrote:
---
  src/storage/storage_backend.c         |   12 ++++++------
  src/storage/storage_backend_disk.c    |    2 +-
  src/storage/storage_backend_fs.c      |    2 +-
  src/storage/storage_backend_logical.c |    2 +-
  4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 889f530..72b37a1 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_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                                "%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_NO_SUPPORT, "%s",

Per your previous explanation, this is changed back to NO_SUPPORT.

+        virStorageReportError(VIR_ERR_OPERATION_INVALID, "%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_NO_SUPPORT,
+            virStorageReportError(VIR_ERR_OPERATION_INVALID,
                                    _("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_NO_SUPPORT,
+            virStorageReportError(VIR_ERR_OPERATION_INVALID,
                                    _("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_NO_SUPPORT, "%s",
+        virStorageReportError(VIR_ERR_OPERATION_INVALID, "%s",
                                _("copy-on-write image not supported with "
                                        "qcow-create"));
          return -1;
      }
      if (vol->target.encryption != NULL) {
-        virStorageReportError(VIR_ERR_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                                "%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 82b41ef..0eb34b9 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_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                                "%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 ff5afaa..4f53d3f 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_NO_SUPPORT,
+            virStorageReportError(VIR_ERR_OPERATION_INVALID,
                                    "%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 ca4166d..a35b360 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_NO_SUPPORT,
+        virStorageReportError(VIR_ERR_OPERATION_INVALID,
                                "%s", _("storage pool does not support encrypted "
                                        "volumes"));
          return -1;
All these are incorrect. They should be VIR_ERR_CONFIG_UNSUPPORTED.

Except the one looks for secret API, agree with others should be CONFIG_UNSUPPORTED.



Daniel

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]