[PATCH 2/3] nodedev: update mdevs on parent change

Boris Fiuczynski posted 3 patches 3 years, 11 months ago
There is a newer version of this series
[PATCH 2/3] nodedev: update mdevs on parent change
Posted by Boris Fiuczynski 3 years, 11 months ago
The parent of the mdev definition can change due to the existance of the
parent device. The parents existance can e.g. depend on the device
driver load state.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
---
 src/node_device/node_device_driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 7b2fb3d953..84dde743df 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -1670,7 +1670,9 @@ removeMissingPersistentMdev(virNodeDeviceObj *obj,
 
     for (i = 0; i < data->ndefs; i++) {
         /* OK, this mdev is still defined by mdevctl */
-        if (STREQ(data->defs[i]->name, def->name))
+        /* AND the parent object has not changed */
+        if (STREQ(data->defs[i]->name, def->name) &&
+            STREQ(data->defs[i]->parent, def->parent))
             return false;
     }
 
-- 
2.33.1