提交 84565934 编写于 作者: D Daniel P. Berrange

Fix error reporting for security driver over remote protocol

* qemud/remote.c: Send back the actual libvirt connection error
  rather than formatting a generic error for security driver
  methods
* src/libvirt.c: Fix virDomainGetSecurityLabel, and
  virNodeGetSecurityModel to correctly set the error on
  the virConnectPtr object, and raise a full error rather
  than warning when not supported
上级 a90629aa
......@@ -1411,7 +1411,7 @@ remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSE
memset(&seclabel, 0, sizeof seclabel);
if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
virDomainFree(dom);
remoteDispatchFormatError(rerr, "%s", _("unable to get security label"));
remoteDispatchConnError(rerr, conn);
return -1;
}
......@@ -1440,7 +1440,7 @@ remoteDispatchNodeGetSecurityModel(struct qemud_server *server ATTRIBUTE_UNUSED,
memset(&secmodel, 0, sizeof secmodel);
if (virNodeGetSecurityModel(conn, &secmodel) == -1) {
remoteDispatchFormatError(rerr, "%s", _("unable to get security model"));
remoteDispatchConnError(rerr, conn);
return -1;
}
......
......@@ -4399,15 +4399,24 @@ virDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel)
if (seclabel == NULL) {
virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
goto error;
}
conn = domain->conn;
if (conn->driver->domainGetSecurityLabel)
return conn->driver->domainGetSecurityLabel(domain, seclabel);
if (conn->driver->domainGetSecurityLabel) {
int ret;
ret = conn->driver->domainGetSecurityLabel(domain, seclabel);
if (ret < 0)
goto error;
return ret;
}
virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
error:
/* Copy to connection error object for back compatability */
virSetConnError(domain->conn);
return -1;
}
......@@ -4432,13 +4441,22 @@ virNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)
if (secmodel == NULL) {
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
goto error;
}
if (conn->driver->nodeGetSecurityModel) {
int ret;
ret = conn->driver->nodeGetSecurityModel(conn, secmodel);
if (ret < 0)
goto error;
return ret;
}
if (conn->driver->nodeGetSecurityModel)
return conn->driver->nodeGetSecurityModel(conn, secmodel);
virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
error:
/* Copy to connection error object for back compatability */
virSetConnError(conn);
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册