mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-30 16:35:24 +00:00
qemuhotplugmock: Mock fd passing to qemu via 'SCM_RIGHTS'
We don't want to be dealing with real FDs thus we mock 'qemuMonitorIOWriteWithFD' to do the same thing as when no FD is being passed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
654486bd57
commit
5b5162072c
@ -288,7 +288,7 @@ qemuMonitorIOProcess(qemuMonitor *mon)
|
||||
|
||||
|
||||
/* Call this function while holding the monitor lock. */
|
||||
static int
|
||||
int
|
||||
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
||||
const char *data,
|
||||
size_t len,
|
||||
|
@ -96,3 +96,10 @@ struct _qemuMonitor {
|
||||
|
||||
void
|
||||
qemuMonitorResetCommandID(qemuMonitor *mon);
|
||||
|
||||
int
|
||||
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
||||
const char *data,
|
||||
size_t len,
|
||||
int fd)
|
||||
G_GNUC_NO_INLINE;
|
||||
|
@ -28,6 +28,9 @@
|
||||
#include "virmock.h"
|
||||
#include <fcntl.h>
|
||||
|
||||
#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
|
||||
#include "qemu/qemu_monitor_priv.h"
|
||||
|
||||
static bool (*real_virFileExists)(const char *path);
|
||||
|
||||
static void
|
||||
@ -107,3 +110,14 @@ qemuProcessPrepareHostBackendChardevHotplug(virDomainObj *vm,
|
||||
testQemuPrepareHostBackendChardevOne,
|
||||
vm);
|
||||
}
|
||||
|
||||
|
||||
/* we don't really want to send fake FDs across the monitor */
|
||||
int
|
||||
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
||||
const char *data,
|
||||
size_t len,
|
||||
int fd G_GNUC_UNUSED)
|
||||
{
|
||||
return write(mon->fd, data, len); /* sc_avoid_write */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user