[libvirt] [PATCH] storage: rbd: Improve the error when start a pool based on non-exist rados object

Shanzhi Yu shyu at redhat.com
Fri Feb 6 11:45:37 UTC 2015


When start/create a pool based on non-exist rados object, the error will be like
$virsh pool-start p-c
error: Failed to start pool p-c
error: failed to create the RBD IoCTX. Does the pool 'libvirt-pool-clone' exist?: No such file or directory

update it to

error: Failed to start pool p-c
error: internal error: failed to create the RBD IoCTX. the rados pool 'libvirt-pool-clone' is not available
Signed-off-by: Shanzhi Yu <shyu at redhat.com>
---
 src/storage/storage_backend_rbd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 57182de..98e7fe7 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -236,8 +236,10 @@ static int virStorageBackendRBDOpenIoCTX(virStorageBackendRBDStatePtr ptr, virSt
 {
     int r = rados_ioctx_create(ptr->cluster, pool->def->source.name, &ptr->ioctx);
     if (r < 0) {
-        virReportSystemError(-r, _("failed to create the RBD IoCTX. Does the pool '%s' exist?"),
-                             pool->def->source.name);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+			_("failed to create the RBD IoCTX. "
+			"the rados pool '%s' is not available"),
+			pool->def->source.name);
     }
     return r;
 }
-- 
2.1.0




More information about the libvir-list mailing list