mirror of https://gitee.com/openkylin/libvirt.git
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=1165119 Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
58dfc53414
commit
4864e377c9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue