mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
libvirt-qemu: Dispatch errors from virDomainQemuAgentCommand()
The original implementation didn't follow the established pattern and did not dispatch errors in case of failure.
This commit is contained in:
parent
6e5b36d5d2
commit
0eb2f8aa90
@ -211,6 +211,7 @@ virDomainQemuAgentCommand(virDomainPtr domain,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
char *ret;
|
||||
|
||||
VIR_DEBUG("domain=%p, cmd=%s, timeout=%d, flags=%x",
|
||||
domain, cmd, timeout, flags);
|
||||
@ -220,21 +221,26 @@ virDomainQemuAgentCommand(virDomainPtr domain,
|
||||
virDispatchError(NULL);
|
||||
return NULL;
|
||||
}
|
||||
if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||
virLibDomainError(NULL, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->flags & VIR_CONNECT_RO) {
|
||||
virLibDomainError(NULL, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn->driver->domainQemuAgentCommand) {
|
||||
return conn->driver->domainQemuAgentCommand(domain, cmd,
|
||||
timeout, flags);
|
||||
ret = conn->driver->domainQemuAgentCommand(domain, cmd,
|
||||
timeout, flags);
|
||||
if (!ret)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
/* Copy to connection error object for back compatibility */
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user