[libvirt] [PATCH] remote: delete the avahi mDNS support
by Daniel P. Berrangé
Libvirtd has long had integration with avahi for advertising libvirtd
using mDNS when TCP/TLS listening is enabled. For a long time the
virt-manager application had support for auto-detecting libvirtds
on the local network using mDNS, but this was removed last year
commit fc8f8d5d7e3ba80a0771df19cf20e84a05ed2422
Author: Cole Robinson <crobinso(a)redhat.com>
Date: Sat Oct 6 20:55:31 2018 -0400
connect: Drop avahi support
Libvirtd can advertise itself over avahi. The feature is disabled by
default though and in practice I hear of no one actually using it
and frankly I don't think it's all that useful
The 'Open Connection' wizard has a disproportionate amount of code
devoted to this feature, but I don't think it's useful or worth
maintaining, so let's drop it
I've never heard of any other applications having support for using
mDNS to detect libvirtd instances. Though it is theoretically possible
something exists out there, it is clearly going to be a niche use case
in the virt ecosystem as a whole.
By removing avahi integration we can cut down the dependancy chain for
the basic libvirtd install and reduce our code maint burden.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
cfg.mk | 3 -
configure.ac | 3 -
docs/internals/rpc.html.in | 7 -
docs/remote.html.in | 17 -
docs/windows.html.in | 1 -
libvirt.spec.in | 3 -
m4/virt-avahi.m4 | 30 -
mingw-libvirt.spec.in | 1 -
po/POTFILES | 1 -
src/libvirt_remote.syms | 13 -
src/locking/lock_daemon.c | 6 +-
src/logging/log_daemon.c | 6 +-
src/lxc/lxc_controller.c | 3 +-
src/remote/libvirtd.aug | 2 -
src/remote/libvirtd.conf | 17 -
src/remote/remote_daemon.c | 18 +-
src/remote/remote_daemon_config.c | 29 -
src/remote/remote_daemon_config.h | 3 -
src/remote/test_libvirtd.aug.in | 2 -
src/rpc/Makefile.inc.am | 4 -
src/rpc/virnetdaemon.c | 14 -
src/rpc/virnetserver.c | 64 +-
src/rpc/virnetserver.h | 6 +-
src/rpc/virnetservermdns.c | 682 ------------------
src/rpc/virnetservermdns.h | 107 ---
tests/virconfdata/libvirtd.conf | 17 -
tests/virconfdata/libvirtd.out | 14 -
...dmin-nomdns.json => input-data-admin.json} | 0
.../input-data-initial-nomdns.json | 63 --
.../virnetdaemondata/input-data-initial.json | 1 -
...min-nomdns.json => output-data-admin.json} | 0
.../output-data-initial-nomdns.json | 72 --
.../virnetdaemondata/output-data-initial.json | 1 -
tests/virnetdaemontest.c | 17 +-
34 files changed, 16 insertions(+), 1211 deletions(-)
delete mode 100644 m4/virt-avahi.m4
delete mode 100644 src/rpc/virnetservermdns.c
delete mode 100644 src/rpc/virnetservermdns.h
rename tests/virnetdaemondata/{input-data-admin-nomdns.json => input-data-admin.json} (100%)
delete mode 100644 tests/virnetdaemondata/input-data-initial-nomdns.json
rename tests/virnetdaemondata/{output-data-admin-nomdns.json => output-data-admin.json} (100%)
delete mode 100644 tests/virnetdaemondata/output-data-initial-nomdns.json
diff --git a/cfg.mk b/cfg.mk
index c0c240b2c0..9465838175 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -146,9 +146,6 @@ useless_free_options = \
--name=virJSONValueFree \
--name=virLastErrFreeData \
--name=virNetMessageFree \
- --name=virNetServerMDNSFree \
- --name=virNetServerMDNSEntryFree \
- --name=virNetServerMDNSGroupFree \
--name=virNWFilterDefFree \
--name=virNWFilterEntryFree \
--name=virNWFilterHashTableFree \
diff --git a/configure.ac b/configure.ac
index 1f05055d6f..3489a5725e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -245,7 +245,6 @@ LIBVIRT_LINKER_NO_UNDEFINED
LIBVIRT_ARG_APPARMOR
LIBVIRT_ARG_ATTR
LIBVIRT_ARG_AUDIT
-LIBVIRT_ARG_AVAHI
LIBVIRT_ARG_BASH_COMPLETION
LIBVIRT_ARG_BLKID
LIBVIRT_ARG_CAPNG
@@ -284,7 +283,6 @@ LIBVIRT_CHECK_APPARMOR
LIBVIRT_CHECK_ATOMIC
LIBVIRT_CHECK_ATTR
LIBVIRT_CHECK_AUDIT
-LIBVIRT_CHECK_AVAHI
LIBVIRT_CHECK_BASH_COMPLETION
LIBVIRT_CHECK_BLKID
LIBVIRT_CHECK_CAPNG
@@ -970,7 +968,6 @@ LIBVIRT_RESULT_ACL
LIBVIRT_RESULT_APPARMOR
LIBVIRT_RESULT_ATTR
LIBVIRT_RESULT_AUDIT
-LIBVIRT_RESULT_AVAHI
LIBVIRT_RESULT_BASH_COMPLETION
LIBVIRT_RESULT_BLKID
LIBVIRT_RESULT_CAPNG
diff --git a/docs/internals/rpc.html.in b/docs/internals/rpc.html.in
index 048192f818..40d844f31c 100644
--- a/docs/internals/rpc.html.in
+++ b/docs/internals/rpc.html.in
@@ -539,13 +539,6 @@ C <-- |32| 8 | 1 | 3 | 1 | 1 | 0 | .o.oOo | <-- S (reply)
be part of the underlying server.
</dd>
- <dt><code>virNetServerMDNSPtr</code> (virnetservermdns.h)</dt>
- <dd>The virNetServerMDNS APIs are used to advertise a server
- across the local network, enabling clients to automatically
- detect the existence of remote services. This is done by
- interfacing with the Avahi mDNS advertisement service.
- </dd>
-
<dt><code>virNetServerClientPtr</code> (virnetserverclient.h)</dt>
<dd>The virNetServerClient APIs are used to manage I/O related
to a single client network connection. It handles initial
diff --git a/docs/remote.html.in b/docs/remote.html.in
index de09975039..fbcc8bf01c 100644
--- a/docs/remote.html.in
+++ b/docs/remote.html.in
@@ -821,23 +821,6 @@ Blank lines and comments beginning with <code>#</code> are ignored.
<td> "16509" </td>
<td>
The port number or service name to listen on for unencrypted TCP connections.
-</td>
- </tr>
- <tr>
- <td> mdns_adv <i>[0|1]</i> </td>
- <td> 0 (advertise with mDNS) </td>
- <td>
- If set to 1 then the virtualization service will be advertised over
- mDNS to hosts on the local LAN segment.
-</td>
- </tr>
- <tr>
- <td> mdns_name <i>"name"</i> </td>
- <td> "Virtualization Host HOSTNAME" </td>
- <td>
- The name to advertise for this host with Avahi mDNS. The default
- includes the machine's short hostname. This must be unique to the
- local LAN segment.
</td>
</tr>
<tr>
diff --git a/docs/windows.html.in b/docs/windows.html.in
index 57abf8fde5..096d118bf7 100644
--- a/docs/windows.html.in
+++ b/docs/windows.html.in
@@ -182,7 +182,6 @@
<pre>
./configure \
--without-sasl \
- --without-avahi \
--without-polkit \
--without-python \
--without-libxl \
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 3b5b4925fd..d54f58f1d4 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -297,7 +297,6 @@ BuildRequires: sanlock-devel >= 2.4
%endif
BuildRequires: libpcap-devel
BuildRequires: libnl3-devel
-BuildRequires: avahi-devel
BuildRequires: libselinux-devel
BuildRequires: dnsmasq >= 2.41
BuildRequires: iptables
@@ -436,7 +435,6 @@ Requires: iproute
Requires: iproute-tc
%endif
-Requires: avahi-libs
Requires: polkit >= 0.112
%ifarch %{ix86} x86_64 ia64
# For virConnectGetSysinfo
@@ -1163,7 +1161,6 @@ rm -f po/stamp-po
%{?arg_vbox} \
%{?arg_libxl} \
--with-sasl \
- --with-avahi \
--with-polkit \
--with-libvirtd \
%{?arg_phyp} \
diff --git a/m4/virt-avahi.m4 b/m4/virt-avahi.m4
deleted file mode 100644
index d4b3fc6131..0000000000
--- a/m4/virt-avahi.m4
+++ /dev/null
@@ -1,30 +0,0 @@
-dnl The libavahi.so library
-dnl
-dnl Copyright (C) 2012-2013 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library. If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_ARG_AVAHI],[
- LIBVIRT_ARG_WITH_FEATURE([AVAHI], [avahi-client], [check], [0.6.0])
-])
-
-AC_DEFUN([LIBVIRT_CHECK_AVAHI],[
- LIBVIRT_CHECK_PKG([AVAHI], [avahi-client], [0.6.0])
-])
-
-AC_DEFUN([LIBVIRT_RESULT_AVAHI],[
- LIBVIRT_RESULT_LIB([AVAHI])
-])
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index 9add033669..280db4d1aa 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -167,7 +167,6 @@ autoreconf -if
--without-vbox \
%{?_without_xenapi} \
--without-sasl \
- --without-avahi \
--without-polkit \
--without-libvirtd \
%{?_without_phyp} \
diff --git a/po/POTFILES b/po/POTFILES
index 9dd4ee7d99..a5614ac88d 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -161,7 +161,6 @@ src/rpc/virnetmessage.c
src/rpc/virnetsaslcontext.c
src/rpc/virnetserver.c
src/rpc/virnetserverclient.c
-src/rpc/virnetservermdns.c
src/rpc/virnetserverprogram.c
src/rpc/virnetserverservice.c
src/rpc/virnetsocket.c
diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 3d68f6ce0a..eb7651a957 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -182,19 +182,6 @@ virNetServerClientStartKeepAlive;
virNetServerClientWantCloseLocked;
-# rpc/virnetservermdns.h
-virNetServerMDNSAddEntry;
-virNetServerMDNSAddGroup;
-virNetServerMDNSEntryFree;
-virNetServerMDNSFree;
-virNetServerMDNSGroupFree;
-virNetServerMDNSNew;
-virNetServerMDNSRemoveEntry;
-virNetServerMDNSRemoveGroup;
-virNetServerMDNSStart;
-virNetServerMDNSStop;
-
-
# rpc/virnetserverprogram.h
virNetServerProgramDispatch;
virNetServerProgramGetID;
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index d714ddd2dd..bc2fb4a7fb 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -167,7 +167,6 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
if (!(srv = virNetServerNew("virtlockd", 1,
0, 0, 0, config->max_clients,
config->max_clients, -1, 0,
- NULL,
virLockDaemonClientNew,
virLockDaemonClientPreExecRestart,
virLockDaemonClientFree,
@@ -182,7 +181,6 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
if (!(srv = virNetServerNew("admin", 1,
0, 0, 0, config->admin_max_clients,
config->admin_max_clients, -1, 0,
- NULL,
remoteAdmClientNew,
remoteAdmClientPreExecRestart,
remoteAdmClientFree,
@@ -623,7 +621,7 @@ virLockDaemonSetupNetworkingSystemD(virNetServerPtr lockSrv, virNetServerPtr adm
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
@@ -644,7 +642,7 @@ virLockDaemonSetupNetworkingNative(virNetServerPtr srv, const char *sock_path)
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 3469d87caa..014596b280 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -162,7 +162,6 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged)
if (!(srv = virNetServerNew("virtlogd", 1,
0, 0, 0, config->max_clients,
config->max_clients, -1, 0,
- NULL,
virLogDaemonClientNew,
virLogDaemonClientPreExecRestart,
virLogDaemonClientFree,
@@ -177,7 +176,6 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged)
if (!(srv = virNetServerNew("admin", 1,
0, 0, 0, config->admin_max_clients,
config->admin_max_clients, -1, 0,
- NULL,
remoteAdmClientNew,
remoteAdmClientPreExecRestart,
remoteAdmClientFree,
@@ -558,7 +556,7 @@ virLogDaemonSetupNetworkingSystemD(virNetServerPtr logSrv, virNetServerPtr admin
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
@@ -579,7 +577,7 @@ virLogDaemonSetupNetworkingNative(virNetServerPtr srv, const char *sock_path)
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index cd842f2980..c677eb8f6d 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -953,7 +953,6 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
if (!(srv = virNetServerNew("LXC", 1,
0, 0, 0, 1,
0, -1, 0,
- NULL,
virLXCControllerClientPrivateNew,
NULL,
virLXCControllerClientPrivateFree,
@@ -976,7 +975,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
if (virSecurityManagerClearSocketLabel(ctrl->securityManager, ctrl->def) < 0)
goto error;
- if (virNetServerAddService(srv, svc, NULL) < 0)
+ if (virNetServerAddService(srv, svc) < 0)
goto error;
virObjectUnref(svc);
svc = NULL;
diff --git a/src/remote/libvirtd.aug b/src/remote/libvirtd.aug
index 13333448a4..0188c23dd7 100644
--- a/src/remote/libvirtd.aug
+++ b/src/remote/libvirtd.aug
@@ -29,8 +29,6 @@ module Libvirtd =
| str_entry "tls_port"
| str_entry "tcp_port"
| str_entry "listen_addr"
- | bool_entry "mdns_adv"
- | str_entry "mdns_name"
let sock_acl_entry = str_entry "unix_sock_group"
| str_entry "unix_sock_ro_perms"
diff --git a/src/remote/libvirtd.conf b/src/remote/libvirtd.conf
index 233c127156..bbeb053495 100644
--- a/src/remote/libvirtd.conf
+++ b/src/remote/libvirtd.conf
@@ -50,23 +50,6 @@
#listen_addr = "192.168.0.1"
-# Flag toggling mDNS advertizement of the libvirt service.
-#
-# Alternatively can disable for all services on a host by
-# stopping the Avahi daemon
-#
-# This is disabled by default, uncomment this to enable it
-#mdns_adv = 1
-
-# Override the default mDNS advertizement name. This must be
-# unique on the immediate broadcast network.
-#
-# The default is "Virtualization Host HOSTNAME", where HOSTNAME
-# is substituted for the short hostname of the machine (without domain)
-#
-#mdns_name = "Virtualization Host Joe Demo"
-
-
#################################################################
#
# UNIX socket access controls
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index c1544ba914..fdc9e4333a 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -429,14 +429,11 @@ daemonSetupNetworking(virNetServerPtr srv,
goto cleanup;
}
- if (virNetServerAddService(srv, svc,
- config->mdns_adv && !ipsock ?
- "_libvirt._tcp" :
- NULL) < 0)
+ if (virNetServerAddService(srv, svc) < 0)
goto cleanup;
if (svcRO &&
- virNetServerAddService(srv, svcRO, NULL) < 0)
+ virNetServerAddService(srv, svcRO) < 0)
goto cleanup;
if (sock_path_adm) {
@@ -451,7 +448,7 @@ daemonSetupNetworking(virNetServerPtr srv,
config->admin_max_client_requests)))
goto cleanup;
- if (virNetServerAddService(srvAdm, svcAdm, NULL) < 0)
+ if (virNetServerAddService(srvAdm, svcAdm) < 0)
goto cleanup;
}
@@ -469,8 +466,7 @@ daemonSetupNetworking(virNetServerPtr srv,
config->max_client_requests)))
goto cleanup;
- if (virNetServerAddService(srv, svcTCP,
- config->mdns_adv ? "_libvirt._tcp" : NULL) < 0)
+ if (virNetServerAddService(srv, svcTCP) < 0)
goto cleanup;
}
@@ -530,9 +526,7 @@ daemonSetupNetworking(virNetServerPtr srv,
virObjectUnref(ctxt);
goto cleanup;
}
- if (virNetServerAddService(srv, svcTLS,
- config->mdns_adv &&
- !config->listen_tcp ? "_libvirt._tcp" : NULL) < 0)
+ if (virNetServerAddService(srv, svcTLS) < 0)
goto cleanup;
virObjectUnref(ctxt);
@@ -1197,7 +1191,6 @@ int main(int argc, char **argv) {
config->max_anonymous_clients,
config->keepalive_interval,
config->keepalive_count,
- config->mdns_adv ? config->mdns_name : NULL,
remoteClientNew,
NULL,
remoteClientFree,
@@ -1265,7 +1258,6 @@ int main(int argc, char **argv) {
0,
config->admin_keepalive_interval,
config->admin_keepalive_count,
- NULL,
remoteAdmClientNew,
NULL,
remoteAdmClientFree,
diff --git a/src/remote/remote_daemon_config.c b/src/remote/remote_daemon_config.c
index a56aa9065a..537b90a855 100644
--- a/src/remote/remote_daemon_config.c
+++ b/src/remote/remote_daemon_config.c
@@ -102,8 +102,6 @@ struct daemonConfig*
daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
{
struct daemonConfig *data;
- char *localhost;
- int ret;
if (VIR_ALLOC(data) < 0)
return NULL;
@@ -141,8 +139,6 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
#endif
data->auth_tls = REMOTE_AUTH_NONE;
- data->mdns_adv = 0;
-
data->min_workers = 5;
data->max_workers = 20;
data->max_clients = 5000;
@@ -170,25 +166,6 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
data->ovs_timeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT;
- localhost = virGetHostname();
- if (localhost == NULL) {
- /* we couldn't resolve the hostname; assume that we are
- * running in disconnected operation, and report a less
- * useful Avahi string
- */
- ret = VIR_STRDUP(data->mdns_name, "Virtualization Host");
- } else {
- char *tmp;
- /* Extract the host part of the potentially FQDN */
- if ((tmp = strchr(localhost, '.')))
- *tmp = '\0';
- ret = virAsprintf(&data->mdns_name, "Virtualization Host %s",
- localhost);
- }
- VIR_FREE(localhost);
- if (ret < 0)
- goto error;
-
return data;
error:
@@ -219,7 +196,6 @@ daemonConfigFree(struct daemonConfig *data)
VIR_FREE(data->unix_sock_rw_perms);
VIR_FREE(data->unix_sock_group);
VIR_FREE(data->unix_sock_dir);
- VIR_FREE(data->mdns_name);
tmp = data->tls_allowed_dn_list;
while (tmp && *tmp) {
@@ -300,11 +276,6 @@ daemonConfigLoadOptions(struct daemonConfig *data,
if (virConfGetValueString(conf, "unix_sock_dir", &data->unix_sock_dir) < 0)
goto error;
- if (virConfGetValueBool(conf, "mdns_adv", &data->mdns_adv) < 0)
- goto error;
- if (virConfGetValueString(conf, "mdns_name", &data->mdns_name) < 0)
- goto error;
-
if (virConfGetValueBool(conf, "tls_no_sanity_certificate", &data->tls_no_sanity_certificate) < 0)
goto error;
if (virConfGetValueBool(conf, "tls_no_verify_certificate", &data->tls_no_verify_certificate) < 0)
diff --git a/src/remote/remote_daemon_config.h b/src/remote/remote_daemon_config.h
index 56d130bdce..5eac7e4410 100644
--- a/src/remote/remote_daemon_config.h
+++ b/src/remote/remote_daemon_config.h
@@ -47,9 +47,6 @@ struct daemonConfig {
char **access_drivers;
- bool mdns_adv;
- char *mdns_name;
-
bool tls_no_verify_certificate;
bool tls_no_sanity_certificate;
char **tls_allowed_dn_list;
diff --git a/src/remote/test_libvirtd.aug.in b/src/remote/test_libvirtd.aug.in
index 527e3d7d0d..ad6450a569 100644
--- a/src/remote/test_libvirtd.aug.in
+++ b/src/remote/test_libvirtd.aug.in
@@ -7,8 +7,6 @@ module Test_libvirtd =
{ "tls_port" = "16514" }
{ "tcp_port" = "16509" }
{ "listen_addr" = "192.168.0.1" }
- { "mdns_adv" = "1" }
- { "mdns_name" = "Virtualization Host Joe Demo" }
{ "unix_sock_group" = "libvirt" }
{ "unix_sock_ro_perms" = "0777" }
{ "unix_sock_rw_perms" = "0770" }
diff --git a/src/rpc/Makefile.inc.am b/src/rpc/Makefile.inc.am
index 68a4945198..e5b830605a 100644
--- a/src/rpc/Makefile.inc.am
+++ b/src/rpc/Makefile.inc.am
@@ -103,22 +103,18 @@ libvirt_net_rpc_server_la_SOURCES = \
rpc/virnetserverservice.c \
rpc/virnetserverclient.h \
rpc/virnetserverclient.c \
- rpc/virnetservermdns.h \
- rpc/virnetservermdns.c \
rpc/virnetdaemon.h \
rpc/virnetdaemon.c \
rpc/virnetserver.h \
rpc/virnetserver.c \
$(NULL)
libvirt_net_rpc_server_la_CFLAGS = \
- $(AVAHI_CFLAGS) \
$(DBUS_CFLAGS) \
$(XDR_CFLAGS) \
$(AM_CFLAGS) \
$(NULL)
libvirt_net_rpc_server_la_LDFLAGS = \
$(AM_LDFLAGS) \
- $(AVAHI_LIBS) \
$(DBUS_LIBS) \
$(NULL)
libvirt_net_rpc_server_la_LIBADD = $(CYGWIN_EXTRA_LIBADD)
diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
index 0ca61c5a9a..d098cf4ae9 100644
--- a/src/rpc/virnetdaemon.c
+++ b/src/rpc/virnetdaemon.c
@@ -32,7 +32,6 @@
#include "virutil.h"
#include "virfile.h"
#include "virnetserver.h"
-#include "virnetservermdns.h"
#include "virdbus.h"
#include "virhash.h"
#include "virstring.h"
@@ -767,16 +766,6 @@ virNetDaemonUpdateServices(virNetDaemonPtr dmn,
virObjectUnlock(dmn);
}
-static int
-daemonServerRun(void *payload,
- const void *key ATTRIBUTE_UNUSED,
- void *opaque ATTRIBUTE_UNUSED)
-{
- virNetServerPtr srv = payload;
-
- return virNetServerStart(srv);
-};
-
static int
daemonServerProcessClients(void *payload,
const void *key ATTRIBUTE_UNUSED,
@@ -802,9 +791,6 @@ virNetDaemonRun(virNetDaemonPtr dmn)
goto cleanup;
}
- if (virHashForEach(dmn->servers, daemonServerRun, NULL) < 0)
- goto cleanup;
-
dmn->quit = false;
if (dmn->autoShutdownTimeout &&
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 4934dba967..0f3fa63fbb 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -27,7 +27,6 @@
#include "virerror.h"
#include "virthread.h"
#include "virthreadpool.h"
-#include "virnetservermdns.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_RPC
@@ -52,10 +51,6 @@ struct _virNetServer {
/* Immutable pointer, self-locking APIs */
virThreadPoolPtr workers;
- char *mdnsGroupName;
- virNetServerMDNSPtr mdns;
- virNetServerMDNSGroupPtr mdnsGroup;
-
size_t nservices;
virNetServerServicePtr *services;
@@ -351,7 +346,6 @@ virNetServerPtr virNetServerNew(const char *name,
size_t max_anonymous_clients,
int keepaliveInterval,
unsigned int keepaliveCount,
- const char *mdnsGroupName,
virNetServerClientPrivNew clientPrivNew,
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
virFreeCallback clientPrivFree,
@@ -384,16 +378,6 @@ virNetServerPtr virNetServerNew(const char *name,
srv->clientPrivFree = clientPrivFree;
srv->clientPrivOpaque = clientPrivOpaque;
- if (VIR_STRDUP(srv->mdnsGroupName, mdnsGroupName) < 0)
- goto error;
- if (srv->mdnsGroupName) {
- if (!(srv->mdns = virNetServerMDNSNew()))
- goto error;
- if (!(srv->mdnsGroup = virNetServerMDNSAddGroup(srv->mdns,
- srv->mdnsGroupName)))
- goto error;
- }
-
return srv;
error:
virObjectUnref(srv);
@@ -421,7 +405,6 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONValuePtr object,
unsigned int keepaliveInterval;
unsigned int keepaliveCount;
unsigned long long next_client_id;
- const char *mdnsGroupName = NULL;
if (virJSONValueObjectGetNumberUint(object, "min_workers", &min_workers) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -464,13 +447,6 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONValuePtr object,
goto error;
}
- if (virJSONValueObjectHasKey(object, "mdnsGroupName") &&
- (!(mdnsGroupName = virJSONValueObjectGetString(object, "mdnsGroupName")))) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Malformed mdnsGroupName data in JSON document"));
- goto error;
- }
-
if (virJSONValueObjectGetNumberUlong(object, "next_client_id",
&next_client_id) < 0) {
VIR_WARN("Missing next_client_id data in JSON document");
@@ -482,7 +458,6 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONValuePtr object,
priority_workers, max_clients,
max_anonymous_clients,
keepaliveInterval, keepaliveCount,
- mdnsGroupName,
clientPrivNew, clientPrivPreExecRestart,
clientPrivFree, clientPrivOpaque)))
goto error;
@@ -511,8 +486,7 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONValuePtr object,
if (!(service = virNetServerServiceNewPostExecRestart(child)))
goto error;
- /* XXX mdns entry names ? */
- if (virNetServerAddService(srv, service, NULL) < 0) {
+ if (virNetServerAddService(srv, service) < 0) {
virObjectUnref(service);
goto error;
}
@@ -622,13 +596,6 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
goto error;
}
- if (srv->mdnsGroupName &&
- virJSONValueObjectAppendString(object, "mdnsGroupName", srv->mdnsGroupName) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot set mdnsGroupName data in JSON document"));
- goto error;
- }
-
if (!(services = virJSONValueNewArray()))
goto error;
@@ -680,25 +647,13 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
int virNetServerAddService(virNetServerPtr srv,
- virNetServerServicePtr svc,
- const char *mdnsEntryName)
+ virNetServerServicePtr svc)
{
virObjectLock(srv);
if (VIR_EXPAND_N(srv->services, srv->nservices, 1) < 0)
goto error;
- if (mdnsEntryName) {
- int port = virNetServerServiceGetPort(svc);
-
- if (!virNetServerMDNSAddEntry(srv->mdnsGroup,
- mdnsEntryName,
- port)) {
- srv->nservices--;
- goto error;
- }
- }
-
srv->services[srv->nservices-1] = virObjectRef(svc);
virNetServerServiceSetDispatcher(svc,
@@ -820,9 +775,6 @@ void virNetServerDispose(void *obj)
for (i = 0; i < srv->nclients; i++)
virObjectUnref(srv->clients[i]);
VIR_FREE(srv->clients);
-
- VIR_FREE(srv->mdnsGroupName);
- virNetServerMDNSFree(srv->mdns);
}
void virNetServerClose(virNetServerPtr srv)
@@ -909,18 +861,6 @@ virNetServerProcessClients(virNetServerPtr srv)
virObjectUnlock(srv);
}
-int
-virNetServerStart(virNetServerPtr srv)
-{
- /*
- * Do whatever needs to be done before starting.
- */
- if (!srv->mdns)
- return 0;
-
- return virNetServerMDNSStart(srv->mdns);
-}
-
const char *
virNetServerGetName(virNetServerPtr srv)
{
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 92a856fb03..49203cdb3a 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -39,7 +39,6 @@ virNetServerPtr virNetServerNew(const char *name,
size_t max_anonymous_clients,
int keepaliveInterval,
unsigned int keepaliveCount,
- const char *mdnsGroupName,
virNetServerClientPrivNew clientPrivNew,
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
virFreeCallback clientPrivFree,
@@ -61,8 +60,7 @@ void virNetServerClose(virNetServerPtr srv);
virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv);
int virNetServerAddService(virNetServerPtr srv,
- virNetServerServicePtr svc,
- const char *mdnsEntryName);
+ virNetServerServicePtr svc);
int virNetServerAddProgram(virNetServerPtr srv,
virNetServerProgramPtr prog);
@@ -79,8 +77,6 @@ void virNetServerSetClientAuthenticated(virNetServerPtr srv, virNetServerClientP
void virNetServerUpdateServices(virNetServerPtr srv, bool enabled);
-int virNetServerStart(virNetServerPtr srv);
-
const char *virNetServerGetName(virNetServerPtr srv);
int virNetServerGetThreadPoolParameters(virNetServerPtr srv,
diff --git a/src/rpc/virnetservermdns.c b/src/rpc/virnetservermdns.c
deleted file mode 100644
index 4c10749364..0000000000
--- a/src/rpc/virnetservermdns.c
+++ /dev/null
@@ -1,682 +0,0 @@
-/*
- * virnetservermdns.c: advertise server sockets
- *
- * Copyright (C) 2011-2012 Red Hat, Inc.
- * Copyright (C) 2007 Daniel P. Berrange
- *
- * Derived from Avahi example service provider code.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include <time.h>
-
-#if WITH_AVAHI
-# include <avahi-client/client.h>
-# include <avahi-client/publish.h>
-
-# include <avahi-common/alternative.h>
-# include <avahi-common/simple-watch.h>
-# include <avahi-common/malloc.h>
-# include <avahi-common/error.h>
-# include <avahi-common/timeval.h>
-#endif
-
-#include "virnetservermdns.h"
-#include "vireventpoll.h"
-#include "viralloc.h"
-#include "virerror.h"
-#include "virlog.h"
-#include "virstring.h"
-
-#define VIR_FROM_THIS VIR_FROM_RPC
-
-VIR_LOG_INIT("rpc.netservermdns");
-
-struct _virNetServerMDNSEntry {
- char *type;
- int port;
- virNetServerMDNSEntryPtr next;
-};
-
-struct _virNetServerMDNSGroup {
- virNetServerMDNSPtr mdns;
-#if WITH_AVAHI
- AvahiEntryGroup *handle;
-#endif
- char *name;
- virNetServerMDNSEntryPtr entry;
- virNetServerMDNSGroupPtr next;
-};
-
-struct _virNetServerMDNS {
-#if WITH_AVAHI
- AvahiClient *client;
- AvahiPoll *poller;
-#endif
- virNetServerMDNSGroupPtr group;
-};
-
-#if WITH_AVAHI
-/* Avahi API requires this struct name in the app :-( */
-struct AvahiWatch {
- int watch;
- int fd;
- int revents;
- AvahiWatchCallback callback;
- void *userdata;
-};
-
-/* Avahi API requires this struct name in the app :-( */
-struct AvahiTimeout {
- int timer;
- AvahiTimeoutCallback callback;
- void *userdata;
-};
-
-static void virNetServerMDNSCreateServices(virNetServerMDNSGroupPtr group);
-
-/* Called whenever the entry group state changes */
-static void virNetServerMDNSGroupCallback(AvahiEntryGroup *g ATTRIBUTE_UNUSED,
- AvahiEntryGroupState state,
- void *data)
-{
- virNetServerMDNSGroupPtr group = data;
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
- /* The entry group has been established successfully */
- VIR_DEBUG("Group '%s' established", group->name);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION:
- {
- char *n;
-
- /* A service name collision happened. Let's pick a new name */
- n = avahi_alternative_service_name(group->name);
- VIR_FREE(group->name);
- group->name = n;
-
- VIR_DEBUG("Group name collision, renaming service to '%s'", group->name);
-
- /* And recreate the services */
- virNetServerMDNSCreateServices(group);
- }
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE :
- VIR_DEBUG("Group failure: %s",
- avahi_strerror(avahi_client_errno(group->mdns->client)));
-
- /* Some kind of failure happened while we were registering our services */
- /* avahi_simple_poll_quit(simple_poll); */
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void virNetServerMDNSCreateServices(virNetServerMDNSGroupPtr group)
-{
- virNetServerMDNSPtr mdns = group->mdns;
- virNetServerMDNSEntryPtr entry;
- int ret;
- VIR_DEBUG("Adding services to '%s'", group->name);
-
- /* If we've no services to advertise, just reset the group to make
- * sure it is emptied of any previously advertised services */
- if (!group->entry) {
- if (group->handle)
- avahi_entry_group_reset(group->handle);
- return;
- }
-
- /* If this is the first time we're called, let's create a new entry group */
- if (!group->handle) {
- VIR_DEBUG("Creating initial group %s", group->name);
- if (!(group->handle =
- avahi_entry_group_new(mdns->client,
- virNetServerMDNSGroupCallback,
- group))) {
- VIR_DEBUG("avahi_entry_group_new() failed: %s",
- avahi_strerror(avahi_client_errno(mdns->client)));
- return;
- }
- }
-
- entry = group->entry;
- while (entry) {
- if ((ret = avahi_entry_group_add_service(group->handle,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- 0,
- group->name,
- entry->type,
- NULL,
- NULL,
- entry->port,
- NULL)) < 0) {
- VIR_DEBUG("Failed to add %s service on port %d: %s",
- entry->type, entry->port, avahi_strerror(ret));
- avahi_entry_group_reset(group->handle);
- return;
- }
- entry = entry->next;
- }
-
- /* Tell the server to register the service */
- if ((ret = avahi_entry_group_commit(group->handle)) < 0) {
- avahi_entry_group_reset(group->handle);
- VIR_DEBUG("Failed to commit entry_group: %s",
- avahi_strerror(ret));
- return;
- }
-}
-
-
-static void virNetServerMDNSClientCallback(AvahiClient *c,
- AvahiClientState state,
- void *data)
-{
- virNetServerMDNSPtr mdns = data;
- virNetServerMDNSGroupPtr group;
- if (!mdns->client)
- mdns->client = c;
-
- VIR_DEBUG("Callback state=%d", state);
-
- /* Called whenever the client or server state changes */
- switch (state) {
- case AVAHI_CLIENT_S_RUNNING:
- /* The server has startup successfully and registered its host
- * name on the network, so it's time to create our services */
- VIR_DEBUG("Client running %p", mdns->client);
- group = mdns->group;
- while (group) {
- virNetServerMDNSCreateServices(group);
- group = group->next;
- }
- break;
-
- case AVAHI_CLIENT_FAILURE:
- VIR_DEBUG("Client failure: %s",
- avahi_strerror(avahi_client_errno(c)));
- virNetServerMDNSStop(mdns);
- virNetServerMDNSStart(mdns);
- break;
-
- case AVAHI_CLIENT_S_COLLISION:
- /* Let's drop our registered services. When the server is back
- * in AVAHI_SERVER_RUNNING state we will register them
- * again with the new host name. */
-
- ATTRIBUTE_FALLTHROUGH;
-
- case AVAHI_CLIENT_S_REGISTERING:
- /* The server records are now being established. This
- * might be caused by a host name change. We need to wait
- * for our own records to register until the host name is
- * properly established. */
- VIR_DEBUG("Client collision/connecting %p", mdns->client);
- group = mdns->group;
- while (group) {
- if (group->handle)
- avahi_entry_group_reset(group->handle);
- group = group->next;
- }
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- VIR_DEBUG("Client connecting.... %p", mdns->client);
- ;
- }
-}
-
-
-static void virNetServerMDNSWatchDispatch(int watch, int fd, int events, void *opaque)
-{
- AvahiWatch *w = opaque;
- int fd_events = virEventPollToNativeEvents(events);
- VIR_DEBUG("Dispatch watch %d FD %d Event %d", watch, fd, fd_events);
- w->revents = fd_events;
- w->callback(w, fd, fd_events, w->userdata);
-}
-
-static void virNetServerMDNSWatchDofree(void *w)
-{
- VIR_FREE(w);
-}
-
-
-static AvahiWatch *virNetServerMDNSWatchNew(const AvahiPoll *api ATTRIBUTE_UNUSED,
- int fd, AvahiWatchEvent event,
- AvahiWatchCallback cb, void *userdata)
-{
- AvahiWatch *w;
- virEventHandleType hEvents;
- if (VIR_ALLOC(w) < 0)
- return NULL;
-
- w->fd = fd;
- w->revents = 0;
- w->callback = cb;
- w->userdata = userdata;
-
- VIR_DEBUG("New handle %p FD %d Event %d", w, w->fd, event);
- hEvents = virEventPollFromNativeEvents(event);
- if ((w->watch = virEventAddHandle(fd, hEvents,
- virNetServerMDNSWatchDispatch,
- w,
- virNetServerMDNSWatchDofree)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to add watch for fd %d events %d"), fd, hEvents);
- VIR_FREE(w);
- return NULL;
- }
-
- return w;
-}
-
-static void virNetServerMDNSWatchUpdate(AvahiWatch *w, AvahiWatchEvent event)
-{
- VIR_DEBUG("Update handle %p FD %d Event %d", w, w->fd, event);
- virEventUpdateHandle(w->watch, event);
-}
-
-static AvahiWatchEvent virNetServerMDNSWatchGetEvents(AvahiWatch *w)
-{
- VIR_DEBUG("Get handle events %p %d", w, w->fd);
- return w->revents;
-}
-
-static void virNetServerMDNSWatchFree(AvahiWatch *w)
-{
- VIR_DEBUG("Free handle %p %d", w, w->fd);
- virEventRemoveHandle(w->watch);
-}
-
-static void virNetServerMDNSTimeoutDispatch(int timer ATTRIBUTE_UNUSED, void *opaque)
-{
- AvahiTimeout *t = (AvahiTimeout*)opaque;
- VIR_DEBUG("Dispatch timeout %p %d", t, timer);
- virEventUpdateTimeout(t->timer, -1);
- t->callback(t, t->userdata);
-}
-
-static void virNetServerMDNSTimeoutDofree(void *t)
-{
- VIR_FREE(t);
-}
-
-static AvahiTimeout *virNetServerMDNSTimeoutNew(const AvahiPoll *api ATTRIBUTE_UNUSED,
- const struct timeval *tv,
- AvahiTimeoutCallback cb,
- void *userdata)
-{
- AvahiTimeout *t;
- struct timeval now;
- long long nowms, thenms, timeout;
- VIR_DEBUG("Add timeout TV %p", tv);
- if (VIR_ALLOC(t) < 0)
- return NULL;
-
- if (gettimeofday(&now, NULL) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to get current time"));
- VIR_FREE(t);
- return NULL;
- }
-
- VIR_DEBUG("Trigger timed for %d %d %d %d",
- (int)now.tv_sec, (int)now.tv_usec,
- (int)(tv ? tv->tv_sec : 0), (int)(tv ? tv->tv_usec : 0));
- nowms = (now.tv_sec * 1000ll) + (now.tv_usec / 1000ll);
- if (tv) {
- thenms = (tv->tv_sec * 1000ll) + (tv->tv_usec/1000ll);
- timeout = thenms > nowms ? nowms - thenms : 0;
- if (timeout < 0)
- timeout = 0;
- } else {
- timeout = -1;
- }
-
- t->timer = virEventAddTimeout(timeout,
- virNetServerMDNSTimeoutDispatch,
- t,
- virNetServerMDNSTimeoutDofree);
- t->callback = cb;
- t->userdata = userdata;
-
- if (t->timer < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to add timer with timeout %lld"), timeout);
- VIR_FREE(t);
- return NULL;
- }
-
- return t;
-}
-
-static void virNetServerMDNSTimeoutUpdate(AvahiTimeout *t, const struct timeval *tv)
-{
- struct timeval now;
- long long nowms, thenms, timeout;
- VIR_DEBUG("Update timeout %p TV %p", t, tv);
- if (gettimeofday(&now, NULL) < 0) {
- VIR_FREE(t);
- return;
- }
-
- nowms = (now.tv_sec * 1000ll) + (now.tv_usec / 1000ll);
- if (tv) {
- thenms = ((tv->tv_sec * 1000ll) + (tv->tv_usec/1000ll));
- timeout = thenms > nowms ? nowms - thenms : 0;
- if (timeout < 0)
- timeout = 0;
- } else {
- timeout = -1;
- }
-
- virEventUpdateTimeout(t->timer, timeout);
-}
-
-static void virNetServerMDNSTimeoutFree(AvahiTimeout *t)
-{
- VIR_DEBUG("Free timeout %p", t);
- virEventRemoveTimeout(t->timer);
-}
-
-
-static AvahiPoll *virNetServerMDNSCreatePoll(void)
-{
- AvahiPoll *p;
- if (VIR_ALLOC(p) < 0)
- return NULL;
-
- p->userdata = NULL;
-
- p->watch_new = virNetServerMDNSWatchNew;
- p->watch_update = virNetServerMDNSWatchUpdate;
- p->watch_get_events = virNetServerMDNSWatchGetEvents;
- p->watch_free = virNetServerMDNSWatchFree;
-
- p->timeout_new = virNetServerMDNSTimeoutNew;
- p->timeout_update = virNetServerMDNSTimeoutUpdate;
- p->timeout_free = virNetServerMDNSTimeoutFree;
-
- return p;
-}
-
-
-virNetServerMDNS *virNetServerMDNSNew(void)
-{
- virNetServerMDNS *mdns;
- if (VIR_ALLOC(mdns) < 0)
- return NULL;
-
- /* Allocate main loop object */
- if (!(mdns->poller = virNetServerMDNSCreatePoll())) {
- VIR_FREE(mdns);
- return NULL;
- }
-
- return mdns;
-}
-
-
-int virNetServerMDNSStart(virNetServerMDNS *mdns)
-{
- int error;
- VIR_DEBUG("Starting client %p", mdns);
- mdns->client = avahi_client_new(mdns->poller,
- AVAHI_CLIENT_NO_FAIL,
- virNetServerMDNSClientCallback,
- mdns, &error);
-
- if (!mdns->client) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to create mDNS client: %s"),
- avahi_strerror(error));
- return -1;
- }
-
- return 0;
-}
-
-
-virNetServerMDNSGroupPtr virNetServerMDNSAddGroup(virNetServerMDNS *mdns,
- const char *name)
-{
- virNetServerMDNSGroupPtr group;
-
- VIR_DEBUG("Adding group '%s'", name);
- if (VIR_ALLOC(group) < 0)
- return NULL;
-
- if (VIR_STRDUP(group->name, name) < 0) {
- VIR_FREE(group);
- return NULL;
- }
- group->mdns = mdns;
- group->next = mdns->group;
- mdns->group = group;
- return group;
-}
-
-
-void virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns,
- virNetServerMDNSGroupPtr group)
-{
- virNetServerMDNSGroupPtr tmp = mdns->group, prev = NULL;
-
- while (tmp) {
- if (tmp == group) {
- VIR_FREE(group->name);
- if (prev)
- prev->next = group->next;
- else
- group->mdns->group = group->next;
- VIR_FREE(group);
- return;
- }
- prev = tmp;
- tmp = tmp->next;
- }
-}
-
-
-virNetServerMDNSEntryPtr virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group,
- const char *type,
- int port)
-{
- virNetServerMDNSEntryPtr entry;
-
- VIR_DEBUG("Adding entry %s %d to group %s", type, port, group->name);
- if (VIR_ALLOC(entry) < 0)
- return NULL;
-
- entry->port = port;
- if (VIR_STRDUP(entry->type, type) < 0) {
- VIR_FREE(entry);
- return NULL;
- }
- entry->next = group->entry;
- group->entry = entry;
- return entry;
-}
-
-
-void virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group,
- virNetServerMDNSEntryPtr entry)
-{
- virNetServerMDNSEntryPtr tmp = group->entry, prev = NULL;
-
- while (tmp) {
- if (tmp == entry) {
- VIR_FREE(entry->type);
- if (prev)
- prev->next = entry->next;
- else
- group->entry = entry->next;
- return;
- }
- prev = tmp;
- tmp = tmp->next;
- }
-}
-
-
-void virNetServerMDNSStop(virNetServerMDNSPtr mdns)
-{
- virNetServerMDNSGroupPtr group = mdns->group;
- while (group) {
- if (group->handle) {
- avahi_entry_group_free(group->handle);
- group->handle = NULL;
- }
- group = group->next;
- }
- if (mdns->client)
- avahi_client_free(mdns->client);
- mdns->client = NULL;
-}
-
-
-void virNetServerMDNSFree(virNetServerMDNSPtr mdns)
-{
- virNetServerMDNSGroupPtr group, tmp;
-
- if (!mdns)
- return;
-
- group = mdns->group;
- while (group) {
- tmp = group->next;
- virNetServerMDNSGroupFree(group);
- group = tmp;
- }
-
- VIR_FREE(mdns->poller);
- VIR_FREE(mdns);
-}
-
-
-void virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr grp)
-{
- virNetServerMDNSEntryPtr entry, tmp;
-
- if (!grp)
- return;
-
- entry = grp->entry;
- while (entry) {
- tmp = entry->next;
- virNetServerMDNSEntryFree(entry);
- entry = tmp;
- }
-
- VIR_FREE(grp->name);
- VIR_FREE(grp);
-}
-
-
-void virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry)
-{
- if (!entry)
- return;
-
- VIR_FREE(entry->type);
- VIR_FREE(entry);
-}
-
-#else /* ! WITH_AVAHI */
-
-static const char *unsupported = N_("avahi not available at build time");
-
-virNetServerMDNS *
-virNetServerMDNSNew(void)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return NULL;
-}
-
-int
-virNetServerMDNSStart(virNetServerMDNS *mdns ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return -1;
-}
-
-virNetServerMDNSGroupPtr
-virNetServerMDNSAddGroup(virNetServerMDNS *mdns ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return NULL;
-}
-
-void
-virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED,
- virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-virNetServerMDNSEntryPtr
-virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED,
- const char *type ATTRIBUTE_UNUSED,
- int port ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return NULL;
-}
-
-void
-virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED,
- virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSStop(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSFree(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr grp ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-#endif /* ! WITH_AVAHI */
diff --git a/src/rpc/virnetservermdns.h b/src/rpc/virnetservermdns.h
deleted file mode 100644
index 64511a65c8..0000000000
--- a/src/rpc/virnetservermdns.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * virnetservermdns.h: advertise server sockets
- *
- * Copyright (C) 2011 Red Hat, Inc.
- * Copyright (C) 2007 Daniel P. Berrange
- *
- * Derived from Avahi example service provider code.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#ifndef LIBVIRT_VIRNETSERVERMDNS_H
-# define LIBVIRT_VIRNETSERVERMDNS_H
-
-# include "internal.h"
-
-typedef struct _virNetServerMDNS virNetServerMDNS;
-typedef virNetServerMDNS *virNetServerMDNSPtr;
-typedef struct _virNetServerMDNSGroup virNetServerMDNSGroup;
-typedef virNetServerMDNSGroup *virNetServerMDNSGroupPtr;
-typedef struct _virNetServerMDNSEntry virNetServerMDNSEntry;
-typedef virNetServerMDNSEntry *virNetServerMDNSEntryPtr;
-
-
-/**
- * Prepares a new mdns manager object for use
- */
-virNetServerMDNSPtr virNetServerMDNSNew(void);
-
-/**
- * Starts the mdns client, advertising any groups/entries currently registered
- *
- * @mdns: manager to start advertising
- *
- * Starts the mdns client. Services may not be immediately visible, since
- * it may asynchronously wait for the mdns service to startup
- *
- * returns -1 upon failure, 0 upon success.
- */
-int virNetServerMDNSStart(virNetServerMDNSPtr mdns);
-
-/**
- * Stops the mdns client, removing any advertisements
- *
- * @mdns: manager to start advertising
- *
- */
-void virNetServerMDNSStop(virNetServerMDNSPtr mdns);
-
-/**
- * Adds a group container for advertisement
- *
- * @mdns manager to attach the group to
- * @name unique human readable service name
- *
- * returns the group record, or NULL upon failure
- */
-virNetServerMDNSGroupPtr virNetServerMDNSAddGroup(virNetServerMDNSPtr mdns,
- const char *name);
-
-/**
- * Removes a group container from advertisement
- *
- * @mdns amanger to detach group from
- * @group group to remove
- */
-void virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns,
- virNetServerMDNSGroupPtr group);
-
-/**
- * Adds a service entry in a group
- *
- * @group group to attach the entry to
- * @type service type string
- * @port tcp port number
- *
- * returns the service record, or NULL upon failure
- */
-virNetServerMDNSEntryPtr virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group,
- const char *type, int port);
-
-/**
- * Removes a service entry from a group
- *
- * @group group to detach service entry from
- * @entry service entry to remove
- */
-void virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group,
- virNetServerMDNSEntryPtr entry);
-
-void virNetServerMDNSFree(virNetServerMDNSPtr ptr);
-void virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr ptr);
-void virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr ptr);
-
-#endif /* LIBVIRT_VIRNETSERVERMDNS_H */
diff --git a/tests/virconfdata/libvirtd.conf b/tests/virconfdata/libvirtd.conf
index ee57593109..602aa08d92 100644
--- a/tests/virconfdata/libvirtd.conf
+++ b/tests/virconfdata/libvirtd.conf
@@ -43,23 +43,6 @@ tcp_port = "16509"
-# Flag toggling mDNS advertizement of the libvirt service.
-#
-# Alternatively can disable for all services on a host by
-# stopping the Avahi daemon
-#
-# This is disabled by default, uncomment this to enable it
-mdns_adv = 1
-
-# Override the default mDNS advertizement name. This must be
-# unique on the immediate broadcast network.
-#
-# The default is "Virtualization Host HOSTNAME", where HOSTNAME
-# is subsituted for the short hostname of the machine (without domain)
-#
-mdns_name = "Virtualization Host Joe Demo"
-
-
#################################################################
#
# UNIX socket access controls
diff --git a/tests/virconfdata/libvirtd.out b/tests/virconfdata/libvirtd.out
index e0b6f0a606..d3f2bd20a7 100644
--- a/tests/virconfdata/libvirtd.out
+++ b/tests/virconfdata/libvirtd.out
@@ -32,20 +32,6 @@ tls_port = "16514"
# This can be a port number, or service name
#
tcp_port = "16509"
-# Flag toggling mDNS advertizement of the libvirt service.
-#
-# Alternatively can disable for all services on a host by
-# stopping the Avahi daemon
-#
-# This is disabled by default, uncomment this to enable it
-mdns_adv = 1
-# Override the default mDNS advertizement name. This must be
-# unique on the immediate broadcast network.
-#
-# The default is "Virtualization Host HOSTNAME", where HOSTNAME
-# is subsituted for the short hostname of the machine (without domain)
-#
-mdns_name = "Virtualization Host Joe Demo"
#################################################################
#
# UNIX socket access controls
diff --git a/tests/virnetdaemondata/input-data-admin-nomdns.json b/tests/virnetdaemondata/input-data-admin.json
similarity index 100%
rename from tests/virnetdaemondata/input-data-admin-nomdns.json
rename to tests/virnetdaemondata/input-data-admin.json
diff --git a/tests/virnetdaemondata/input-data-initial-nomdns.json b/tests/virnetdaemondata/input-data-initial-nomdns.json
deleted file mode 100644
index 6cf70d96e8..0000000000
--- a/tests/virnetdaemondata/input-data-initial-nomdns.json
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "min_workers": 10,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "keepaliveRequired": true,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "auth": 1,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "auth": 2,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
-}
diff --git a/tests/virnetdaemondata/input-data-initial.json b/tests/virnetdaemondata/input-data-initial.json
index 5bb09ed36b..6cf70d96e8 100644
--- a/tests/virnetdaemondata/input-data-initial.json
+++ b/tests/virnetdaemondata/input-data-initial.json
@@ -6,7 +6,6 @@
"keepaliveInterval": 120,
"keepaliveCount": 5,
"keepaliveRequired": true,
- "mdnsGroupName": "libvirtTest",
"services": [
{
"auth": 0,
diff --git a/tests/virnetdaemondata/output-data-admin-nomdns.json b/tests/virnetdaemondata/output-data-admin.json
similarity index 100%
rename from tests/virnetdaemondata/output-data-admin-nomdns.json
rename to tests/virnetdaemondata/output-data-admin.json
diff --git a/tests/virnetdaemondata/output-data-initial-nomdns.json b/tests/virnetdaemondata/output-data-initial-nomdns.json
deleted file mode 100644
index 916297c59d..0000000000
--- a/tests/virnetdaemondata/output-data-initial-nomdns.json
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "servers": {
- "testServer0": {
- "min_workers": 10,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "max_anonymous_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "next_client_id": 3,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "id": 1,
- "auth": 1,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "id": 2,
- "auth": 2,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
- }
- }
-}
diff --git a/tests/virnetdaemondata/output-data-initial.json b/tests/virnetdaemondata/output-data-initial.json
index 5ed03472d6..916297c59d 100644
--- a/tests/virnetdaemondata/output-data-initial.json
+++ b/tests/virnetdaemondata/output-data-initial.json
@@ -9,7 +9,6 @@
"keepaliveInterval": 120,
"keepaliveCount": 5,
"next_client_id": 3,
- "mdnsGroupName": "libvirtTest",
"services": [
{
"auth": 0,
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 3e9b007d9b..eae630a8f1 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -87,13 +87,6 @@ testCreateServer(const char *server_name, const char *host, int family)
virNetServerClientPtr cln1 = NULL, cln2 = NULL;
virNetSocketPtr sk1 = NULL, sk2 = NULL;
int fdclient[2];
- const char *mdns_entry = NULL;
- const char *mdns_group = NULL;
-
-# ifdef WITH_AVAHI
- mdns_entry = "libvirt-ro";
- mdns_group = "libvirtTest";
-# endif
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdclient) < 0) {
virReportSystemError(errno, "%s",
@@ -104,7 +97,6 @@ testCreateServer(const char *server_name, const char *host, int family)
if (!(srv = virNetServerNew(server_name, 1,
10, 50, 5, 100, 10,
120, 5,
- mdns_group,
testClientNew,
testClientPreExec,
testClientFree,
@@ -131,9 +123,9 @@ testCreateServer(const char *server_name, const char *host, int family)
5)))
goto error;
- if (virNetServerAddService(srv, svc1, mdns_entry) < 0)
+ if (virNetServerAddService(srv, svc1) < 0)
goto error;
- if (virNetServerAddService(srv, svc2, mdns_entry) < 0)
+ if (virNetServerAddService(srv, svc2) < 0)
goto error;
if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0)
@@ -408,12 +400,9 @@ mymain(void)
# define EXEC_RESTART_TEST_FAIL(file, N) EXEC_RESTART_TEST_FULL(file, N, false)
-# ifdef WITH_AVAHI
EXEC_RESTART_TEST("initial", 1);
-# endif
- EXEC_RESTART_TEST("initial-nomdns", 1);
EXEC_RESTART_TEST("anon-clients", 1);
- EXEC_RESTART_TEST("admin-nomdns", 2);
+ EXEC_RESTART_TEST("admin", 2);
EXEC_RESTART_TEST("admin-server-names", 2);
EXEC_RESTART_TEST("no-keepalive-required", 2);
EXEC_RESTART_TEST("client-ids", 1);
--
2.21.0
5 years, 12 months
[libvirt] [PATCH] docs: Advertise pcie-to-pci-bridge for use on q35
by Andrea Bolognani
We support pcie-to-pci-bridge, and prefer it to
dmi-to-pci-bridge, since libvirt 4.3.0, but we didn't
update all the documentation accordingly at the time.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
docs/formatdomain.html.in | 10 +++++-----
docs/pci-hotplug.html.in | 5 ++---
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 22ddcb71d3..452e3b0ee4 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4414,7 +4414,7 @@
subelement <code><model></code> with an attribute
<code>name</code>. The name attribute holds the name of the
specific device that qemu is emulating (e.g. "i82801b11-bridge")
- rather than simply the class of device ("dmi-to-pci-bridge",
+ rather than simply the class of device ("pcie-to-pci-bridge",
"pci-bridge"), which is set in the controller element's
model <b>attribute</b>. In almost all cases, you should not
manually add a <code><model></code> subelement to a
@@ -4603,11 +4603,11 @@
...
<devices>
<controller type='pci' index='0' model='pcie-root'/>
- <controller type='pci' index='1' model='dmi-to-pci-bridge'>
- <address type='pci' domain='0' bus='0' slot='0xe' function='0'/>
+ <controller type='pci' index='1' model='pcie-root-port'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</controller>
- <controller type='pci' index='2' model='pci-bridge'>
- <address type='pci' domain='0' bus='1' slot='1' function='0'/>
+ <controller type='pci' index='2' model='pcie-to-pci-bridge'>
+ <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</controller>
</devices>
...</pre>
diff --git a/docs/pci-hotplug.html.in b/docs/pci-hotplug.html.in
index 9a26645aa4..29587b1e7e 100644
--- a/docs/pci-hotplug.html.in
+++ b/docs/pci-hotplug.html.in
@@ -99,13 +99,12 @@
</p>
<pre>
-<controller type='pci' model='dmi-to-pci-bridge'/>
-<controller type='pci' model='pci-bridge'/></pre>
+<controller type='pci' model='pcie-to-pci-bridge'/></pre>
<p>
and you'll be able to hotplug up to 31 legacy PCI devices,
either emulated or assigned from the host, in the slots
- from 0x01 to 0x1f of the <code>pci-bridge</code> controller.
+ from 0x01 to 0x1f of the <code>pcie-to-pci-bridge</code> controller.
</p>
<h3><a id="x86_64-i440fx">i440fx (pc) machine type</a></h3>
--
2.21.0
5 years, 12 months
[libvirt] [PATCH 0/3] test_driver: improve testDomainInterfaceAddresses
by Ilias Stamatis
This patch series introduces the following improvements to the
testDomainInterfaceAddresses function:
- if a dhcp range is defined for the network, addresses are returned
from there (instead of hard-coded addresses that were returned before)
- if the network is IPv6 even when a dhcp range is not defined IPv6
addresses will be returned instead of IPv4
- the @source argument is validated
- only networks of type VIR_DOMAIN_NET_TYPE_NETWORK are considered
Ilias Stamatis (3):
test_driver: validate @source in testDomainInterfaceAddresses
test_driver: return addresses only for nets of type network
test_driver: consider DHCP ranges in testDomainInterfaceAddresses
src/test/test_driver.c | 96 +++++++++++++++++++++++++++++++++++++-----
1 file changed, 86 insertions(+), 10 deletions(-)
--
2.22.0
5 years, 12 months
[libvirt] [PATCH 00/46] Finish moving header guards to #pragma once
by Jonathon Jongsma
My previous series ported a bunch of internal headers to use #pragma once as the header guard (per
https://wiki.libvirt.org/page/BiteSizedTasks#Switch_headers_to_use_.23pra...). This series
ports the rest of the internal headers. The public headers are unchanged, and the syntax check
script now enforces using '#ifndef/#define/#endif' for public headers and '#pragma once' for
internal headers.
Jonathon Jongsma (46):
src/locking: use #pragma once in headers
src/lxc: use #pragma once in headers
src/network: use #pragma once in headers
src/nwfilter: use #pragma once in headers
src/openvz: use #pragma once in headers
src/phyp: use #pragma once in headers
src/qemu: use #pragma once in headers
src/remote: use #pragma once in headers
src/rpc: use #pragma once in headers
src/secret: use #pragma once in headers
src/security: use #pragma once in headers
src/storage: use #pragma once in headers
src/test: use #pragma once in headers
util: thread: use #pragma once in headers
util: alloc: use #pragma once
util: atomic: use #pragma once
util: storage: use #pragma once in headers
util: netdev: use #pragma once in headers
util: arch.h: use #pragma once in headers
util: file: use #pragma once in headers
util: firewall: use #pragma once in headers
util: host: use #pragma once in headers
util: log: use #pragma once in headers
util: cgroup: use #pragma once in headers
util: error: use #pragma once in headers
util: virprobe.h: use #pragma once in headers
util: dbus: use #pragma once in headers
util: command: use #pragma once in headers
util: hash: use #pragma once in headers
util: mac: use #pragma once in headers
util: object: use #pragma once in headers
util: string: use #pragma once in headers
util: socketaddr: use #pragma once in headers
util: sysinfo: use #pragma once in headers
util: netlink: use #pragma once in headers
util: xml: use #pragma once in headers
util: scsi: use #pragma once in headers
util: misc: use #pragma once in headers
src/vbox: use #pragma once in headers
src/vmware: use #pragma once in headers
src/vmx: use #pragma once in headers
src/vz: use #pragma once in headers
xen: use #pragma once in headers
tests: use #pragma once in headers
tools: use #pragma once in headers
syntax check: update header guard check
build-aux/header-ifdef.pl | 35 +++--
src/locking/domain_lock.h | 11 +-
src/locking/lock_daemon.h | 9 +-
src/locking/lock_daemon_config.h | 7 +-
src/locking/lock_daemon_dispatch.h | 7 +-
src/locking/lock_driver.h | 18 +--
src/locking/lock_driver_lockd.h | 5 +-
src/locking/lock_driver_nop.h | 8 +-
src/locking/lock_manager.h | 9 +-
src/lxc/lxc_cgroup.h | 13 +-
src/lxc/lxc_conf.h | 47 +++---
src/lxc/lxc_container.h | 37 +++--
src/lxc/lxc_domain.h | 13 +-
src/lxc/lxc_driver.h | 5 +-
src/lxc/lxc_fuse.h | 15 +-
src/lxc/lxc_hostdev.h | 9 +-
src/lxc/lxc_monitor.h | 11 +-
src/lxc/lxc_native.h | 11 +-
src/lxc/lxc_process.h | 7 +-
src/network/bridge_driver.h | 15 +-
src/network/bridge_driver_platform.h | 15 +-
src/nwfilter/nwfilter_dhcpsnoop.h | 6 +-
src/nwfilter/nwfilter_driver.h | 9 +-
src/nwfilter/nwfilter_ebiptables_driver.h | 13 +-
src/nwfilter/nwfilter_gentech_driver.h | 11 +-
src/nwfilter/nwfilter_learnipaddr.h | 13 +-
src/nwfilter/nwfilter_tech_driver.h | 7 +-
src/openvz/openvz_conf.h | 21 ++-
src/openvz/openvz_driver.h | 11 +-
src/openvz/openvz_util.h | 5 +-
src/phyp/phyp_driver.h | 5 +-
src/qemu/qemu_agent.h | 8 +-
src/qemu/qemu_alias.h | 13 +-
src/qemu/qemu_block.h | 17 +--
src/qemu/qemu_blockjob.h | 9 +-
src/qemu/qemu_capabilities.h | 23 ++-
src/qemu/qemu_capspriv.h | 5 +-
src/qemu/qemu_cgroup.h | 12 +-
src/qemu/qemu_command.h | 35 ++---
src/qemu/qemu_conf.h | 78 +++++-----
src/qemu/qemu_domain.h | 81 +++++-----
src/qemu/qemu_domain_address.h | 13 +-
src/qemu/qemu_driver.h | 5 +-
src/qemu/qemu_extdevice.h | 9 +-
src/qemu/qemu_firmware.h | 13 +-
src/qemu/qemu_hostdev.h | 9 +-
src/qemu/qemu_hotplug.h | 11 +-
src/qemu/qemu_hotplugpriv.h | 5 +-
src/qemu/qemu_interface.h | 10 +-
src/qemu/qemu_migration.h | 17 +--
src/qemu/qemu_migration_cookie.h | 9 +-
src/qemu/qemu_migration_params.h | 19 +--
src/qemu/qemu_migration_paramspriv.h | 5 +-
src/qemu/qemu_monitor.h | 27 ++--
src/qemu/qemu_monitor_json.h | 15 +-
src/qemu/qemu_monitor_priv.h | 7 +-
src/qemu/qemu_monitor_text.h | 9 +-
src/qemu/qemu_parse_command.h | 9 +-
src/qemu/qemu_process.h | 11 +-
src/qemu/qemu_processpriv.h | 9 +-
src/qemu/qemu_qapi.h | 12 +-
src/qemu/qemu_security.h | 58 ++++---
src/qemu/qemu_tpm.h | 7 +-
src/remote/remote_daemon.h | 35 ++---
src/remote/remote_daemon_config.h | 7 +-
src/remote/remote_daemon_dispatch.h | 11 +-
src/remote/remote_daemon_stream.h | 7 +-
src/remote/remote_driver.h | 36 ++---
src/rpc/virkeepalive.h | 9 +-
src/rpc/virnetclient.h | 41 +++--
src/rpc/virnetclientprogram.h | 15 +-
src/rpc/virnetclientstream.h | 9 +-
src/rpc/virnetdaemon.h | 21 ++-
src/rpc/virnetlibsshsession.h | 9 +-
src/rpc/virnetmessage.h | 7 +-
src/rpc/virnetsaslcontext.h | 11 +-
src/rpc/virnetserver.h | 17 +--
src/rpc/virnetserverclient.h | 19 +--
src/rpc/virnetservermdns.h | 7 +-
src/rpc/virnetserverprogram.h | 11 +-
src/rpc/virnetserverservice.h | 9 +-
src/rpc/virnetsocket.h | 38 +++--
src/rpc/virnetsshsession.h | 9 +-
src/rpc/virnettlscontext.h | 9 +-
src/secret/secret_driver.h | 5 +-
src/secret/secret_util.h | 8 +-
src/security/security_apparmor.h | 13 +-
src/security/security_dac.h | 7 +-
src/security/security_driver.h | 11 +-
src/security/security_manager.h | 13 +-
src/security/security_nop.h | 7 +-
src/security/security_selinux.h | 5 +-
src/security/security_stack.h | 7 +-
src/security/security_util.h | 5 +-
src/storage/storage_backend.h | 13 +-
src/storage/storage_backend_disk.h | 5 +-
src/storage/storage_backend_fs.h | 5 +-
src/storage/storage_backend_gluster.h | 5 +-
src/storage/storage_backend_iscsi.h | 5 +-
src/storage/storage_backend_iscsi_direct.h | 5 +-
src/storage/storage_backend_logical.h | 5 +-
src/storage/storage_backend_mpath.h | 5 +-
src/storage/storage_backend_rbd.h | 5 +-
src/storage/storage_backend_scsi.h | 5 +-
src/storage/storage_backend_sheepdog.h | 5 +-
src/storage/storage_backend_sheepdog_priv.h | 7 +-
src/storage/storage_backend_vstorage.h | 5 +-
src/storage/storage_backend_zfs.h | 5 +-
src/storage/storage_driver.h | 11 +-
src/storage/storage_file_fs.h | 5 +-
src/storage/storage_file_gluster.h | 5 +-
src/storage/storage_util.h | 31 ++--
src/test/test_driver.h | 7 +-
src/util/viralloc.h | 101 ++++++------
src/util/virarch.h | 41 +++--
src/util/virarptable.h | 7 +-
src/util/viratomic.h | 91 ++++++-----
src/util/viraudit.h | 15 +-
src/util/virauth.h | 8 +-
src/util/virauthconfig.h | 9 +-
src/util/virautoclean.h | 17 +--
src/util/virbitmap.h | 11 +-
src/util/virbuffer.h | 19 +--
src/util/vircgroup.h | 10 +-
src/util/vircgroupbackend.h | 15 +-
src/util/vircgroupv1.h | 5 +-
src/util/vircgroupv2.h | 5 +-
src/util/virclosecallbacks.h | 6 +-
src/util/vircommand.h | 11 +-
src/util/vircommandpriv.h | 7 +-
src/util/virconf.h | 9 +-
src/util/vircrypto.h | 11 +-
src/util/virdbus.h | 22 ++-
src/util/virdbuspriv.h | 11 +-
src/util/virdevmapper.h | 5 +-
src/util/virdnsmasq.h | 20 ++-
src/util/virebtables.h | 7 +-
src/util/virendian.h | 19 +--
src/util/virenum.h | 11 +-
src/util/virerror.h | 41 +++--
src/util/virerrorpriv.h | 5 +-
src/util/virevent.h | 7 +-
src/util/vireventpoll.h | 8 +-
src/util/virfcp.h | 5 +-
src/util/virfdstream.h | 6 +-
src/util/virfile.h | 61 ++++----
src/util/virfilecache.h | 11 +-
src/util/virfirewall.h | 11 +-
src/util/virfirewalld.h | 7 +-
src/util/virfirewalldpriv.h | 7 +-
src/util/virfirewallpriv.h | 7 +-
src/util/virfirmware.h | 8 +-
src/util/virgettext.h | 5 +-
src/util/virgic.h | 9 +-
src/util/virhash.h | 8 +-
src/util/virhashcode.h | 7 +-
src/util/virhook.h | 7 +-
src/util/virhostcpu.h | 17 +--
src/util/virhostcpupriv.h | 11 +-
src/util/virhostdev.h | 19 +--
src/util/virhostmem.h | 7 +-
src/util/viridentity.h | 8 +-
src/util/virinitctl.h | 5 +-
src/util/viriptables.h | 9 +-
src/util/viriscsi.h | 7 +-
src/util/virjson.h | 15 +-
src/util/virkeycode.h | 9 +-
src/util/virkeyfile.h | 7 +-
src/util/virkmod.h | 6 +-
src/util/virlease.h | 7 +-
src/util/virlockspace.h | 9 +-
src/util/virlog.h | 55 ++++---
src/util/virmacaddr.h | 17 +--
src/util/virmacmap.h | 5 +-
src/util/virmdev.h | 15 +-
src/util/virmodule.h | 5 +-
src/util/virnetdev.h | 33 ++--
src/util/virnetdevbandwidth.h | 8 +-
src/util/virnetdevbridge.h | 8 +-
src/util/virnetdevip.h | 9 +-
src/util/virnetdevmacvlan.h | 22 ++-
src/util/virnetdevmidonet.h | 9 +-
src/util/virnetdevopenvswitch.h | 13 +-
src/util/virnetdevtap.h | 19 +--
src/util/virnetdevveth.h | 7 +-
src/util/virnetdevvlan.h | 11 +-
src/util/virnetdevvportprofile.h | 18 +--
src/util/virnetlink.h | 37 +++--
src/util/virnodesuspend.h | 7 +-
src/util/virnuma.h | 10 +-
src/util/virobject.h | 19 +--
src/util/virpci.h | 21 ++-
src/util/virperf.h | 11 +-
src/util/virpidfile.h | 9 +-
src/util/virpolkit.h | 11 +-
src/util/virportallocator.h | 9 +-
src/util/virprobe.h | 63 ++++----
src/util/virprocess.h | 15 +-
src/util/virqemu.h | 13 +-
src/util/virrandom.h | 7 +-
src/util/virresctrl.h | 12 +-
src/util/virresctrlpriv.h | 7 +-
src/util/virrotatingfile.h | 7 +-
src/util/virscsi.h | 11 +-
src/util/virscsihost.h | 7 +-
src/util/virscsivhost.h | 13 +-
src/util/virseclabel.h | 5 +-
src/util/virsecret.h | 12 +-
src/util/virsexpr.h | 9 +-
src/util/virsocketaddr.h | 45 +++---
src/util/virstorageencryption.h | 17 +--
src/util/virstoragefile.h | 31 ++--
src/util/virstoragefilebackend.h | 9 +-
src/util/virstring.h | 37 +++--
src/util/virsysinfo.h | 13 +-
src/util/virsysinfopriv.h | 5 +-
src/util/virsystemd.h | 7 +-
src/util/virsystemdpriv.h | 7 +-
src/util/virthread.h | 19 +--
src/util/virthreadjob.h | 6 +-
src/util/virthreadpool.h | 9 +-
src/util/virtime.h | 11 +-
src/util/virtpm.h | 5 +-
src/util/virtypedparam.h | 15 +-
src/util/viruri.h | 15 +-
src/util/virusb.h | 13 +-
src/util/virutil.h | 47 +++---
src/util/viruuid.h | 9 +-
src/util/virvhba.h | 7 +-
src/util/virvsock.h | 4 +-
src/util/virxdrdefs.h | 35 ++---
src/util/virxml.h | 33 ++--
src/vbox/vbox_MSCOMGlue.h | 11 +-
src/vbox/vbox_common.h | 161 ++++++++++----------
src/vbox/vbox_driver.h | 19 +--
src/vbox/vbox_get_driver.h | 7 +-
src/vbox/vbox_glue.h | 15 +-
src/vbox/vbox_snapshot_conf.h | 9 +-
src/vbox/vbox_uniformed_api.h | 11 +-
src/vmware/vmware_conf.h | 19 +--
src/vmware/vmware_driver.h | 5 +-
src/vmx/vmx.h | 21 ++-
src/vz/vz_driver.h | 5 +-
src/vz/vz_sdk.h | 9 +-
src/vz/vz_utils.h | 37 +++--
src/xenapi/xenapi_driver.h | 5 +-
src/xenapi/xenapi_driver_private.h | 17 +--
src/xenapi/xenapi_utils.h | 15 +-
src/xenconfig/xen_common.h | 17 +--
src/xenconfig/xen_sxpr.h | 13 +-
src/xenconfig/xen_xl.h | 11 +-
src/xenconfig/xen_xm.h | 9 +-
src/xenconfig/xenxs_private.h | 29 ++--
tests/qemumonitortestutils.h | 19 +--
tests/qemusecuritytest.h | 7 +-
tests/testutils.h | 45 +++---
tests/testutilshostcpus.h | 11 +-
tests/testutilslxc.h | 11 +-
tests/testutilsqemu.h | 21 ++-
tests/testutilsqemuschema.h | 11 +-
tests/testutilsxen.h | 13 +-
tests/virfilewrapper.h | 5 +-
tests/virhashdata.h | 5 +-
tests/virmock.h | 129 ++++++++--------
tests/virnettlshelpers.h | 17 +--
tools/nss/libvirt_nss.h | 27 ++--
tools/virsh-completer.h | 6 +-
tools/virsh-console.h | 11 +-
tools/virsh-domain-monitor.h | 7 +-
tools/virsh-domain.h | 7 +-
tools/virsh-host.h | 7 +-
tools/virsh-interface.h | 9 +-
tools/virsh-network.h | 9 +-
tools/virsh-nodedev.h | 7 +-
tools/virsh-nwfilter.h | 11 +-
tools/virsh-pool.h | 9 +-
tools/virsh-secret.h | 7 +-
tools/virsh-snapshot.h | 7 +-
tools/virsh-util.h | 11 +-
tools/virsh-volume.h | 9 +-
tools/virsh.h | 77 +++++-----
tools/virt-admin-completer.h | 6 +-
tools/virt-admin.h | 11 +-
tools/virt-host-validate-bhyve.h | 5 +-
tools/virt-host-validate-common.h | 13 +-
tools/virt-host-validate-lxc.h | 5 +-
tools/virt-host-validate-qemu.h | 5 +-
tools/vsh-table.h | 7 +-
tools/vsh.h | 87 +++++------
tools/wireshark/src/packet-libvirt.h | 5 +-
290 files changed, 1808 insertions(+), 2648 deletions(-)
--
2.20.1
5 years, 12 months
[libvirt] [PATCH] qemu: delete unused QEMUD_CPUMASK_LEN macro
by Ján Tomko
Unused as of:
commit f136b83139c63f20de0df3285d9e82df2fb97bfc
qemu: Rework setting process affinity
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_conf.h | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 983e74a3cf..9f2d652adc 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -49,14 +49,6 @@
# include "virfilecache.h"
# include "virfirmware.h"
-# ifdef CPU_SETSIZE /* Linux */
-# define QEMUD_CPUMASK_LEN CPU_SETSIZE
-# elif defined(_SC_NPROCESSORS_CONF) /* Cygwin */
-# define QEMUD_CPUMASK_LEN (sysconf(_SC_NPROCESSORS_CONF))
-# else
-# error "Port me"
-# endif
-
# define QEMU_DRIVER_NAME "QEMU"
typedef struct _virQEMUDriver virQEMUDriver;
--
2.19.2
5 years, 12 months
[libvirt] [RFC PATCH] docs: Use our own implementation for fetching the RSS data
by Martin Kletzander
This is just a small script I wrote. It works the same way as all the libraries
together which we are bundling, but with just JS. The only difference is that
the day of the date is formatted as 2-digit, but this should be a bug in
Firefox (at least locally for me) as the documentation states that type
'numeric' should actually not have leading zeros.
It will not be executed when the page is loaded locally.
It also uses the same proxy that query-rss uses. We can get rid of that, but
we'd either need to have our own proxy, send a sss header to allow fetching the
atom.xml or providing JSONP access to the RSS feed on virt-planet.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
docs/index.html.in | 13 ------------
docs/js/main.js | 49 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 14 deletions(-)
diff --git a/docs/index.html.in b/docs/index.html.in
index f593445d061d..fa75289cad0f 100644
--- a/docs/index.html.in
+++ b/docs/index.html.in
@@ -5,19 +5,6 @@
<script type="text/javascript" src="js/jquery-3.1.1.min.js"> </script>
<script type="text/javascript" src="js/moment.min.js"> </script>
<script type="text/javascript" src="js/jquery.rss.min.js"> </script>
-
- <script type="text/javascript">
- <!--
- jQuery(function($) {
- $("#planet").rss("http://planet.virt-tools.org/atom.xml", {
- ssl: true,
- layoutTemplate: '<dl>{entries}</dl>',
- entryTemplate: '<dt><a href="{url}">{title}</a></dt><dd>by {author} on {date}</li>',
- dateFormat: 'DD MMM YYYY'
- })
- })
- // -->
- </script>
</head>
<body class="index">
<h1>The virtualization API</h1>
diff --git a/docs/js/main.js b/docs/js/main.js
index e57b9f47ac11..668bf752b73d 100644
--- a/docs/js/main.js
+++ b/docs/js/main.js
@@ -28,7 +28,54 @@ function pageload() {
advancedSearch.className = "advancedsearch"
simpleSearch = document.getElementById("simplesearch")
- simplesearch.addEventListener("submit", advancedsearch)
+ simpleSearch.addEventListener("submit", advancedsearch)
+
+ docLoc = document.location;
+ if (docLoc.protocol != "file:" ||
+ docLoc.origin != "null" ||
+ docLoc.host !== "" ||
+ docLoc.hostname !== "") {
+ fetchRSS()
+ }
+}
+
+function fetchRSS() {
+ cb = "jsonpRSSFeedCallback"
+ window["jsonpRSSFeedCallback"] = function (data) {
+ if (data.responseStatus != 200)
+ return
+ entries = data.responseData.feed.entries
+ nEntries = Math.min(entries.length, 4)
+
+ dl = document.createElement('dl')
+
+ dateOpts = { day: 'numeric', month: 'short', year: 'numeric'}
+
+ for (i = 0; i < nEntries; i++) {
+ entry = entries[i]
+ a = document.createElement('a')
+ a.href = entry.link
+ a.innerText = entry.title
+
+ dt = document.createElement('dt')
+ dt.appendChild(a)
+ dl.appendChild(dt)
+
+ date = new Date(entry.publishedDate)
+ datestr = date.toLocaleDateString('default', dateOpts)
+
+ dd = document.createElement('dd')
+ dd.innerText = ` by ${entry.author} on ${datestr}`
+
+ dl.appendChild(dd)
+ }
+
+ planet.appendChild(dl);
+ };
+ script = document.createElement("script")
+ script.src = "https://feedrapp.herokuapp.com/"
+ script.src += `?q=http%3A%2F%2Fplanet.virt-tools.org%2Fatom.xml&callback=${cb}`
+ document.body.appendChild(script);
}
function advancedsearch(e) {
--
2.21.0
5 years, 12 months
[libvirt] [PATCH] remote: drop code for migrating config files from pre-XDG dir layout
by Daniel P. Berrangé
The unprivileged libvirtd daemon switched to use the XDG dir layout in
the 0.9.13 release, and included code for moving config files from the
old location. The chances of someone upgrading libvirt from <= 0.9.12
directly to libvirt >= 5.5.0 is close enough to zero that we can
reasonably drop the back compat code.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/remote/remote_daemon.c | 79 --------------------------------------
1 file changed, 79 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index c3782971f1..c1544ba914 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -845,79 +845,6 @@ static int daemonStateInit(virNetDaemonPtr dmn)
return 0;
}
-static int migrateProfile(void)
-{
- char *old_base = NULL;
- char *updated = NULL;
- char *home = NULL;
- char *xdg_dir = NULL;
- char *config_dir = NULL;
- const char *config_home;
- int ret = -1;
- mode_t old_umask;
-
- VIR_DEBUG("Checking if user profile needs migrating");
-
- if (!(home = virGetUserDirectory()))
- goto cleanup;
-
- if (virAsprintf(&old_base, "%s/.libvirt", home) < 0)
- goto cleanup;
-
- /* if the new directory is there or the old one is not: do nothing */
- if (!(config_dir = virGetUserConfigDirectory()))
- goto cleanup;
-
- if (!virFileIsDir(old_base) || virFileExists(config_dir)) {
- VIR_DEBUG("No old profile in '%s' / "
- "new profile directory already present '%s'",
- old_base, config_dir);
- ret = 0;
- goto cleanup;
- }
-
- /* test if we already attempted to migrate first */
- if (virAsprintf(&updated, "%s/DEPRECATED-DIRECTORY", old_base) < 0)
- goto cleanup;
- if (virFileExists(updated))
- goto cleanup;
-
- config_home = virGetEnvBlockSUID("XDG_CONFIG_HOME");
- if (config_home && config_home[0] != '\0') {
- if (VIR_STRDUP(xdg_dir, config_home) < 0)
- goto cleanup;
- } else {
- if (virAsprintf(&xdg_dir, "%s/.config", home) < 0)
- goto cleanup;
- }
-
- old_umask = umask(077);
- if (virFileMakePath(xdg_dir) < 0) {
- umask(old_umask);
- goto cleanup;
- }
- umask(old_umask);
-
- if (rename(old_base, config_dir) < 0) {
- int fd = creat(updated, 0600);
- VIR_FORCE_CLOSE(fd);
- VIR_ERROR(_("Unable to migrate %s to %s"), old_base, config_dir);
- goto cleanup;
- }
-
- VIR_DEBUG("Profile migrated from %s to %s", old_base, config_dir);
- ret = 0;
-
- cleanup:
- VIR_FREE(home);
- VIR_FREE(old_base);
- VIR_FREE(xdg_dir);
- VIR_FREE(config_dir);
- VIR_FREE(updated);
-
- return ret;
-}
-
static int
daemonSetupHostUUID(const struct daemonConfig *config)
{
@@ -1162,12 +1089,6 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- if (!privileged &&
- migrateProfile() < 0) {
- VIR_ERROR(_("Exiting due to failure to migrate profile"));
- exit(EXIT_FAILURE);
- }
-
if (daemonSetupHostUUID(config) < 0) {
VIR_ERROR(_("Can't setup host uuid"));
exit(EXIT_FAILURE);
--
2.21.0
5 years, 12 months
[libvirt] [python PATCH] Add support for virNetworkPort object & APIs
by Daniel P. Berrangé
Define the various rules in the generator to wire up methods into the
virNetwork class and create the new virNetworkPort class.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
generator.py | 25 +++++++++-
libvirt-override-api.xml | 13 ++++++
libvirt-override.c | 99 ++++++++++++++++++++++++++++++++++++++++
typewrappers.c | 13 ++++++
typewrappers.h | 10 ++++
5 files changed, 158 insertions(+), 2 deletions(-)
diff --git a/generator.py b/generator.py
index ffa3ce5..ab5144d 100755
--- a/generator.py
+++ b/generator.py
@@ -328,6 +328,10 @@ py_types = {
'virNetwork *': ('O', "virNetwork", "virNetworkPtr", "virNetworkPtr"),
'const virNetwork *': ('O', "virNetwork", "virNetworkPtr", "virNetworkPtr"),
+ 'virNetworkPortPtr': ('O', "virNetworkPort", "virNetworkPortPtr", "virNetworkPortPtr"),
+ 'virNetworkPort *': ('O', "virNetworkPort", "virNetworkPortPtr", "virNetworkPortPtr"),
+ 'const virNetworkPort *': ('O', "virNetworkPort", "virNetworkPortPtr", "virNetworkPortPtr"),
+
'virInterfacePtr': ('O', "virInterface", "virInterfacePtr", "virInterfacePtr"),
'virInterface *': ('O', "virInterface", "virInterfacePtr", "virInterfacePtr"),
'const virInterface *': ('O', "virInterface", "virInterfacePtr", "virInterfacePtr"),
@@ -496,6 +500,8 @@ skip_impl = (
'virConnectBaselineHypervisorCPU',
'virDomainGetLaunchSecurityInfo',
'virNodeGetSEVInfo',
+ 'virNetworkPortGetParameters',
+ 'virNetworkPortSetParameters',
)
lxc_skip_impl = (
@@ -541,6 +547,7 @@ skip_function = (
'virConnectListAllStoragePools', # overridden in virConnect.py
'virStoragePoolListAllVolumes', # overridden in virStoragePool.py
'virConnectListAllNetworks', # overridden in virConnect.py
+ 'virNetworkListAllPorts', # overridden in virConnect.py
'virConnectListAllInterfaces', # overridden in virConnect.py
'virConnectListAllNodeDevices', # overridden in virConnect.py
'virConnectListAllNWFilters', # overridden in virConnect.py
@@ -575,6 +582,7 @@ skip_function = (
"virDomainRef",
"virInterfaceRef",
"virNetworkRef",
+ "virNetworkPortRef",
"virNodeDeviceRef",
"virSecretRef",
"virNWFilterRef",
@@ -590,6 +598,7 @@ skip_function = (
"virDomainGetConnect",
"virInterfaceGetConnect",
"virNetworkGetConnect",
+ "virNetworkPortGetNetwork",
"virSecretGetConnect",
"virNWFilterGetConnect",
"virStoragePoolGetConnect",
@@ -1005,6 +1014,8 @@ classes_type = {
"virDomain *": ("._o", "virDomain(self, _obj=%s)", "virDomain"),
"virNetworkPtr": ("._o", "virNetwork(self, _obj=%s)", "virNetwork"),
"virNetwork *": ("._o", "virNetwork(self, _obj=%s)", "virNetwork"),
+ "virNetworkPortPtr": ("._o", "virNetworkPort(self, _obj=%s)", "virNetworkPort"),
+ "virNetworkPort *": ("._o", "virNetworkPort(self, _obj=%s)", "virNetworkPort"),
"virInterfacePtr": ("._o", "virInterface(self, _obj=%s)", "virInterface"),
"virInterface *": ("._o", "virInterface(self, _obj=%s)", "virInterface"),
"virStoragePoolPtr": ("._o", "virStoragePool(self, _obj=%s)", "virStoragePool"),
@@ -1027,8 +1038,8 @@ classes_type = {
"virDomainSnapshot *": ("._o", "virDomainSnapshot(self, _obj=%s)", "virDomainSnapshot"),
}
-primary_classes = ["virDomain", "virNetwork", "virInterface",
- "virStoragePool", "virStorageVol",
+primary_classes = ["virDomain", "virNetwork", "virNetworkPort",
+ "virInterface", "virStoragePool", "virStorageVol",
"virConnect", "virNodeDevice", "virSecret",
"virNWFilter", "virNWFilterBinding",
"virStream", "virDomainSnapshot"]
@@ -1036,6 +1047,7 @@ primary_classes = ["virDomain", "virNetwork", "virInterface",
classes_destructors = {
"virDomain": "virDomainFree",
"virNetwork": "virNetworkFree",
+ "virNetworkPort": "virNetworkPortFree",
"virInterface": "virInterfaceFree",
"virStoragePool": "virStoragePoolFree",
"virStorageVol": "virStorageVolFree",
@@ -1111,6 +1123,12 @@ def nameFixup(name, classe, type, file):
elif name[0:16] == "virNetworkLookup":
func = name[3:]
func = func[0:1].lower() + func[1:]
+ elif name[0:23] == "virNetworkPortCreateXML":
+ func = name[10:]
+ func = func[0:1].lower() + func[1:]
+ elif name[0:20] == "virNetworkPortLookup":
+ func = name[10:]
+ func = func[0:1].lower() + func[1:]
elif name[0:18] == "virInterfaceDefine":
func = name[3:]
func = func[0:1].lower() + func[1:]
@@ -1199,6 +1217,9 @@ def nameFixup(name, classe, type, file):
func = name[13:]
func = func[0:1].lower() + func[1:]
func = func.replace("dHCP", "DHCP")
+ elif name[0:14] == "virNetworkPort":
+ func = name[14:]
+ func = func[0:1].lower() + func[1:]
elif name[0:10] == "virNetwork":
func = name[10:]
func = func[0:1].lower() + func[1:]
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 53b15c5..6e29c1e 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -764,5 +764,18 @@
<arg name='virttype' type='const char *' info='optional virtualization type'/>
<arg name='flags' type='int' info='unused, always pass 0'/>
</function>
+ <function name='virNetworkPortSetParameters' file='python'>
+ <info>Change the port tunables</info>
+ <return type='int' info='-1 in case of error, 0 in case of success.'/>
+ <arg name='port' type='virNetworkPortPtr' info='pointer to network port object'/>
+ <arg name='params' type='virTypedParameterPtr' info='pointer to tunable objects'/>
+ <arg name='flags' type='int' info='unused, always pass 0'/>
+ </function>
+ <function name='virNetworkPortGetParameters' file='python'>
+ <info>Get the port parameters</info>
+ <return type='char *' info='None in case of error, returns a dictionary of params'/>
+ <arg name='port' type='virNetworkPortPtr' info='pointer to network port object'/>
+ <arg name='flags' type='int' info='unused, always pass 0'/>
+ </function>
</symbols>
</api>
diff --git a/libvirt-override.c b/libvirt-override.c
index c5e2908..a940730 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -9945,6 +9945,101 @@ libvirt_virNodeGetSEVInfo(PyObject *self ATTRIBUTE_UNUSED,
}
#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
+#if LIBVIR_CHECK_VERSION(5, 5, 0)
+static PyObject *
+libvirt_virNetworkPortSetParameters(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virNetworkPortPtr port;
+ PyObject *pyobj_port, *info;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0;
+ Py_ssize_t size = 0;
+ unsigned int flags;
+ virTypedParameterPtr params = NULL, new_params = NULL;
+
+ if (!PyArg_ParseTuple(args,
+ (char *)"OOI:virNetworkPortSetParameters",
+ &pyobj_port, &info, &flags))
+ return NULL;
+ port = (virNetworkPortPtr) PyvirNetworkPort_Get(pyobj_port);
+
+ if ((size = PyDict_Size(info)) < 0)
+ return NULL;
+
+ if (size == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Need non-empty dictionary to set attributes");
+ return NULL;
+ }
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virNetworkPortGetParameters(port, ¶ms, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0)
+ return VIR_PY_INT_FAIL;
+
+ if (nparams == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Port has no settable attributes");
+ return NULL;
+ }
+
+ new_params = setPyVirTypedParameter(info, params, nparams);
+ if (!new_params)
+ goto cleanup;
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virNetworkPortSetParameters(port, new_params, size, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ ret = VIR_PY_INT_SUCCESS;
+
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ virTypedParamsFree(new_params, size);
+ return ret;
+}
+
+static PyObject *
+libvirt_virNetworkPortGetParameters(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *pyobj_port;
+ virNetworkPortPtr port;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ PyObject *dict = NULL;
+ unsigned int flags;
+ int rc;
+
+ if (!PyArg_ParseTuple(args, (char *) "OI:virNetworkPortGetParameters",
+ &pyobj_port, &flags))
+ return NULL;
+ port = (virNetworkPortPtr) PyvirNetworkPort_Get(pyobj_port);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ rc = virNetworkPortGetParameters(port, ¶ms, &nparams, flags);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (rc < 0)
+ return VIR_PY_NONE;
+
+ if (!(dict = getPyVirTypedParameter(params, nparams)))
+ goto cleanup;
+
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ return dict;
+}
+#endif /* LIBVIR_CHECK_VERSION(5, 5, 0) */
/************************************************************************
* *
@@ -10192,6 +10287,10 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetLaunchSecurityInfo", libvirt_virDomainGetLaunchSecurityInfo, METH_VARARGS, NULL},
{(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS, NULL},
#endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */
+#if LIBVIR_CHECK_VERSION(4, 5, 0)
+ {(char *) "virNetworkPortSetParameters", libvirt_virNetworkPortSetParameters, METH_VARARGS, NULL},
+ {(char *) "virNetworkPortGetParameters", libvirt_virNetworkPortGetParameters, METH_VARARGS, NULL},
+#endif /* LIBVIR_CHECK_VERSION(5, 5, 0) */
{NULL, NULL, 0, NULL}
};
diff --git a/typewrappers.c b/typewrappers.c
index 9ba14b4..5710744 100644
--- a/typewrappers.c
+++ b/typewrappers.c
@@ -451,6 +451,19 @@ libvirt_virNetworkPtrWrap(virNetworkPtr node)
return ret;
}
+PyObject *
+libvirt_virNetworkPortPtrWrap(virNetworkPortPtr node)
+{
+ PyObject *ret;
+
+ if (node == NULL) {
+ return VIR_PY_NONE;
+ }
+
+ ret = libvirt_buildPyObject(node, "virNetworkPortPtr", NULL);
+ return ret;
+}
+
PyObject *
libvirt_virInterfacePtrWrap(virInterfacePtr node)
{
diff --git a/typewrappers.h b/typewrappers.h
index 4423774..e4983b2 100644
--- a/typewrappers.h
+++ b/typewrappers.h
@@ -58,6 +58,15 @@ typedef struct {
} PyvirNetwork_Object;
+#define PyvirNetworkPort_Get(v) (((v) == Py_None) ? NULL : \
+ (((PyvirNetworkPort_Object *)(v))->obj))
+
+typedef struct {
+ PyObject_HEAD
+ virNetworkPortPtr obj;
+} PyvirNetworkPort_Object;
+
+
#define PyvirInterface_Get(v) (((v) == Py_None) ? NULL : \
(((PyvirInterface_Object *)(v))->obj))
@@ -192,6 +201,7 @@ int libvirt_charPtrSizeUnwrap(PyObject *obj, char **str, Py_ssize_t *size);
PyObject * libvirt_virConnectPtrWrap(virConnectPtr node);
PyObject * libvirt_virDomainPtrWrap(virDomainPtr node);
PyObject * libvirt_virNetworkPtrWrap(virNetworkPtr node);
+PyObject * libvirt_virNetworkPortPtrWrap(virNetworkPortPtr node);
PyObject * libvirt_virInterfacePtrWrap(virInterfacePtr node);
PyObject * libvirt_virStoragePoolPtrWrap(virStoragePoolPtr node);
PyObject * libvirt_virStorageVolPtrWrap(virStorageVolPtr node);
--
2.21.0
5 years, 12 months
[libvirt] [PATCHv3 0/5] Implement debugcon chardev
by Ján Tomko
v2: https://www.redhat.com/archives/libvir-list/2019-February/msg00293.html
v3:
* dropped the pointless isa-prefix
* use DO_TEST_CAPS_LATEST
* trimmed the XML
* compiles with gcc
* only make irq optional
* autofill iobase
Ján Tomko (3):
qemu: introduce qemuDomainChrSerialTargetModel
qemu: make irq optional when formatting the ISA address
qemu: autoadd iobase to debugcon chardev
Nikolay Shirokovskiy (2):
conf: add debugcon chardev guest interface
qemu: implement debugcon chardev
docs/formatdomain.html.in | 3 +-
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 5 ++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 25 +++++++++++++---
src/qemu/qemu_domain.c | 12 ++++++++
.../isa-serial-debugcon.x86_64-latest.args | 30 +++++++++++++++++++
.../qemuxml2argvdata/isa-serial-debugcon.xml | 21 +++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../isa-serial-debugcon.xml | 30 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 ++
11 files changed, 126 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/isa-serial-debugcon.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/isa-serial-debugcon.xml
create mode 100644 tests/qemuxml2xmloutdata/isa-serial-debugcon.xml
--
2.19.2
5 years, 12 months
[libvirt] [PATCH] test_driver: implement virDomainSendProcessSignal
by Ilias Stamatis
Only succeed when @pid_value is 1, since according to the docs this is
the minimum requirement for any driver to implement this API.
>From man 2 kill:
The only signals that can be sent to process ID 1, the init process, are
those for which init has explicitly installed signal handlers.
Regarding sending SIGTERM and SIGKILL to init, the test driver domains
pretend to run Linux, and on Linux init/systemd explicitly ignores these
signals.
Correspondingly, we can assume that no signal handlers are installed for
any other signal and succeed by doing nothing.
Signed-off-by: Ilias Stamatis <stamatis.iliass(a)gmail.com>
---
Alternatively, we could succeed when @pid_value is any number or belongs
to a set of specific numbers.
src/test/test_driver.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
mode change 100644 => 100755 src/test/test_driver.c
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
old mode 100644
new mode 100755
index cae2521b21..490a605a77
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2825,6 +2825,40 @@ static int testDomainSetMetadata(virDomainPtr dom,
return ret;
}
+static int
+testDomainSendProcessSignal(virDomainPtr dom,
+ long long pid_value,
+ unsigned int signum,
+ unsigned int flags)
+{
+ int ret = -1;
+ virDomainObjPtr vm = NULL;
+
+ virCheckFlags(0, -1);
+
+ if (pid_value != 1) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("only sending a signal to pid 1 is supported"));
+ return -1;
+ }
+
+ if (signum >= VIR_DOMAIN_PROCESS_SIGNAL_LAST) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("signum value %d is out of range"),
+ signum);
+ return -1;
+ }
+
+ if (!(vm = testDomObjFromDomain(dom)))
+ goto cleanup;
+
+ /* do nothing */
+ ret = 0;
+
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
static int testNodeGetCellsFreeMemory(virConnectPtr conn,
unsigned long long *freemems,
@@ -7027,6 +7061,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainScreenshot = testDomainScreenshot, /* 1.0.5 */
.domainGetMetadata = testDomainGetMetadata, /* 1.1.3 */
.domainSetMetadata = testDomainSetMetadata, /* 1.1.3 */
+ .domainSendProcessSignal = testDomainSendProcessSignal, /* 5.5.0 */
.connectGetCPUModelNames = testConnectGetCPUModelNames, /* 1.1.3 */
.domainManagedSave = testDomainManagedSave, /* 1.1.4 */
.domainHasManagedSaveImage = testDomainHasManagedSaveImage, /* 1.1.4 */
--
2.21.0
5 years, 12 months