diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e1d9d29865..acc342e6d0 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -568,28 +568,12 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE || net->type == VIR_DOMAIN_NET_TYPE_NETWORK) { - if (priv->monConfig->type != VIR_DOMAIN_CHR_TYPE_UNIX) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("network device type '%s' cannot be attached: " - "qemu is not using a unix socket monitor"), - virDomainNetTypeToString(net->type)); - return -1; - } - if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net, qemuCaps)) < 0) return -1; if (qemuOpenVhostNet(vm->def, net, qemuCaps, &vhostfd) < 0) goto cleanup; } else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT) { - if (priv->monConfig->type != VIR_DOMAIN_CHR_TYPE_UNIX) { - qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("network device type '%s' cannot be attached: " - "qemu is not using a unix socket monitor"), - virDomainNetTypeToString(net->type)); - return -1; - } - if ((tapfd = qemuPhysIfaceConnect(vm->def, conn, driver, net, qemuCaps, VIR_VM_OP_CREATE)) < 0) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index dc0859408c..c03ae513fd 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1777,6 +1777,19 @@ int qemuMonitorSendFileHandle(qemuMonitorPtr mon, return -1; } + if (fd < 0) { + qemuReportError(VIR_ERR_INVALID_ARG, "%s", + _("fd must be valid")); + return -1; + } + + if (!mon->hasSendFD) { + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("qemu is not using a unix socket monitor, " + "cannot send fd %s"), fdname); + return -1; + } + if (mon->json) ret = qemuMonitorJSONSendFileHandle(mon, fdname, fd); else