diff --git a/qemud/remote.c b/qemud/remote.c index 1071c21ed4..78b6e3d44d 100644 --- a/qemud/remote.c +++ b/qemud/remote.c @@ -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; } diff --git a/src/libvirt.c b/src/libvirt.c index 33eafcbbe2..72221e9048 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -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; + } - 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; } @@ -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) - return conn->driver->nodeGetSecurityModel(conn, secmodel); + if (conn->driver->nodeGetSecurityModel) { + 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; }