|
Pablo Greco |
40546a |
From 1113a43a48b3c15f908a396ec88e9499df10f7b4 Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
40546a |
Message-Id: <1113a43a48b3c15f908a396ec88e9499df10f7b4@dist-git>
|
|
Pablo Greco |
40546a |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
Pablo Greco |
40546a |
Date: Thu, 27 Jun 2019 15:55:38 +0200
|
|
Pablo Greco |
40546a |
Subject: [PATCH] m4: Provide default value fore UDEVADM
|
|
Pablo Greco |
40546a |
MIME-Version: 1.0
|
|
Pablo Greco |
40546a |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
40546a |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
It may happen that the system where libvirt is built at doesn't
|
|
Pablo Greco |
40546a |
have udevadm binary but the one where it runs does have it.
|
|
Pablo Greco |
40546a |
If we change how udevadm is run in virWaitForDevices() then we
|
|
Pablo Greco |
40546a |
can safely pass a default value in m4 macro.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
(cherry picked from commit 523b799d3c356b9b4ea0b117a60cfc3b603eaffa)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
https://bugzilla.redhat.com/show_bug.cgi?id=1710575
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Difference to the upstream commit is that I had to drop
|
|
Pablo Greco |
40546a |
VIR_AUTOPTR() of virCommand because that does not exist in the
|
|
Pablo Greco |
40546a |
downstream yet.
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
Pablo Greco |
40546a |
Message-Id: <3d2deafb1bf06eddd721fceb15961b27c8dbf0cf.1561643698.git.mprivozn@redhat.com>
|
|
Pablo Greco |
40546a |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
Pablo Greco |
40546a |
---
|
|
Pablo Greco |
40546a |
m4/virt-external-programs.m4 | 9 +++------
|
|
Pablo Greco |
40546a |
src/util/virutil.c | 16 ++++++++--------
|
|
Pablo Greco |
40546a |
2 files changed, 11 insertions(+), 14 deletions(-)
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
diff --git a/m4/virt-external-programs.m4 b/m4/virt-external-programs.m4
|
|
Pablo Greco |
40546a |
index 3c915e1a65..f1ae104b32 100644
|
|
Pablo Greco |
40546a |
--- a/m4/virt-external-programs.m4
|
|
Pablo Greco |
40546a |
+++ b/m4/virt-external-programs.m4
|
|
Pablo Greco |
40546a |
@@ -45,7 +45,7 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [
|
|
Pablo Greco |
40546a |
AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
AC_PATH_PROG([RADVD], [radvd], [radvd], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
AC_PATH_PROG([TC], [tc], [tc], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
- AC_PATH_PROG([UDEVADM], [udevadm], [], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
+ AC_PATH_PROG([UDEVADM], [udevadm], [udevadm], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
AC_PATH_PROG([MODPROBE], [modprobe], [modprobe], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
AC_PATH_PROG([RMMOD], [rmmod], [rmmod], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
AC_PATH_PROG([MMCTL], [mm-ctl], [mm-ctl], [$LIBVIRT_SBIN_PATH])
|
|
Pablo Greco |
40546a |
@@ -65,11 +65,8 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [
|
|
Pablo Greco |
40546a |
[Location or name of the mm-ctl program])
|
|
Pablo Greco |
40546a |
AC_DEFINE_UNQUOTED([OVSVSCTL], ["$OVSVSCTL"],
|
|
Pablo Greco |
40546a |
[Location or name of the ovs-vsctl program])
|
|
Pablo Greco |
40546a |
-
|
|
Pablo Greco |
40546a |
- if test -n "$UDEVADM"; then
|
|
Pablo Greco |
40546a |
- AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"],
|
|
Pablo Greco |
40546a |
- [Location or name of the udevadm program])
|
|
Pablo Greco |
40546a |
- fi
|
|
Pablo Greco |
40546a |
+ AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"],
|
|
Pablo Greco |
40546a |
+ [Location or name of the udevadm program])
|
|
Pablo Greco |
40546a |
if test -n "$MODPROBE"; then
|
|
Pablo Greco |
40546a |
AC_DEFINE_UNQUOTED([MODPROBE], ["$MODPROBE"],
|
|
Pablo Greco |
40546a |
[Location or name of the modprobe program])
|
|
Pablo Greco |
40546a |
diff --git a/src/util/virutil.c b/src/util/virutil.c
|
|
Pablo Greco |
40546a |
index 68d3217248..cd67f54bc2 100644
|
|
Pablo Greco |
40546a |
--- a/src/util/virutil.c
|
|
Pablo Greco |
40546a |
+++ b/src/util/virutil.c
|
|
Pablo Greco |
40546a |
@@ -1621,25 +1621,25 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups,
|
|
Pablo Greco |
40546a |
#endif
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
-#if defined(UDEVADM)
|
|
Pablo Greco |
40546a |
void virWaitForDevices(void)
|
|
Pablo Greco |
40546a |
{
|
|
Pablo Greco |
40546a |
- const char *const settleprog[] = { UDEVADM, "settle", NULL };
|
|
Pablo Greco |
40546a |
+ virCommandPtr cmd = NULL;
|
|
Pablo Greco |
40546a |
+ VIR_AUTOFREE(char *) udev = NULL;
|
|
Pablo Greco |
40546a |
int exitstatus;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
- if (access(settleprog[0], X_OK) != 0)
|
|
Pablo Greco |
40546a |
+ if (!(udev = virFindFileInPath(UDEVADM)))
|
|
Pablo Greco |
40546a |
+ return;
|
|
Pablo Greco |
40546a |
+
|
|
Pablo Greco |
40546a |
+ if (!(cmd = virCommandNewArgList(udev, "settle", NULL)))
|
|
Pablo Greco |
40546a |
return;
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
/*
|
|
Pablo Greco |
40546a |
* NOTE: we ignore errors here; this is just to make sure that any device
|
|
Pablo Greco |
40546a |
* nodes that are being created finish before we try to scan them.
|
|
Pablo Greco |
40546a |
*/
|
|
Pablo Greco |
40546a |
- ignore_value(virRun(settleprog, &exitstatus));
|
|
Pablo Greco |
40546a |
+ ignore_value(virCommandRun(cmd, &exitstatus));
|
|
Pablo Greco |
40546a |
+ virCommandFree(cmd);
|
|
Pablo Greco |
40546a |
}
|
|
Pablo Greco |
40546a |
-#else
|
|
Pablo Greco |
40546a |
-void virWaitForDevices(void)
|
|
Pablo Greco |
40546a |
-{}
|
|
Pablo Greco |
40546a |
-#endif
|
|
Pablo Greco |
40546a |
|
|
Pablo Greco |
40546a |
#if WITH_DEVMAPPER
|
|
Pablo Greco |
40546a |
bool
|
|
Pablo Greco |
40546a |
--
|
|
Pablo Greco |
40546a |
2.22.0
|
|
Pablo Greco |
40546a |
|