m4: Provide default value fore UDEVADM

https://bugzilla.redhat.com/show_bug.cgi?id=1710575

It may happen that the system where libvirt is built at doesn't
have udevadm binary but the one where it runs does have it.
If we change how udevadm is run in virWaitForDevices() then we
can safely pass a default value in m4 macro.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2019-05-17 11:09:45 +02:00
parent 2944dcb2de
commit 523b799d3c
2 changed files with 10 additions and 14 deletions

View File

@ -45,7 +45,7 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [
AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([RADVD], [radvd], [radvd], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([TC], [tc], [tc], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([UDEVADM], [udevadm], [], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([UDEVADM], [udevadm], [udevadm], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([MODPROBE], [modprobe], [modprobe], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([RMMOD], [rmmod], [rmmod], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([MMCTL], [mm-ctl], [mm-ctl], [$LIBVIRT_SBIN_PATH])
@ -65,11 +65,8 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [
[Location or name of the mm-ctl program])
AC_DEFINE_UNQUOTED([OVSVSCTL], ["$OVSVSCTL"],
[Location or name of the ovs-vsctl program])
if test -n "$UDEVADM"; then
AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"],
[Location or name of the udevadm program])
fi
AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"],
[Location or name of the udevadm program])
if test -n "$MODPROBE"; then
AC_DEFINE_UNQUOTED([MODPROBE], ["$MODPROBE"],
[Location or name of the modprobe program])

View File

@ -1479,25 +1479,24 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups,
#endif
#if defined(UDEVADM)
void virWaitForDevices(void)
{
const char *const settleprog[] = { UDEVADM, "settle", NULL };
VIR_AUTOPTR(virCommand) cmd = NULL;
VIR_AUTOFREE(char *) udev = NULL;
int exitstatus;
if (access(settleprog[0], X_OK) != 0)
if (!(udev = virFindFileInPath(UDEVADM)))
return;
if (!(cmd = virCommandNewArgList(udev, "settle", NULL)))
return;
/*
* NOTE: we ignore errors here; this is just to make sure that any device
* nodes that are being created finish before we try to scan them.
*/
ignore_value(virRun(settleprog, &exitstatus));
ignore_value(virCommandRun(cmd, &exitstatus));
}
#else
void virWaitForDevices(void)
{}
#endif
#if WITH_DEVMAPPER
bool