In order to allow libvirt to create and start new mediated devices, we
need to be able to verify that the device has been started. In order to
do this, we'll need to save the UUID of newly-discovered devices within
the virNodeDevCapMdev structure. This allows us to search the device
list by UUID and verify whether the expected device has been started.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
break;
case VIR_NODE_DEV_CAP_MDEV:
VIR_FREE(data->mdev.type);
+ VIR_FREE(data->mdev.uuid);
for (i = 0; i < data->mdev.nattributes; i++)
virMediatedDeviceAttrFree(data->mdev.attributes[i]);
VIR_FREE(data->mdev.attributes);
struct _virNodeDevCapMdev {
char *type;
unsigned int iommuGroupNumber;
+ char *uuid;
virMediatedDeviceAttrPtr *attributes;
size_t nattributes;
};
virNodeDeviceDefPtr def)
{
int ret = -1;
- const char *uuidstr = NULL;
int iommugrp = -1;
char *linkpath = NULL;
char *canonicalpath = NULL;
data->type = g_path_get_basename(canonicalpath);
- uuidstr = udev_device_get_sysname(dev);
- if ((iommugrp = virMediatedDeviceGetIOMMUGroupNum(uuidstr)) < 0)
+ data->uuid = g_strdup(udev_device_get_sysname(dev));
+ if ((iommugrp = virMediatedDeviceGetIOMMUGroupNum(data->uuid)) < 0)
goto cleanup;
if (udevGenerateDeviceName(dev, def, NULL) != 0)