e9d682
From 08c8ef5eb30983d6ca004e84a11fe7f2547f984e Mon Sep 17 00:00:00 2001
e9d682
Message-Id: <08c8ef5eb30983d6ca004e84a11fe7f2547f984e@dist-git>
e9d682
From: Jonathon Jongsma <jjongsma@redhat.com>
e9d682
Date: Tue, 23 Aug 2022 12:28:02 -0500
e9d682
Subject: [PATCH] nodedev: wait a bit longer for new node devices
e9d682
e9d682
Openstack developers reported that newly-created mdevs were not
e9d682
recognized by libvirt until after a libvirt daemon restart. The source
e9d682
of the problem appears to be that when libvirt gets the udev 'add'
e9d682
event, the sysfs tree for that device might not be ready and so libvirt
e9d682
waits 100ms for it to appear (max 100 waits of 1ms each). But in the
e9d682
OpenStack environment, the sysfs tree for new mediated devices was
e9d682
taking closer to 250ms to appear and therefore libvirt gave up waiting
e9d682
and didn't add these new devices to its list of nodedevs.
e9d682
e9d682
By changing the wait time to 1 second (max 100 waits of 10ms each), this
e9d682
should provide enough time to enable these deployments to recognize
e9d682
newly-created mediated devices, but it shouldn't increase the delay for
e9d682
more traditional deployments too much.
e9d682
e9d682
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2109450
e9d682
e9d682
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
e9d682
Reviewed-by: Erik Skultety <eskultet@redhat.com>
e9d682
(cherry picked from commit e4f9682ebc442bb5dfee807ba618c8863355776d)
e9d682
e9d682
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2141364
e9d682
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
e9d682
---
e9d682
 src/node_device/node_device_udev.c | 2 +-
e9d682
 1 file changed, 1 insertion(+), 1 deletion(-)
e9d682
e9d682
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
e9d682
index 3d69bdedae..1f63162e23 100644
e9d682
--- a/src/node_device/node_device_udev.c
e9d682
+++ b/src/node_device/node_device_udev.c
e9d682
@@ -1036,7 +1036,7 @@ udevProcessMediatedDevice(struct udev_device *dev,
e9d682
 
e9d682
     linkpath = g_strdup_printf("%s/mdev_type", udev_device_get_syspath(dev));
e9d682
 
e9d682
-    if (virFileWaitForExists(linkpath, 1, 100) < 0) {
e9d682
+    if (virFileWaitForExists(linkpath, 10, 100) < 0) {
e9d682
         virReportSystemError(errno,
e9d682
                              _("failed to wait for file '%s' to appear"),
e9d682
                              linkpath);
e9d682
-- 
e9d682
2.38.1
e9d682