提交 4583a734 编写于 作者: J Jonathon Jongsma 提交者: Erik Skultety

nodedev: store mdev UUID in mdev caps

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: NJonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: NErik Skultety <eskultet@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 81dc248e
...@@ -2218,6 +2218,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) ...@@ -2218,6 +2218,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
break; break;
case VIR_NODE_DEV_CAP_MDEV: case VIR_NODE_DEV_CAP_MDEV:
VIR_FREE(data->mdev.type); VIR_FREE(data->mdev.type);
VIR_FREE(data->mdev.uuid);
for (i = 0; i < data->mdev.nattributes; i++) for (i = 0; i < data->mdev.nattributes; i++)
virMediatedDeviceAttrFree(data->mdev.attributes[i]); virMediatedDeviceAttrFree(data->mdev.attributes[i]);
VIR_FREE(data->mdev.attributes); VIR_FREE(data->mdev.attributes);
......
...@@ -141,6 +141,7 @@ typedef virNodeDevCapMdev *virNodeDevCapMdevPtr; ...@@ -141,6 +141,7 @@ typedef virNodeDevCapMdev *virNodeDevCapMdevPtr;
struct _virNodeDevCapMdev { struct _virNodeDevCapMdev {
char *type; char *type;
unsigned int iommuGroupNumber; unsigned int iommuGroupNumber;
char *uuid;
virMediatedDeviceAttrPtr *attributes; virMediatedDeviceAttrPtr *attributes;
size_t nattributes; size_t nattributes;
}; };
......
...@@ -1013,7 +1013,6 @@ udevProcessMediatedDevice(struct udev_device *dev, ...@@ -1013,7 +1013,6 @@ udevProcessMediatedDevice(struct udev_device *dev,
virNodeDeviceDefPtr def) virNodeDeviceDefPtr def)
{ {
int ret = -1; int ret = -1;
const char *uuidstr = NULL;
int iommugrp = -1; int iommugrp = -1;
char *linkpath = NULL; char *linkpath = NULL;
char *canonicalpath = NULL; char *canonicalpath = NULL;
...@@ -1041,8 +1040,8 @@ udevProcessMediatedDevice(struct udev_device *dev, ...@@ -1041,8 +1040,8 @@ udevProcessMediatedDevice(struct udev_device *dev,
data->type = g_path_get_basename(canonicalpath); data->type = g_path_get_basename(canonicalpath);
uuidstr = udev_device_get_sysname(dev); data->uuid = g_strdup(udev_device_get_sysname(dev));
if ((iommugrp = virMediatedDeviceGetIOMMUGroupNum(uuidstr)) < 0) if ((iommugrp = virMediatedDeviceGetIOMMUGroupNum(data->uuid)) < 0)
goto cleanup; goto cleanup;
if (udevGenerateDeviceName(dev, def, NULL) != 0) if (udevGenerateDeviceName(dev, def, NULL) != 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册