]> git.ipfire.org Git - thirdparty/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)
committerCole Robinson <crobinso@redhat.com>
Tue, 28 Apr 2015 15:18:22 +0000 (11:18 -0400)
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>
(cherry picked from commit 4864e377c9a6ef08cd65672775e520751a27f6d7)

src/locking/lock_driver_sanlock.c
src/util/virerror.c

index 60f305c43bbba94834f430aa6365f884d50b99a1..e58abfef96ff693fefedb26cacecb667540c4be8 100644 (file)
@@ -972,7 +972,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 9635c8212fdf60cd24556a8f87890c73e8913202..e35f2f0f6a50904096fe062fec2a3ccfa654df1b 100644 (file)
@@ -1325,7 +1325,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)