summaryrefslogtreecommitdiff
path: root/src/node_device
diff options
context:
space:
mode:
authorBoris Fiuczynski <fiuczy@linux.ibm.com>2021-05-14 16:28:59 -0500
committerMichal Privoznik <mprivozn@redhat.com>2021-05-20 11:10:08 +0200
commit42a558549935336cbdb7cbfe8b239ffb0e3442e3 (patch)
tree21724a18132f3c5b465c4793de9694dd8eaef32c /src/node_device
parent86ecc06c068fadb3c681a502b82cbcb8a334f194 (diff)
downloadlibvirt-42a558549935336cbdb7cbfe8b239ffb0e3442e3.tar.gz
nodedev: support auto-start property for mdevs
This adds a new element to the mdev capabilities xml schema that represents the start policy for a defined mediated device. The actual auto-start functionality is handled behind the scenes by mdevctl, but it wasn't yet hooked up in libvirt. Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Diffstat (limited to 'src/node_device')
-rw-r--r--src/node_device/node_device_driver.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 8a0a2c3847..a9f605715b 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -615,7 +615,8 @@ nodeDeviceDefToMdevctlConfig(virNodeDeviceDef *def, char **buf)
if (virJSONValueObjectAppendString(json, "mdev_type", mdev->type) < 0)
return -1;
- if (virJSONValueObjectAppendString(json, "start", "manual") < 0)
+ if (virJSONValueObjectAppendString(json, "start",
+ virNodeDevMdevStartTypeToString(mdev->start)) < 0)
return -1;
if (mdev->attributes) {
@@ -1014,6 +1015,8 @@ nodeDeviceParseMdevctlChildDevice(const char *parent,
mdev->uuid = g_strdup(uuid);
mdev->type =
g_strdup(virJSONValueObjectGetString(props, "mdev_type"));
+ mdev->start =
+ virNodeDevMdevStartTypeFromString(virJSONValueObjectGetString(props, "start"));
attrs = virJSONValueObjectGet(props, "attrs");
@@ -1683,6 +1686,8 @@ nodeDeviceDefCopyFromMdevctl(virNodeDeviceDef *dst,
dstmdev->uuid = g_strdup(srcmdev->uuid);
}
+ dstmdev->start = srcmdev->start;
+
if (virMediatedDeviceAttrsCopy(dstmdev, srcmdev))
ret = true;