]> xenbits.xensource.com Git - libvirt.git/commitdiff
sanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails
authorJiri Denemark <jdenemar@redhat.com>
Tue, 14 Apr 2015 14:27:37 +0000 (16:27 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 15 Apr 2015 07:40:42 +0000 (09:40 +0200)
When acquiring resource via sanlock fails, we would report it as
VIR_ERR_INTERNAL_ERROR, which is not very friendly to applications using
libvirt. Moreover, the lockd driver would report the same failure as
VIR_ERR_RESOURCE_BUSY, which looks better.

Unfortunately, in sanlock driver we don't really know if acquiring the
resource failed because it was already locked or there was another
reason behind. But the end result is the same and I think using
VIR_ERR_RESOURCE_BUSY reason for all acquire failures is still better
than what we have now.

https://bugzilla.redhat.com/show_bug.cgi?id=1165119
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/locking/lock_driver_sanlock.c
src/util/virerror.c

index dbe79bcb66839b412ea73cef5d1b77bb51cf0e79..e052875e2569d4ddac68e5c094c45341147af14d 100644 (file)
@@ -975,7 +975,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock,
                                   priv->res_count, priv->res_args,
                                   opt)) < 0) {
             if (rv <= -200)
-                virReportError(VIR_ERR_INTERNAL_ERROR,
+                virReportError(VIR_ERR_RESOURCE_BUSY,
                                _("Failed to acquire lock: error %d"), rv);
             else
                 virReportSystemError(-rv, "%s",
index c4e84e73cd4cf6d6aa34ee2b0963c23e6be4434e..91c8686399001374792329a2d4fbf052f063eef3 100644 (file)
@@ -1326,7 +1326,7 @@ virErrorMsg(virErrorNumber error, const char *info)
             if (info == NULL)
                 errmsg = _("resource busy");
             else
-                errmsg = _("resource busy %s");
+                errmsg = _("resource busy: %s");
             break;
         case VIR_ERR_ACCESS_DENIED:
             if (info == NULL)