[libvirt PATCH] qemu: Fix crash at the end of migration
by Jiri Denemark
The destination daemon would crash in Finish phase due to NULL
dereference which I missed in my review of commit
v8.0.0-428-g0301db44e2.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index fea5e71f4d..5aecdddff0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5855,7 +5855,7 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
if (jobData) {
priv->job.completed = g_steal_pointer(&jobData);
priv->job.completed->status = VIR_DOMAIN_JOB_STATUS_COMPLETED;
- qemuDomainJobSetStatsType(jobData,
+ qemuDomainJobSetStatsType(priv->job.completed,
QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION);
}
--
2.35.1
2 years, 8 months
[libvirt PATCH v2] util: drop support for obsolete systemd in RHEL-7
by Daniel P. Berrangé
The systemd version in RHEL-7 lacked support for the LISTEN_FDNAMES env
variable with socket activation. Since we stopped targetting RHEL-7 we
can drop some considerable amount of compatibility code.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/daemons.rst | 26 -------
src/locking/lock_daemon.c | 8 +-
src/logging/log_daemon.c | 8 +-
src/remote/libvirtd-admin.socket.in | 2 -
src/remote/libvirtd-ro.socket.in | 2 -
src/remote/libvirtd-tcp.socket.in | 2 -
src/remote/libvirtd-tls.socket.in | 2 -
src/remote/libvirtd.conf.in | 6 +-
src/remote/libvirtd.socket.in | 2 -
src/remote/remote_daemon.c | 19 +----
src/util/virsystemd.c | 117 +++-------------------------
src/util/virsystemd.h | 15 +---
tests/virsystemdtest.c | 38 +--------
13 files changed, 21 insertions(+), 226 deletions(-)
diff --git a/docs/daemons.rst b/docs/daemons.rst
index c3970eb89c..383f0f64ff 100644
--- a/docs/daemons.rst
+++ b/docs/daemons.rst
@@ -209,13 +209,6 @@ controlled via the system unit files
``libvirtd.socket``, ``libvirtd-ro.socket`` and ``libvirtd-admin.socket`` unit
files.
-Systemd releases prior to version 227 lacked support for passing the activation
-socket unit names into the service. When using these old versions, the
-``tcp_port``, ``tls_port`` and ``unix_sock_dir`` settings in ``libvirtd.conf``
-must be changed in lock-step with the equivalent settings in the unit files to
-ensure that ``libvirtd`` can identify the sockets.
-
-
Modular driver daemons
======================
@@ -354,13 +347,6 @@ controlled via the system unit files:
``virt${DRIVER}d.socket``, ``virt${DRIVER}d-ro.socket`` and
``virt${DRIVER}d-admin.socket`` unit files.
-Systemd releases prior to version 227 lacked support for passing the activation
-socket unit names into the service. When using these old versions, the
-``unix_sock_dir`` setting in ``virt${DRIVER}d.conf`` must be changed in
-lock-step with the equivalent setting in the unit files to ensure that
-``virt${DRIVER}d`` can identify the sockets.
-
-
Switching to modular daemons
----------------------------
@@ -639,12 +625,6 @@ controlled via the system unit files:
independently controlled via the ``ListenStream`` parameter in any of the
``virtlogd.socket`` and ``virtlogd-admin.socket`` unit files.
-Systemd releases prior to version 227 lacked support for passing the activation
-socket unit names into the service. When using these old versions, the
-``unix_sock_dir`` setting in ``virtlogd.conf`` must be changed in
-lock-step with the equivalent setting in the unit files to ensure that
-``virtlogd`` can identify the sockets.
-
Locking daemon
==============
@@ -733,12 +713,6 @@ controlled via the system unit files:
independently controlled via the ``ListenStream`` parameter in any of the
``virtlockd.socket`` and ``virtlockd-admin.socket`` unit files.
-Systemd releases prior to version 227 lacked support for passing the activation
-socket unit names into the service. When using these old versions, the
-``unix_sock_dir`` setting in ``virtlockd.conf`` must be changed in
-lock-step with the equivalent setting in the unit files to ensure that
-``virtlockd`` can identify the sockets.
-
Changing command line options for daemons
=========================================
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index b44649bfbe..178e8cf830 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -986,10 +986,6 @@ int main(int argc, char **argv) {
* saved state is present, therefore initialize from scratch here. */
if (rv == 0) {
g_autoptr(virSystemdActivation) act = NULL;
- virSystemdActivationMap actmap[] = {
- { .name = "virtlockd.socket", .family = AF_UNIX, .path = sock_file },
- { .name = "virtlockd-admin.socket", .family = AF_UNIX, .path = admin_sock_file },
- };
if (godaemon) {
if (chdir("/") < 0) {
@@ -1016,9 +1012,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
- if (virSystemdGetActivation(actmap,
- G_N_ELEMENTS(actmap),
- &act) < 0) {
+ if (virSystemdGetActivation(&act) < 0) {
ret = VIR_DAEMON_ERR_NETWORK;
goto cleanup;
}
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 245df9dbbd..82f625142b 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -794,10 +794,6 @@ int main(int argc, char **argv) {
*/
if (rv == 0) {
g_autoptr(virSystemdActivation) act = NULL;
- virSystemdActivationMap actmap[] = {
- { .name = "virtlogd.socket", .family = AF_UNIX, .path = sock_file },
- { .name = "virtlogd-admin.socket", .family = AF_UNIX, .path = admin_sock_file },
- };
if (godaemon) {
if (chdir("/") < 0) {
@@ -824,9 +820,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
- if (virSystemdGetActivation(actmap,
- G_N_ELEMENTS(actmap),
- &act) < 0) {
+ if (virSystemdGetActivation(&act) < 0) {
ret = VIR_DAEMON_ERR_NETWORK;
goto cleanup;
}
diff --git a/src/remote/libvirtd-admin.socket.in b/src/remote/libvirtd-admin.socket.in
index 4129abc1ab..01e1a08939 100644
--- a/src/remote/libvirtd-admin.socket.in
+++ b/src/remote/libvirtd-admin.socket.in
@@ -6,8 +6,6 @@ After=@service@.socket
@deps@
[Socket]
-# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
-# when using systemd version < 227
ListenStream=@runstatedir@/libvirt/@sockprefix@-admin-sock
Service=@service@.service
SocketMode=0600
diff --git a/src/remote/libvirtd-ro.socket.in b/src/remote/libvirtd-ro.socket.in
index cb5e6bd60f..58ae1beb95 100644
--- a/src/remote/libvirtd-ro.socket.in
+++ b/src/remote/libvirtd-ro.socket.in
@@ -6,8 +6,6 @@ After=@service@.socket
@deps@
[Socket]
-# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
-# when using systemd version < 227
ListenStream=@runstatedir@/libvirt/@sockprefix@-sock-ro
Service=@service@.service
SocketMode=0666
diff --git a/src/remote/libvirtd-tcp.socket.in b/src/remote/libvirtd-tcp.socket.in
index dd60317d47..6949df315e 100644
--- a/src/remote/libvirtd-tcp.socket.in
+++ b/src/remote/libvirtd-tcp.socket.in
@@ -6,8 +6,6 @@ After=@service@.socket
@deps@
[Socket]
-# This must match the @sysconfdir@/libvirt/@service@.conf tcp_port setting
-# when using systemd version < 227
ListenStream=16509
Service=@service@.service
diff --git a/src/remote/libvirtd-tls.socket.in b/src/remote/libvirtd-tls.socket.in
index 8b89737fff..ada2b871f0 100644
--- a/src/remote/libvirtd-tls.socket.in
+++ b/src/remote/libvirtd-tls.socket.in
@@ -6,8 +6,6 @@ After=@service@.socket
@deps@
[Socket]
-# This must match the @sysconfdir@/libvirt/@service@.conf tls_port setting
-# when using systemd version < 227
ListenStream=16514
Service=@service@.service
diff --git a/src/remote/libvirtd.conf.in b/src/remote/libvirtd.conf.in
index 2cd20aaa7f..defe6b83d0 100644
--- a/src/remote/libvirtd.conf.in
+++ b/src/remote/libvirtd.conf.in
@@ -40,7 +40,7 @@
# This can be a port number, or service name
#
# This setting is not required or honoured if using systemd socket
-# activation with systemd version >= 227
+# activation.
#
#tls_port = "16514"
@@ -48,7 +48,7 @@
# This can be a port number, or service name
#
# This setting is not required or honoured if using systemd socket
-# activation with systemd version >= 227
+# activation.
#
#tcp_port = "16509"
@@ -117,7 +117,7 @@
# Set the name of the directory in which sockets will be found/created.
#
# This setting is not required or honoured if using systemd socket
-# activation with systemd version >= 227
+# activation.
#
#unix_sock_dir = "@runstatedir@/libvirt"
diff --git a/src/remote/libvirtd.socket.in b/src/remote/libvirtd.socket.in
index 0f349656f5..4842712648 100644
--- a/src/remote/libvirtd.socket.in
+++ b/src/remote/libvirtd.socket.in
@@ -4,8 +4,6 @@ Before=@service@.service
@deps@
[Socket]
-# The directory must match the @sysconfdir@/libvirt/@service@.conf unix_sock_dir setting
-# when using systemd version < 227
ListenStream=@runstatedir@/libvirt/@sockprefix@-sock
Service=@service@.service
SocketMode=@mode@
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 1b8e982a2f..26469e0d9f 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -214,25 +214,8 @@ daemonSetupNetworking(virNetServer *srv,
unsigned int tcp_min_ssf = 0;
#endif /* !WITH_SASL */
g_autoptr(virSystemdActivation) act = NULL;
- virSystemdActivationMap actmap[] = {
- { .name = DAEMON_NAME ".socket", .family = AF_UNIX, .path = sock_path },
- { .name = DAEMON_NAME "-ro.socket", .family = AF_UNIX, .path = sock_path_ro },
- { .name = DAEMON_NAME "-admin.socket", .family = AF_UNIX, .path = sock_path_adm },
-#ifdef WITH_IP
- { .name = DAEMON_NAME "-tcp.socket", .family = AF_INET },
- { .name = DAEMON_NAME "-tls.socket", .family = AF_INET },
-#endif /* ! WITH_IP */
- };
-
-#ifdef WITH_IP
- if ((actmap[3].port = virSocketAddrResolveService(config->tcp_port)) < 0)
- return -1;
-
- if ((actmap[4].port = virSocketAddrResolveService(config->tls_port)) < 0)
- return -1;
-#endif /* ! WITH_IP */
- if (virSystemdGetActivation(actmap, G_N_ELEMENTS(actmap), &act) < 0)
+ if (virSystemdGetActivation(&act) < 0)
return -1;
#ifdef WITH_IP
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index a86d4c6bb9..c95b6c93d3 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -788,98 +788,6 @@ virSystemdActivationInitFromNames(virSystemdActivation *act,
}
-/*
- * Back compat for systemd < v227 which lacks LISTEN_FDNAMES.
- * Delete when min systemd is increased ie RHEL7 dropped
- */
-static int
-virSystemdActivationInitFromMap(virSystemdActivation *act,
- int nfds,
- virSystemdActivationMap *map,
- size_t nmap)
-{
- int nextfd = STDERR_FILENO + 1;
- size_t i;
-
- while (nfds) {
- virSocketAddr addr;
- const char *name = NULL;
-
- memset(&addr, 0, sizeof(addr));
-
- addr.len = sizeof(addr.data);
- if (getsockname(nextfd, &addr.data.sa, &addr.len) < 0) {
- virReportSystemError(errno, "%s", _("Unable to get local socket name"));
- goto error;
- }
-
- VIR_DEBUG("Got socket family %d for FD %d",
- addr.data.sa.sa_family, nextfd);
-
- for (i = 0; i < nmap && !name; i++) {
- if (map[i].name == NULL)
- continue;
-
- if (addr.data.sa.sa_family == AF_INET) {
- if (map[i].family == AF_INET) {
- VIR_DEBUG("Expect %d got %d",
- map[i].port, ntohs(addr.data.inet4.sin_port));
- if (addr.data.inet4.sin_port == htons(map[i].port))
- name = map[i].name;
- }
- } else if (addr.data.sa.sa_family == AF_INET6) {
- /* NB use of AF_INET here is correct. The "map" struct
- * only refers to AF_INET. The socket may be AF_INET
- * or AF_INET6
- */
- if (map[i].family == AF_INET) {
- VIR_DEBUG("Expect %d got %d",
- map[i].port, ntohs(addr.data.inet6.sin6_port));
- if (addr.data.inet6.sin6_port == htons(map[i].port))
- name = map[i].name;
- }
-#ifndef WIN32
- } else if (addr.data.sa.sa_family == AF_UNIX) {
- if (map[i].family == AF_UNIX) {
- VIR_DEBUG("Expect %s got %s", map[i].path, addr.data.un.sun_path);
- if (STREQLEN(map[i].path,
- addr.data.un.sun_path,
- sizeof(addr.data.un.sun_path)))
- name = map[i].name;
- }
-#endif
- } else {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unexpected socket family %d"),
- addr.data.sa.sa_family);
- goto error;
- }
- }
-
- if (!name) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Cannot find name for FD %d socket family %d"),
- nextfd, addr.data.sa.sa_family);
- goto error;
- }
-
- if (virSystemdActivationAddFD(act, name, nextfd) < 0)
- goto error;
-
- nfds--;
- nextfd++;
- }
-
- return 0;
-
- error:
- for (i = 0; i < nfds; i++) {
- int fd = nextfd + i;
- VIR_FORCE_CLOSE(fd);
- }
- return -1;
-}
-
#ifndef WIN32
/**
@@ -954,9 +862,7 @@ virSystemdGetListenFDs(void)
#endif /* WIN32 */
static virSystemdActivation *
-virSystemdActivationNew(virSystemdActivationMap *map,
- size_t nmap,
- int nfds)
+virSystemdActivationNew(int nfds)
{
g_autoptr(virSystemdActivation) act = g_new0(virSystemdActivation, 1);
const char *fdnames;
@@ -966,14 +872,15 @@ virSystemdActivationNew(virSystemdActivationMap *map,
act->fds = virHashNew(virSystemdActivationEntryFree);
fdnames = getenv("LISTEN_FDNAMES");
- if (fdnames) {
- if (virSystemdActivationInitFromNames(act, nfds, fdnames) < 0)
- return NULL;
- } else {
- if (virSystemdActivationInitFromMap(act, nfds, map, nmap) < 0)
- return NULL;
+ if (!fdnames) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing LISTEN_FDNAMES env from systemd socket activation"));
+ return NULL;
}
+ if (virSystemdActivationInitFromNames(act, nfds, fdnames) < 0)
+ return NULL;
+
VIR_DEBUG("Created activation object for %d FDs", nfds);
return g_steal_pointer(&act);
}
@@ -981,8 +888,6 @@ virSystemdActivationNew(virSystemdActivationMap *map,
/**
* virSystemdGetActivation:
- * @map: mapping of socket addresses to names
- * @nmap: number of entries in @map
* @act: filled with allocated activation object
*
* Acquire an object for handling systemd activation.
@@ -995,9 +900,7 @@ virSystemdActivationNew(virSystemdActivationMap *map,
* Returns: 0 on success, -1 on failure
*/
int
-virSystemdGetActivation(virSystemdActivationMap *map,
- size_t nmap,
- virSystemdActivation **act)
+virSystemdGetActivation(virSystemdActivation **act)
{
int nfds = 0;
@@ -1010,7 +913,7 @@ virSystemdGetActivation(virSystemdActivationMap *map,
return 0;
}
- *act = virSystemdActivationNew(map, nmap, nfds);
+ *act = virSystemdActivationNew(nfds);
return 0;
}
diff --git a/src/util/virsystemd.h b/src/util/virsystemd.h
index 93320e40b9..19fb714132 100644
--- a/src/util/virsystemd.h
+++ b/src/util/virsystemd.h
@@ -25,17 +25,6 @@
typedef struct _virSystemdActivation virSystemdActivation;
-/*
- * Back compat for systemd < v227 which lacks LISTEN_FDNAMES.
- * Delete when min systemd is increased ie RHEL7 dropped
- */
-typedef struct _virSystemdActivationMap {
- const char *name;
- int family;
- int port; /* if family == AF_INET/AF_INET6 */
- const char *path; /* if family == AF_UNIX */
-} virSystemdActivationMap;
-
char *virSystemdMakeScopeName(const char *name,
const char *drivername,
bool legacy_behaviour);
@@ -70,9 +59,7 @@ char *virSystemdGetMachineNameByPID(pid_t pid);
char *virSystemdGetMachineUnitByPID(pid_t pid);
-int virSystemdGetActivation(virSystemdActivationMap *map,
- size_t nmap,
- virSystemdActivation **act);
+int virSystemdGetActivation(virSystemdActivation **act);
bool virSystemdActivationHasName(virSystemdActivation *act,
const char *name);
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 9a063dd1fc..9b513697e0 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -513,7 +513,7 @@ testActivationCreateFDs(virNetSocket **sockUNIX,
static int
-testActivation(bool useNames)
+testActivationFDNames(const void *opaque G_GNUC_UNUSED)
{
virNetSocket *sockUNIX;
virNetSocket **sockIP;
@@ -522,7 +522,6 @@ testActivation(bool useNames)
size_t i;
char nfdstr[VIR_INT64_STR_BUFLEN];
char pidstr[VIR_INT64_STR_BUFLEN];
- virSystemdActivationMap map[2];
int *fds = NULL;
size_t nfds = 0;
g_autoptr(virSystemdActivation) act = NULL;
@@ -544,21 +543,9 @@ testActivation(bool useNames)
g_setenv("LISTEN_FDS", nfdstr, TRUE);
g_setenv("LISTEN_PID", pidstr, TRUE);
+ g_setenv("LISTEN_FDNAMES", virBufferCurrentContent(&names), TRUE);
- if (useNames)
- g_setenv("LISTEN_FDNAMES", virBufferCurrentContent(&names), TRUE);
- else
- g_unsetenv("LISTEN_FDNAMES");
-
- map[0].name = "demo-unix.socket";
- map[0].family = AF_UNIX;
- map[0].path = demo_socket_path;
-
- map[1].name = "demo-ip.socket";
- map[1].family = AF_INET;
- map[1].port = virNetSocketGetPort(sockIP[0]);
-
- if (virSystemdGetActivation(map, G_N_ELEMENTS(map), &act) < 0)
+ if (virSystemdGetActivation(&act) < 0)
goto cleanup;
if (act == NULL) {
@@ -617,7 +604,7 @@ testActivationEmpty(const void *opaque G_GNUC_UNUSED)
g_unsetenv("LISTEN_FDS");
- if (virSystemdGetActivation(NULL, 0, &act) < 0)
+ if (virSystemdGetActivation(&act) < 0)
return -1;
if (act != NULL) {
@@ -629,21 +616,6 @@ testActivationEmpty(const void *opaque G_GNUC_UNUSED)
return 0;
}
-
-static int
-testActivationFDNames(const void *opaque G_GNUC_UNUSED)
-{
- return testActivation(true);
-}
-
-
-static int
-testActivationFDAddrs(const void *opaque G_GNUC_UNUSED)
-{
- return testActivation(false);
-}
-
-
static int
mymain(void)
{
@@ -759,8 +731,6 @@ mymain(void)
fcntl(STDERR_FILENO + 3, F_GETFL) == -1 && errno == EBADF) {
if (virTestRun("Test activation names", testActivationFDNames, NULL) < 0)
ret = -1;
- if (virTestRun("Test activation addrs", testActivationFDAddrs, NULL) < 0)
- ret = -1;
} else {
VIR_INFO("Skipping activation tests as FD 3/4/5 is open");
}
--
2.34.1
2 years, 9 months
[libvirt PATCH] util: drop support for obsolete systemd in RHEL-7
by Daniel P. Berrangé
The systemd version in RHEL-7 lacked support for the LISTEN_FDNAMES env
variable with socket activation. Since we stopped targetting RHEL-7 we
can drop some considerable amount of compatibility code.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/locking/lock_daemon.c | 8 +--
src/logging/log_daemon.c | 8 +--
src/remote/remote_daemon.c | 19 +-----
src/util/virsystemd.c | 117 ++++---------------------------------
src/util/virsystemd.h | 15 +----
tests/virsystemdtest.c | 38 ++----------
6 files changed, 18 insertions(+), 187 deletions(-)
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index b44649bfbe..178e8cf830 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -986,10 +986,6 @@ int main(int argc, char **argv) {
* saved state is present, therefore initialize from scratch here. */
if (rv == 0) {
g_autoptr(virSystemdActivation) act = NULL;
- virSystemdActivationMap actmap[] = {
- { .name = "virtlockd.socket", .family = AF_UNIX, .path = sock_file },
- { .name = "virtlockd-admin.socket", .family = AF_UNIX, .path = admin_sock_file },
- };
if (godaemon) {
if (chdir("/") < 0) {
@@ -1016,9 +1012,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
- if (virSystemdGetActivation(actmap,
- G_N_ELEMENTS(actmap),
- &act) < 0) {
+ if (virSystemdGetActivation(&act) < 0) {
ret = VIR_DAEMON_ERR_NETWORK;
goto cleanup;
}
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 245df9dbbd..82f625142b 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -794,10 +794,6 @@ int main(int argc, char **argv) {
*/
if (rv == 0) {
g_autoptr(virSystemdActivation) act = NULL;
- virSystemdActivationMap actmap[] = {
- { .name = "virtlogd.socket", .family = AF_UNIX, .path = sock_file },
- { .name = "virtlogd-admin.socket", .family = AF_UNIX, .path = admin_sock_file },
- };
if (godaemon) {
if (chdir("/") < 0) {
@@ -824,9 +820,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
- if (virSystemdGetActivation(actmap,
- G_N_ELEMENTS(actmap),
- &act) < 0) {
+ if (virSystemdGetActivation(&act) < 0) {
ret = VIR_DAEMON_ERR_NETWORK;
goto cleanup;
}
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 1b8e982a2f..26469e0d9f 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -214,25 +214,8 @@ daemonSetupNetworking(virNetServer *srv,
unsigned int tcp_min_ssf = 0;
#endif /* !WITH_SASL */
g_autoptr(virSystemdActivation) act = NULL;
- virSystemdActivationMap actmap[] = {
- { .name = DAEMON_NAME ".socket", .family = AF_UNIX, .path = sock_path },
- { .name = DAEMON_NAME "-ro.socket", .family = AF_UNIX, .path = sock_path_ro },
- { .name = DAEMON_NAME "-admin.socket", .family = AF_UNIX, .path = sock_path_adm },
-#ifdef WITH_IP
- { .name = DAEMON_NAME "-tcp.socket", .family = AF_INET },
- { .name = DAEMON_NAME "-tls.socket", .family = AF_INET },
-#endif /* ! WITH_IP */
- };
-
-#ifdef WITH_IP
- if ((actmap[3].port = virSocketAddrResolveService(config->tcp_port)) < 0)
- return -1;
-
- if ((actmap[4].port = virSocketAddrResolveService(config->tls_port)) < 0)
- return -1;
-#endif /* ! WITH_IP */
- if (virSystemdGetActivation(actmap, G_N_ELEMENTS(actmap), &act) < 0)
+ if (virSystemdGetActivation(&act) < 0)
return -1;
#ifdef WITH_IP
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index a86d4c6bb9..c95b6c93d3 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -788,98 +788,6 @@ virSystemdActivationInitFromNames(virSystemdActivation *act,
}
-/*
- * Back compat for systemd < v227 which lacks LISTEN_FDNAMES.
- * Delete when min systemd is increased ie RHEL7 dropped
- */
-static int
-virSystemdActivationInitFromMap(virSystemdActivation *act,
- int nfds,
- virSystemdActivationMap *map,
- size_t nmap)
-{
- int nextfd = STDERR_FILENO + 1;
- size_t i;
-
- while (nfds) {
- virSocketAddr addr;
- const char *name = NULL;
-
- memset(&addr, 0, sizeof(addr));
-
- addr.len = sizeof(addr.data);
- if (getsockname(nextfd, &addr.data.sa, &addr.len) < 0) {
- virReportSystemError(errno, "%s", _("Unable to get local socket name"));
- goto error;
- }
-
- VIR_DEBUG("Got socket family %d for FD %d",
- addr.data.sa.sa_family, nextfd);
-
- for (i = 0; i < nmap && !name; i++) {
- if (map[i].name == NULL)
- continue;
-
- if (addr.data.sa.sa_family == AF_INET) {
- if (map[i].family == AF_INET) {
- VIR_DEBUG("Expect %d got %d",
- map[i].port, ntohs(addr.data.inet4.sin_port));
- if (addr.data.inet4.sin_port == htons(map[i].port))
- name = map[i].name;
- }
- } else if (addr.data.sa.sa_family == AF_INET6) {
- /* NB use of AF_INET here is correct. The "map" struct
- * only refers to AF_INET. The socket may be AF_INET
- * or AF_INET6
- */
- if (map[i].family == AF_INET) {
- VIR_DEBUG("Expect %d got %d",
- map[i].port, ntohs(addr.data.inet6.sin6_port));
- if (addr.data.inet6.sin6_port == htons(map[i].port))
- name = map[i].name;
- }
-#ifndef WIN32
- } else if (addr.data.sa.sa_family == AF_UNIX) {
- if (map[i].family == AF_UNIX) {
- VIR_DEBUG("Expect %s got %s", map[i].path, addr.data.un.sun_path);
- if (STREQLEN(map[i].path,
- addr.data.un.sun_path,
- sizeof(addr.data.un.sun_path)))
- name = map[i].name;
- }
-#endif
- } else {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unexpected socket family %d"),
- addr.data.sa.sa_family);
- goto error;
- }
- }
-
- if (!name) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Cannot find name for FD %d socket family %d"),
- nextfd, addr.data.sa.sa_family);
- goto error;
- }
-
- if (virSystemdActivationAddFD(act, name, nextfd) < 0)
- goto error;
-
- nfds--;
- nextfd++;
- }
-
- return 0;
-
- error:
- for (i = 0; i < nfds; i++) {
- int fd = nextfd + i;
- VIR_FORCE_CLOSE(fd);
- }
- return -1;
-}
-
#ifndef WIN32
/**
@@ -954,9 +862,7 @@ virSystemdGetListenFDs(void)
#endif /* WIN32 */
static virSystemdActivation *
-virSystemdActivationNew(virSystemdActivationMap *map,
- size_t nmap,
- int nfds)
+virSystemdActivationNew(int nfds)
{
g_autoptr(virSystemdActivation) act = g_new0(virSystemdActivation, 1);
const char *fdnames;
@@ -966,14 +872,15 @@ virSystemdActivationNew(virSystemdActivationMap *map,
act->fds = virHashNew(virSystemdActivationEntryFree);
fdnames = getenv("LISTEN_FDNAMES");
- if (fdnames) {
- if (virSystemdActivationInitFromNames(act, nfds, fdnames) < 0)
- return NULL;
- } else {
- if (virSystemdActivationInitFromMap(act, nfds, map, nmap) < 0)
- return NULL;
+ if (!fdnames) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Missing LISTEN_FDNAMES env from systemd socket activation"));
+ return NULL;
}
+ if (virSystemdActivationInitFromNames(act, nfds, fdnames) < 0)
+ return NULL;
+
VIR_DEBUG("Created activation object for %d FDs", nfds);
return g_steal_pointer(&act);
}
@@ -981,8 +888,6 @@ virSystemdActivationNew(virSystemdActivationMap *map,
/**
* virSystemdGetActivation:
- * @map: mapping of socket addresses to names
- * @nmap: number of entries in @map
* @act: filled with allocated activation object
*
* Acquire an object for handling systemd activation.
@@ -995,9 +900,7 @@ virSystemdActivationNew(virSystemdActivationMap *map,
* Returns: 0 on success, -1 on failure
*/
int
-virSystemdGetActivation(virSystemdActivationMap *map,
- size_t nmap,
- virSystemdActivation **act)
+virSystemdGetActivation(virSystemdActivation **act)
{
int nfds = 0;
@@ -1010,7 +913,7 @@ virSystemdGetActivation(virSystemdActivationMap *map,
return 0;
}
- *act = virSystemdActivationNew(map, nmap, nfds);
+ *act = virSystemdActivationNew(nfds);
return 0;
}
diff --git a/src/util/virsystemd.h b/src/util/virsystemd.h
index 93320e40b9..19fb714132 100644
--- a/src/util/virsystemd.h
+++ b/src/util/virsystemd.h
@@ -25,17 +25,6 @@
typedef struct _virSystemdActivation virSystemdActivation;
-/*
- * Back compat for systemd < v227 which lacks LISTEN_FDNAMES.
- * Delete when min systemd is increased ie RHEL7 dropped
- */
-typedef struct _virSystemdActivationMap {
- const char *name;
- int family;
- int port; /* if family == AF_INET/AF_INET6 */
- const char *path; /* if family == AF_UNIX */
-} virSystemdActivationMap;
-
char *virSystemdMakeScopeName(const char *name,
const char *drivername,
bool legacy_behaviour);
@@ -70,9 +59,7 @@ char *virSystemdGetMachineNameByPID(pid_t pid);
char *virSystemdGetMachineUnitByPID(pid_t pid);
-int virSystemdGetActivation(virSystemdActivationMap *map,
- size_t nmap,
- virSystemdActivation **act);
+int virSystemdGetActivation(virSystemdActivation **act);
bool virSystemdActivationHasName(virSystemdActivation *act,
const char *name);
diff --git a/tests/virsystemdtest.c b/tests/virsystemdtest.c
index 9a063dd1fc..9b513697e0 100644
--- a/tests/virsystemdtest.c
+++ b/tests/virsystemdtest.c
@@ -513,7 +513,7 @@ testActivationCreateFDs(virNetSocket **sockUNIX,
static int
-testActivation(bool useNames)
+testActivationFDNames(const void *opaque G_GNUC_UNUSED)
{
virNetSocket *sockUNIX;
virNetSocket **sockIP;
@@ -522,7 +522,6 @@ testActivation(bool useNames)
size_t i;
char nfdstr[VIR_INT64_STR_BUFLEN];
char pidstr[VIR_INT64_STR_BUFLEN];
- virSystemdActivationMap map[2];
int *fds = NULL;
size_t nfds = 0;
g_autoptr(virSystemdActivation) act = NULL;
@@ -544,21 +543,9 @@ testActivation(bool useNames)
g_setenv("LISTEN_FDS", nfdstr, TRUE);
g_setenv("LISTEN_PID", pidstr, TRUE);
+ g_setenv("LISTEN_FDNAMES", virBufferCurrentContent(&names), TRUE);
- if (useNames)
- g_setenv("LISTEN_FDNAMES", virBufferCurrentContent(&names), TRUE);
- else
- g_unsetenv("LISTEN_FDNAMES");
-
- map[0].name = "demo-unix.socket";
- map[0].family = AF_UNIX;
- map[0].path = demo_socket_path;
-
- map[1].name = "demo-ip.socket";
- map[1].family = AF_INET;
- map[1].port = virNetSocketGetPort(sockIP[0]);
-
- if (virSystemdGetActivation(map, G_N_ELEMENTS(map), &act) < 0)
+ if (virSystemdGetActivation(&act) < 0)
goto cleanup;
if (act == NULL) {
@@ -617,7 +604,7 @@ testActivationEmpty(const void *opaque G_GNUC_UNUSED)
g_unsetenv("LISTEN_FDS");
- if (virSystemdGetActivation(NULL, 0, &act) < 0)
+ if (virSystemdGetActivation(&act) < 0)
return -1;
if (act != NULL) {
@@ -629,21 +616,6 @@ testActivationEmpty(const void *opaque G_GNUC_UNUSED)
return 0;
}
-
-static int
-testActivationFDNames(const void *opaque G_GNUC_UNUSED)
-{
- return testActivation(true);
-}
-
-
-static int
-testActivationFDAddrs(const void *opaque G_GNUC_UNUSED)
-{
- return testActivation(false);
-}
-
-
static int
mymain(void)
{
@@ -759,8 +731,6 @@ mymain(void)
fcntl(STDERR_FILENO + 3, F_GETFL) == -1 && errno == EBADF) {
if (virTestRun("Test activation names", testActivationFDNames, NULL) < 0)
ret = -1;
- if (virTestRun("Test activation addrs", testActivationFDAddrs, NULL) < 0)
- ret = -1;
} else {
VIR_INFO("Skipping activation tests as FD 3/4/5 is open");
}
--
2.34.1
2 years, 9 months
[PATCH] qemu: fix excluding disk from internal inactive snapshot
by Nikolay Shirokovskiy
Currently taking an internal inactive snapshot with a disk excluded from
snapshot using snapshot="no" will fail with error "Disk device '%s' does
not support snapshotting".
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/qemu/qemu_domain.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 469942d201..6a70b72760 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6860,11 +6860,12 @@ qemuDomainSnapshotWriteMetadata(virDomainObj *vm,
static int
qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver,
virDomainDef *def,
- const char *name,
+ virDomainMomentObj *snap,
const char *op,
bool try_all,
int ndisks)
{
+ virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
const char *qemuimgbin;
size_t i;
bool skipped = false;
@@ -6877,11 +6878,12 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver,
for (i = 0; i < ndisks; i++) {
g_autoptr(virCommand) cmd = virCommandNewArgList(qemuimgbin, "snapshot",
- op, name, NULL);
+ op, snap->def->name, NULL);
int format = virDomainDiskGetFormat(def->disks[i]);
/* FIXME: we also need to handle LVM here */
- if (def->disks[i]->device != VIR_DOMAIN_DISK_DEVICE_DISK)
+ if (def->disks[i]->device != VIR_DOMAIN_DISK_DEVICE_DISK ||
+ snapdef->disks[i].snapshot == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)
continue;
if (!virStorageSourceIsLocalStorage(def->disks[i]->src)) {
@@ -6903,7 +6905,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver,
} else if (STREQ(op, "-c") && i) {
/* We must roll back partial creation by deleting
* all earlier snapshots. */
- qemuDomainSnapshotForEachQcow2Raw(driver, def, name,
+ qemuDomainSnapshotForEachQcow2Raw(driver, def, snap,
"-d", false, i);
}
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -6923,7 +6925,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driver,
} else if (STREQ(op, "-c") && i) {
/* We must roll back partial creation by deleting
* all earlier snapshots. */
- qemuDomainSnapshotForEachQcow2Raw(driver, def, name,
+ qemuDomainSnapshotForEachQcow2Raw(driver, def, snap,
"-d", false, i);
}
return -1;
@@ -6942,7 +6944,7 @@ qemuDomainSnapshotForEachQcow2(virQEMUDriver *driver,
const char *op,
bool try_all)
{
- return qemuDomainSnapshotForEachQcow2Raw(driver, def, snap->def->name,
+ return qemuDomainSnapshotForEachQcow2Raw(driver, def, snap,
op, try_all, def->ndisks);
}
--
2.31.1
2 years, 9 months
Plans for the next release
by Jiri Denemark
We are getting close to the next release of libvirt. To aim for the
release on Mar 01 I suggest entering the freeze on Wednesday Feb 23 and
tagging RC2 on Friday Feb 25.
I hope this works for everyone.
Jirka
2 years, 9 months
[PATCH v4 0/9] support mode option for dirtyrate calculation
by huangy81@chinatelecom.cn
From: Hyman Huang(黄勇) <huangy81(a)chinatelecom.cn>
v4:
- Rebase the master
- [PATCH v4 1/9]: Refactor dirty page rate calculation status
implementation, display calc_status as string when
'virsh domstats --dirtyrate' api return.
- [PATCH v4 3/9]: Adjust the 'cap check' block before BeginJob().
- [PATCH v4 5/9]: Drop the virDomainDirtyRateCalcMode and introduce
internal enum qemuMonitorDirtyRateCalcMode instead.
- [PATCH v4 6/9]: Code clean.
- [PATCH v4 7/9]: Split qemu_driver logic of domdirtyrate-calc virsh
api into a separate commit.
- [PATCH v4 8/9]: Change the 'mode' parameter usage as --mode=[xxx|yyy],
code clean in qemuDomainStartDirtyRateCalc.
- [PATCH v4 9/9]: Display calc_mode as string and do code clean in
qemuMonitorJSONExtractDirtyRateInfo.
Thanks Michal and Peter for reviewing the previous versions, please review.
Regards
Yong
v3:
- Rebase the master
- [PATCH v2 2/6]: Fix the usage of virQEMUCapsGet
- [PATCH v2 4/6]: Fix the cleanup missed in qemuDomainStartDirtyRateCalc
- [PATCH v2 4/6]: Move all blocks below ACL check
- [PATCH v2 4/6]: Make the qemuMonitorJSONStartDirtyRateCalc cleaner by
merging the different case of qemuMonitorJSONMakeCommand
- [PATCH v2 4/6]: Code clean, make the error message not be line-broken
- [PATCH v2 5/6]: Abstract the enum definition into a standalone commit
- [PATCH v2 5/6]: Move the validations code above calculating flags block
- [PATCH v2 6/6]: Change the type of 'value' field to unsigned in
struct qemuMonitorDirtyRateVcpu
- [PATCH v2 6/6]: Rename the enum type qemuMonitorDirtyRateCalcMode to
virDomainDirtyRateCalcMode
- [PATCH v2 6/6]: Code clean, align the code in qemuDomainGetStatsDirtyRate
Thanks Peter for quick and precise response, please review.
Regards
Yong
v2:
Rebase master and fix confilicts with commit
"Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI_PREALLOC"
Thanks !
v1:
This patchset introduce mode option as the supplement of
qemuDomainStartDirtyRateCalc api, add calc_mode for dirtyrate
statistics correspondingly.
Qemu add mode parameter for calc-dirty-rate command since >= 6.2.0,
either of these three mode "page-sampling, dirty-bitmap, dirty-ring"
can be specified when calculating dirty page rate.
Page sampling is the original mode and used as default mode.
Dirty bitmap mode use kvm log sync api to fetch the dirty-bitmap
and count the increased 1 bits number during measurement, thus,
calculate the dirty page rate.
Dirty ring mode use the dirty-ring mechanism implemented in Qemu
which can count the increased dirty page on virtual cpu granularity,
thus, calculate the per-vcpu dirty page rate.
These three calculation mode can be used in different scenarios, and
the dirty-bitmap, dirty-ring mode may be more accurate to a certain
degree. So maybe it's time to support the mode option for dirtyrate
calculation.
This series make main modifications as the following:
1. introduce QEMU_CAPS_CALC_DIRTY_RATE capability to probe
calc-dirty-rate command in case of failure since it just
introduced since >= 5.2.0
2. introduce QEMU_CAPS_DIRTYRATE_MODE capability to probe
mode option of calc-dirty-rate command in case of failure, same
as 1.
3. implement mode option support for dirtyrate calculation.
Please review, thanks !
Best Regards !
Hyman Huang(黄勇) (9):
qemu: Refactor dirty page rate calculation status implementation
qemu_capabilities: Introduce QEMU_CAPS_CALC_DIRTY_RATE capability
qemu_driver: Probe capability before calculating dirty page rate
qemu_capabilities: Introduce QEMU_CAPS_DIRTYRATE_MODE capability
include: Introduce virDomainDirtyRateCalcFlags
qemu_driver: Add mode parameter to qemuDomainStartDirtyRateCalc
qemu_driver: Extend flags parameter of virDomainStartDirtyRateCalc
virsh: Add mode option to domdirtyrate-calc virsh api
qemu_driver: Add calc_mode for dirtyrate statistics
docs/manpages/virsh.rst | 7 ++-
include/libvirt/libvirt-domain.h | 21 +++----
src/libvirt-domain.c | 20 +++++--
src/qemu/qemu_capabilities.c | 4 ++
src/qemu/qemu_capabilities.h | 2 +
src/qemu/qemu_driver.c | 63 +++++++++++++++++---
src/qemu/qemu_monitor.c | 5 +-
src/qemu/qemu_monitor.h | 45 +++++++++++++-
src/qemu/qemu_monitor_json.c | 72 +++++++++++++++++++++--
src/qemu/qemu_monitor_json.h | 3 +-
tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 2 +
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 2 +
tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 2 +
tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 2 +
tools/virsh-completer-domain.c | 17 ++++++
tools/virsh-completer-domain.h | 4 ++
tools/virsh-domain.c | 42 ++++++++++++-
tools/virsh-domain.h | 9 +++
28 files changed, 294 insertions(+), 38 deletions(-)
--
1.8.3.1
2 years, 9 months
[PULL 0/3] Block patches
by Stefan Hajnoczi
The following changes since commit cc5ce8b8b6be83e5fe3b668dbd061ad97c534e3f:
Merge remote-tracking branch 'remotes/legoater/tags/pull-ppc-20220210' into staging (2022-02-13 20:33:28 +0000)
are available in the Git repository at:
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 4c41c69e05fe28c0f95f8abd2ebf407e95a4f04b:
util: adjust coroutine pool size to virtio block queue (2022-02-14 17:11:25 +0000)
----------------------------------------------------------------
Pull request
This contains coroutine poll size scaling, virtiofsd rseq seccomp for new glibc
versions, and the QEMU C virtiofsd deprecation notice.
----------------------------------------------------------------
Christian Ehrhardt (1):
tools/virtiofsd: Add rseq syscall to the seccomp allowlist
Dr. David Alan Gilbert (1):
Deprecate C virtiofsd
Hiroki Narukawa (1):
util: adjust coroutine pool size to virtio block queue
docs/about/deprecated.rst | 17 +++++++++++++++++
include/qemu/coroutine.h | 10 ++++++++++
hw/block/virtio-blk.c | 5 +++++
tools/virtiofsd/passthrough_seccomp.c | 3 +++
util/qemu-coroutine.c | 20 ++++++++++++++++----
5 files changed, 51 insertions(+), 4 deletions(-)
--
2.34.1
2 years, 9 months
[PATCH] openrc: Make init scripts executable on install
by Michal Privoznik
When installing openrc init scripts, we take whatever mode the
generated files are in an copy them under /etc/init.d/. This is
not ideal, because those files are not executable and they should
be.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/250
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/meson.build b/src/meson.build
index 3890df7124..b2d951d36c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -848,6 +848,7 @@ if conf.has('WITH_LIBVIRTD')
install_data(
init_file,
install_dir: sysconfdir / 'init.d',
+ install_mode: 'rwxr-xr-x',
rename: [ init['name'] ],
)
--
2.34.1
2 years, 9 months
[PATCH] tests: Drop domcaps test data for qemu < 2.11
by Michal Privoznik
The minimal supported version of QEMU is 2.11. And after
capabilities for older QEMUs were dropped in
v7.3.0-17-g184de10c1d we have some domaincapsdata/ files that are
never read. This is because domaincapstest uses
testQemuCapsIterate() which iterates over
qemucapabilitiesdata/caps_*.xml files.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
.../domaincapsdata/qemu_2.4.0-q35.x86_64.xml | 151 --------------
.../domaincapsdata/qemu_2.4.0-tcg.x86_64.xml | 147 --------------
tests/domaincapsdata/qemu_2.4.0.x86_64.xml | 151 --------------
.../domaincapsdata/qemu_2.5.0-q35.x86_64.xml | 151 --------------
.../domaincapsdata/qemu_2.5.0-tcg.x86_64.xml | 147 --------------
tests/domaincapsdata/qemu_2.5.0.x86_64.xml | 151 --------------
.../domaincapsdata/qemu_2.6.0-q35.x86_64.xml | 151 --------------
.../domaincapsdata/qemu_2.6.0-tcg.x86_64.xml | 147 --------------
.../qemu_2.6.0-virt.aarch64.xml | 149 --------------
tests/domaincapsdata/qemu_2.6.0.aarch64.xml | 143 -------------
tests/domaincapsdata/qemu_2.6.0.ppc64.xml | 116 -----------
tests/domaincapsdata/qemu_2.6.0.x86_64.xml | 151 --------------
.../domaincapsdata/qemu_2.7.0-q35.x86_64.xml | 152 --------------
.../domaincapsdata/qemu_2.7.0-tcg.x86_64.xml | 148 --------------
tests/domaincapsdata/qemu_2.7.0.s390x.xml | 108 ----------
tests/domaincapsdata/qemu_2.7.0.x86_64.xml | 152 --------------
.../domaincapsdata/qemu_2.8.0-q35.x86_64.xml | 152 --------------
.../domaincapsdata/qemu_2.8.0-tcg.x86_64.xml | 148 --------------
tests/domaincapsdata/qemu_2.8.0.s390x.xml | 189 -----------------
tests/domaincapsdata/qemu_2.8.0.x86_64.xml | 152 --------------
.../domaincapsdata/qemu_2.9.0-q35.x86_64.xml | 166 ---------------
.../domaincapsdata/qemu_2.9.0-tcg.x86_64.xml | 185 -----------------
tests/domaincapsdata/qemu_2.9.0.ppc64.xml | 116 -----------
tests/domaincapsdata/qemu_2.9.0.s390x.xml | 190 ------------------
tests/domaincapsdata/qemu_2.9.0.x86_64.xml | 166 ---------------
25 files changed, 3779 deletions(-)
delete mode 100644 tests/domaincapsdata/qemu_2.4.0-q35.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.4.0-tcg.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.4.0.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.5.0-q35.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.5.0-tcg.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.5.0.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.6.0-q35.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.6.0-tcg.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.6.0-virt.aarch64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.6.0.aarch64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.6.0.ppc64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.6.0.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.7.0-q35.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.7.0-tcg.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.7.0.s390x.xml
delete mode 100644 tests/domaincapsdata/qemu_2.7.0.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.8.0-q35.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.8.0-tcg.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.8.0.s390x.xml
delete mode 100644 tests/domaincapsdata/qemu_2.8.0.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.9.0-q35.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.9.0-tcg.x86_64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.9.0.ppc64.xml
delete mode 100644 tests/domaincapsdata/qemu_2.9.0.s390x.xml
delete mode 100644 tests/domaincapsdata/qemu_2.9.0.x86_64.xml
diff --git a/tests/domaincapsdata/qemu_2.4.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.4.0-q35.x86_64.xml
deleted file mode 100644
index 3ae03de391..0000000000
diff --git a/tests/domaincapsdata/qemu_2.4.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.4.0-tcg.x86_64.xml
deleted file mode 100644
index 461cc4c102..0000000000
diff --git a/tests/domaincapsdata/qemu_2.4.0.x86_64.xml b/tests/domaincapsdata/qemu_2.4.0.x86_64.xml
deleted file mode 100644
index e1af5b6622..0000000000
diff --git a/tests/domaincapsdata/qemu_2.5.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.5.0-q35.x86_64.xml
deleted file mode 100644
index f46991ca27..0000000000
diff --git a/tests/domaincapsdata/qemu_2.5.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.5.0-tcg.x86_64.xml
deleted file mode 100644
index 82edcbfac6..0000000000
diff --git a/tests/domaincapsdata/qemu_2.5.0.x86_64.xml b/tests/domaincapsdata/qemu_2.5.0.x86_64.xml
deleted file mode 100644
index 57f9f9b41b..0000000000
diff --git a/tests/domaincapsdata/qemu_2.6.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.6.0-q35.x86_64.xml
deleted file mode 100644
index 8bcd8f92ab..0000000000
diff --git a/tests/domaincapsdata/qemu_2.6.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.6.0-tcg.x86_64.xml
deleted file mode 100644
index 2a7b46f775..0000000000
diff --git a/tests/domaincapsdata/qemu_2.6.0-virt.aarch64.xml b/tests/domaincapsdata/qemu_2.6.0-virt.aarch64.xml
deleted file mode 100644
index 14cab3f557..0000000000
diff --git a/tests/domaincapsdata/qemu_2.6.0.aarch64.xml b/tests/domaincapsdata/qemu_2.6.0.aarch64.xml
deleted file mode 100644
index f84e648a15..0000000000
diff --git a/tests/domaincapsdata/qemu_2.6.0.ppc64.xml b/tests/domaincapsdata/qemu_2.6.0.ppc64.xml
deleted file mode 100644
index 7f9372a359..0000000000
diff --git a/tests/domaincapsdata/qemu_2.6.0.x86_64.xml b/tests/domaincapsdata/qemu_2.6.0.x86_64.xml
deleted file mode 100644
index 4eeec1a22b..0000000000
diff --git a/tests/domaincapsdata/qemu_2.7.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.7.0-q35.x86_64.xml
deleted file mode 100644
index 537941561b..0000000000
diff --git a/tests/domaincapsdata/qemu_2.7.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.7.0-tcg.x86_64.xml
deleted file mode 100644
index 79f5fba212..0000000000
diff --git a/tests/domaincapsdata/qemu_2.7.0.s390x.xml b/tests/domaincapsdata/qemu_2.7.0.s390x.xml
deleted file mode 100644
index f76564a9bc..0000000000
diff --git a/tests/domaincapsdata/qemu_2.7.0.x86_64.xml b/tests/domaincapsdata/qemu_2.7.0.x86_64.xml
deleted file mode 100644
index 1dd19dfc37..0000000000
diff --git a/tests/domaincapsdata/qemu_2.8.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.8.0-q35.x86_64.xml
deleted file mode 100644
index e0bb1b1eee..0000000000
diff --git a/tests/domaincapsdata/qemu_2.8.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.8.0-tcg.x86_64.xml
deleted file mode 100644
index 1829fbda60..0000000000
diff --git a/tests/domaincapsdata/qemu_2.8.0.s390x.xml b/tests/domaincapsdata/qemu_2.8.0.s390x.xml
deleted file mode 100644
index 2c075d7cdb..0000000000
diff --git a/tests/domaincapsdata/qemu_2.8.0.x86_64.xml b/tests/domaincapsdata/qemu_2.8.0.x86_64.xml
deleted file mode 100644
index 5f55b0730d..0000000000
diff --git a/tests/domaincapsdata/qemu_2.9.0-q35.x86_64.xml b/tests/domaincapsdata/qemu_2.9.0-q35.x86_64.xml
deleted file mode 100644
index 797b970040..0000000000
diff --git a/tests/domaincapsdata/qemu_2.9.0-tcg.x86_64.xml b/tests/domaincapsdata/qemu_2.9.0-tcg.x86_64.xml
deleted file mode 100644
index b47c426f1b..0000000000
diff --git a/tests/domaincapsdata/qemu_2.9.0.ppc64.xml b/tests/domaincapsdata/qemu_2.9.0.ppc64.xml
deleted file mode 100644
index 2523d6ec6b..0000000000
diff --git a/tests/domaincapsdata/qemu_2.9.0.s390x.xml b/tests/domaincapsdata/qemu_2.9.0.s390x.xml
deleted file mode 100644
index d5b58a786d..0000000000
diff --git a/tests/domaincapsdata/qemu_2.9.0.x86_64.xml b/tests/domaincapsdata/qemu_2.9.0.x86_64.xml
deleted file mode 100644
index 7716e9d381..0000000000
--
2.34.1
2 years, 9 months
[libvirt PATCH] Make systemd unit ordering more robust
by Martin Kletzander
Since libvirt-guests script/service can operate on various URIs and we do
support both socket activation and traditional services, the ordering should be
specified for all the possible sockets and services.
Also remove the Wants= dependency since do not want to start any service. We
cannot know which one libvirt-guests is configured, so we'd have to start all
the daemons which would break if unused colliding services are not
masked (libvirtd.service in the modular case and all the modular daemon service
units in the monolithic scenario). Fortunately we can assume that the system is
configured properly to start services/sockets that are of interest to the user.
That also works with the setup described in https://libvirt.org/daemons.html .
To make it even more robust we add the daemon service into the machine units
created for individual domains as it was missing there.
https://bugzilla.redhat.com/show_bug.cgi?id=1868537
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/util/virsystemd.c | 4 ++++
tools/libvirt-guests.service.in | 12 +++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index a86d4c6bb905..2d9711ad41b6 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -441,7 +441,9 @@ int virSystemdCreateMachine(const char *name,
nicindexes, nnicindexes, sizeof(int));
gprops = g_variant_new_parsed("[('Slice', <%s>),"
" ('After', <['libvirtd.service']>),"
+ " ('After', <['virt%sd.service']>),"
" ('Before', <['virt-guest-shutdown.target']>)]",
+ drivername,
slicename);
message = g_variant_new("(s@ayssus@ai@a(sv))",
name,
@@ -489,7 +491,9 @@ int virSystemdCreateMachine(const char *name,
uuid, 16, sizeof(unsigned char));
gprops = g_variant_new_parsed("[('Slice', <%s>),"
" ('After', <['libvirtd.service']>),"
+ " ('After', <['virt%sd.service']>),"
" ('Before', <['virt-guest-shutdown.target']>)]",
+ drivername,
slicename);
message = g_variant_new("(s@ayssus@a(sv))",
name,
diff --git a/tools/libvirt-guests.service.in b/tools/libvirt-guests.service.in
index 1a9b233e1177..3cf647619612 100644
--- a/tools/libvirt-guests.service.in
+++ b/tools/libvirt-guests.service.in
@@ -1,10 +1,20 @@
[Unit]
Description=Suspend/Resume Running libvirt Guests
-Wants=libvirtd.service
Requires=virt-guest-shutdown.target
After=network.target
After=time-sync.target
+After=libvirtd.socket
+After=virtqemud.socket
+After=virtlxcd.socket
+After=virtvboxd.socket
+After=virtvzd.socket
+After=virtxend.socket
After=libvirtd.service
+After=virtqemud.service
+After=virtlxcd.service
+After=virtvboxd.service
+After=virtvzd.service
+After=virtxend.service
After=virt-guest-shutdown.target
Documentation=man:libvirt-guests(8)
Documentation=https://libvirt.org
--
2.35.1
2 years, 9 months