提交 4864e377 编写于 作者: J Jiri Denemark

sanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails

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=1165119Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 58dfc534
......@@ -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",
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册