提交 523b799d 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 2944dcb2
...@@ -45,7 +45,7 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [ ...@@ -45,7 +45,7 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [
AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([DNSMASQ], [dnsmasq], [dnsmasq], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([RADVD], [radvd], [radvd], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([RADVD], [radvd], [radvd], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([TC], [tc], [tc], [$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([MODPROBE], [modprobe], [modprobe], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([RMMOD], [rmmod], [rmmod], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([RMMOD], [rmmod], [rmmod], [$LIBVIRT_SBIN_PATH])
AC_PATH_PROG([MMCTL], [mm-ctl], [mm-ctl], [$LIBVIRT_SBIN_PATH]) AC_PATH_PROG([MMCTL], [mm-ctl], [mm-ctl], [$LIBVIRT_SBIN_PATH])
...@@ -65,11 +65,8 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [ ...@@ -65,11 +65,8 @@ AC_DEFUN([LIBVIRT_CHECK_EXTERNAL_PROGRAMS], [
[Location or name of the mm-ctl program]) [Location or name of the mm-ctl program])
AC_DEFINE_UNQUOTED([OVSVSCTL], ["$OVSVSCTL"], AC_DEFINE_UNQUOTED([OVSVSCTL], ["$OVSVSCTL"],
[Location or name of the ovs-vsctl program]) [Location or name of the ovs-vsctl program])
AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"],
if test -n "$UDEVADM"; then [Location or name of the udevadm program])
AC_DEFINE_UNQUOTED([UDEVADM], ["$UDEVADM"],
[Location or name of the udevadm program])
fi
if test -n "$MODPROBE"; then if test -n "$MODPROBE"; then
AC_DEFINE_UNQUOTED([MODPROBE], ["$MODPROBE"], AC_DEFINE_UNQUOTED([MODPROBE], ["$MODPROBE"],
[Location or name of the modprobe program]) [Location or name of the modprobe program])
......
...@@ -1479,25 +1479,24 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, ...@@ -1479,25 +1479,24 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups,
#endif #endif
#if defined(UDEVADM)
void virWaitForDevices(void) void virWaitForDevices(void)
{ {
const char *const settleprog[] = { UDEVADM, "settle", NULL }; VIR_AUTOPTR(virCommand) cmd = NULL;
VIR_AUTOFREE(char *) udev = NULL;
int exitstatus; int exitstatus;
if (access(settleprog[0], X_OK) != 0) if (!(udev = virFindFileInPath(UDEVADM)))
return;
if (!(cmd = virCommandNewArgList(udev, "settle", NULL)))
return; return;
/* /*
* NOTE: we ignore errors here; this is just to make sure that any device * 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. * 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 #if WITH_DEVMAPPER
bool bool
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册