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