mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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
This commit is contained in:
parent
a90629aa13
commit
845659340e
@ -1411,7 +1411,7 @@ remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSE
|
|||||||
memset(&seclabel, 0, sizeof seclabel);
|
memset(&seclabel, 0, sizeof seclabel);
|
||||||
if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
|
if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
remoteDispatchFormatError(rerr, "%s", _("unable to get security label"));
|
remoteDispatchConnError(rerr, conn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1440,7 +1440,7 @@ remoteDispatchNodeGetSecurityModel(struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
memset(&secmodel, 0, sizeof secmodel);
|
memset(&secmodel, 0, sizeof secmodel);
|
||||||
if (virNodeGetSecurityModel(conn, &secmodel) == -1) {
|
if (virNodeGetSecurityModel(conn, &secmodel) == -1) {
|
||||||
remoteDispatchFormatError(rerr, "%s", _("unable to get security model"));
|
remoteDispatchConnError(rerr, conn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4399,15 +4399,24 @@ virDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel)
|
|||||||
|
|
||||||
if (seclabel == NULL) {
|
if (seclabel == NULL) {
|
||||||
virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||||
return -1;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = domain->conn;
|
conn = domain->conn;
|
||||||
|
|
||||||
if (conn->driver->domainGetSecurityLabel)
|
if (conn->driver->domainGetSecurityLabel) {
|
||||||
return conn->driver->domainGetSecurityLabel(domain, seclabel);
|
int ret;
|
||||||
|
ret = conn->driver->domainGetSecurityLabel(domain, seclabel);
|
||||||
|
if (ret < 0)
|
||||||
|
goto error;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||||
|
|
||||||
|
error:
|
||||||
|
/* Copy to connection error object for back compatability */
|
||||||
|
virSetConnError(domain->conn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4432,13 +4441,22 @@ virNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)
|
|||||||
|
|
||||||
if (secmodel == NULL) {
|
if (secmodel == NULL) {
|
||||||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||||
return -1;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->driver->nodeGetSecurityModel)
|
if (conn->driver->nodeGetSecurityModel) {
|
||||||
return conn->driver->nodeGetSecurityModel(conn, secmodel);
|
int ret;
|
||||||
|
ret = conn->driver->nodeGetSecurityModel(conn, secmodel);
|
||||||
|
if (ret < 0)
|
||||||
|
goto error;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||||
|
|
||||||
|
error:
|
||||||
|
/* Copy to connection error object for back compatability */
|
||||||
|
virSetConnError(conn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user