mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Fix error reporting in stream creation code
virStreamNew needs to dispatch the error that virGetStream reports on failure. remoteCreateClientStream can fail due to virStreamNew or due to VIR_ALLOC. Report OOM error for VIR_ALLOC failure to report errors in all error cases. Remove OOM error reporting from remoteCreateClientStream callers.
This commit is contained in:
parent
55cb8f5baa
commit
5b77f1d5dc
@ -1191,10 +1191,8 @@ remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server ATTRIBUTE_U
|
|||||||
|
|
||||||
dname = args->dname == NULL ? NULL : *args->dname;
|
dname = args->dname == NULL ? NULL : *args->dname;
|
||||||
|
|
||||||
if (!(stream = remoteCreateClientStream(conn, hdr))) {
|
if (!(stream = remoteCreateClientStream(conn, hdr)))
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainMigratePrepareTunnel(conn, stream->st,
|
if (virDomainMigratePrepareTunnel(conn, stream->st,
|
||||||
args->flags, dname, args->resource,
|
args->flags, dname, args->resource,
|
||||||
@ -3054,10 +3052,8 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||||||
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
if (!(dom = get_nonnull_domain(conn, args->dom)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(stream = remoteCreateClientStream(conn, hdr))) {
|
if (!(stream = remoteCreateClientStream(conn, hdr)))
|
||||||
virReportOOMError();
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainOpenConsole(dom,
|
if (virDomainOpenConsole(dom,
|
||||||
args->devname ? *args->devname : NULL,
|
args->devname ? *args->devname : NULL,
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
#include "virterror_internal.h"
|
||||||
|
|
||||||
|
#define VIR_FROM_THIS VIR_FROM_STREAMS
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteStreamHandleWrite(struct qemud_client *client,
|
remoteStreamHandleWrite(struct qemud_client *client,
|
||||||
@ -209,8 +212,10 @@ remoteCreateClientStream(virConnectPtr conn,
|
|||||||
|
|
||||||
VIR_DEBUG("proc=%d serial=%d", hdr->proc, hdr->serial);
|
VIR_DEBUG("proc=%d serial=%d", hdr->proc, hdr->serial);
|
||||||
|
|
||||||
if (VIR_ALLOC(stream) < 0)
|
if (VIR_ALLOC(stream) < 0) {
|
||||||
|
virReportOOMError();
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
stream->procedure = hdr->proc;
|
stream->procedure = hdr->proc;
|
||||||
stream->serial = hdr->serial;
|
stream->serial = hdr->serial;
|
||||||
|
@ -11654,6 +11654,8 @@ virStreamNew(virConnectPtr conn,
|
|||||||
st = virGetStream(conn);
|
st = virGetStream(conn);
|
||||||
if (st)
|
if (st)
|
||||||
st->flags = flags;
|
st->flags = flags;
|
||||||
|
else
|
||||||
|
virDispatchError(conn);
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user