1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

remote_driver: Implement virStreamInData() callback

When using the monolithic daemon the driver for virStream is
always virFDStreamDrv and thus calling virStreamInData() results
in calling virFDStreamInData().

But things are different with split daemon, especially when a
client connects to one of hypervisor daemons (e.g. virtqemud) and
then lets the daemon connect to the storage daemon for
vol-upload/vol-download. Here, the hypervisor daemon acts like
both client and server. This is reflected by stream->driver
pointing to remoteStreamDrv, which doesn't have streamInData
callback implemented and thus vol-upload/vol-download with sparse
flag fails.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2026537
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Michal Privoznik 2021-12-06 17:16:09 +01:00
parent 2981d1c95e
commit c1b06f5cf0

View File

@ -5599,6 +5599,31 @@ remoteStreamRecvHole(virStreamPtr st,
}
static int
remoteStreamInData(virStreamPtr st,
int *data,
long long *length)
{
struct private_data *priv = st->conn->privateData;
virNetClientStream *privst = st->privateData;
int rv;
VIR_DEBUG("st=%p data=%p length=%p",
st, data, length);
remoteDriverLock(priv);
priv->localUses++;
remoteDriverUnlock(priv);
rv = virNetClientStreamInData(privst, data, length);
remoteDriverLock(priv);
priv->localUses--;
remoteDriverUnlock(priv);
return rv;
}
struct remoteStreamCallbackData {
virStreamPtr st;
virStreamEventCallback cb;
@ -5745,6 +5770,7 @@ static virStreamDriver remoteStreamDrv = {
.streamSend = remoteStreamSend,
.streamSendHole = remoteStreamSendHole,
.streamRecvHole = remoteStreamRecvHole,
.streamInData = remoteStreamInData,
.streamFinish = remoteStreamFinish,
.streamAbort = remoteStreamAbort,
.streamEventAddCallback = remoteStreamEventAddCallback,