We supported autostart of node devices via an xml element, but this
is not consistent with other libvirt objects which use an explicit API
for setting autostart status. So revert this and implement it as an
official API in a future commit.
The initial support was refactored after merging, so this commit reverts
both of those previous commits.
Revert "virNodeDevCapMdevParseXML: Use virXMLPropEnum() for ./start/@type"
This reverts commit
9d4cd1d1cda84aa15b77a506f2ad6362a74edf1a.
Revert "nodedev: support auto-start property for mdevs"
This reverts commit
42a558549935336cbdb7cbfe8b239ffb0e3442e3.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
<dd>
This element represents the UUID of the mediated device.
</dd>
- <dt><code>start</code></dt>
- <dd>
- This element represents the start policy for the device. It
- has a required attribute <code>type</code>, which can have a
- value of <code>auto</code> or <code>manual</code>. Mediated
- devices with an <code>auto</code> start type will be started
- automatically by the host when the parent device becomes
- available (either on boot, or when the parent device is
- attached). Otherwise the device must be started manually.
- </dd>
</dl>
</dd>
<dt><code>ccw</code></dt>
</attribute>
</element>
</optional>
- <optional>
- <element name="start">
- <attribute name="type">
- <choice>
- <value>manual</value>
- <value>auto</value>
- </choice>
- </attribute>
- <empty/>
- </element>
- </optional>
<optional>
<element name="uuid">
<ref name="UUID"/>
"render",
);
-VIR_ENUM_IMPL(virNodeDevMdevStart,
- VIR_NODE_DEV_MDEV_START_LAST,
- "manual",
- "auto",
-);
-
static int
virNodeDevCapsDefParseString(const char *xpath,
xmlXPathContextPtr ctxt,
virBufferEscapeString(buf, "<type id='%s'/>\n", data->mdev.type);
virBufferEscapeString(buf, "<uuid>%s</uuid>\n", data->mdev.uuid);
- virBufferEscapeString(buf, "<start type='%s'/>\n",
- virNodeDevMdevStartTypeToString(data->mdev.start));
virBufferAsprintf(buf, "<iommuGroup number='%u'/>\n",
data->mdev.iommuGroupNumber);
return -1;
}
storage->removable_media_size = val;
+
ctxt->node = orignode2;
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
g_autofree xmlNodePtr *attrs = NULL;
size_t i;
g_autofree char *uuidstr = NULL;
- xmlNodePtr startNode = NULL;
ctxt->node = node;
virUUIDFormat(uuidbuf, mdev->uuid);
}
- mdev->start = VIR_NODE_DEV_MDEV_START_MANUAL;
-
- startNode = virXPathNode("./start[1]", ctxt);
- if (startNode &&
- virXMLPropEnumDefault(startNode, "type",
- virNodeDevMdevStartTypeFromString,
- VIR_XML_PROP_NONE, &mdev->start,
- VIR_NODE_DEV_MDEV_START_MANUAL) < 0) {
- return -1;
- }
-
/* 'iommuGroup' is optional, only report an error if the supplied value is
* invalid (-2), not if it's missing (-1) */
if (virXPathUInt("number(./iommuGroup[1]/@number)",
VIR_ENUM_DECL(virNodeDevDRM);
-typedef enum {
- /* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */
- VIR_NODE_DEV_MDEV_START_MANUAL,
- VIR_NODE_DEV_MDEV_START_AUTO,
-
- VIR_NODE_DEV_MDEV_START_LAST
-} virNodeDevMdevStartType;
-
-VIR_ENUM_DECL(virNodeDevMdevStart);
-
-
typedef struct _virNodeDevCapSystemHardware virNodeDevCapSystemHardware;
struct _virNodeDevCapSystemHardware {
char *vendor_name;
char *type;
unsigned int iommuGroupNumber;
char *uuid;
- virNodeDevMdevStartType start;
virMediatedDeviceAttr **attributes;
size_t nattributes;
};
virNodeDeviceGetSCSITargetCaps;
virNodeDeviceGetWWNs;
virNodeDeviceUpdateCaps;
-virNodeDevMdevStartTypeFromString;
-virNodeDevMdevStartTypeToString;
# conf/node_device_event.h
if (virJSONValueObjectAppendString(json, "mdev_type", mdev->type) < 0)
return -1;
- if (virJSONValueObjectAppendString(json, "start",
- virNodeDevMdevStartTypeToString(mdev->start)) < 0)
+ if (virJSONValueObjectAppendString(json, "start", "manual") < 0)
return -1;
if (mdev->attributes) {
mdev->uuid = g_strdup(uuid);
mdev->type =
g_strdup(virJSONValueObjectGetString(props, "mdev_type"));
- mdev->start =
- virNodeDevMdevStartTypeFromString(virJSONValueObjectGetString(props, "start"));
attrs = virJSONValueObjectGet(props, "attrs");
dstmdev->uuid = g_strdup(srcmdev->uuid);
}
- dstmdev->start = srcmdev->start;
-
if (virMediatedDeviceAttrsCopy(dstmdev, srcmdev))
ret = true;
<capability type='mdev'>
<type id='i915-GVTg_V5_4'/>
<uuid>200f228a-c80a-4d50-bfb7-f5a0e4e34045</uuid>
- <start type='manual'/>
<iommuGroup number='0'/>
</capability>
</device>
<capability type='mdev'>
<type id='i915-GVTg_V5_4'/>
<uuid>de807ffc-1923-4d5f-b6c9-b20ecebc6d4b</uuid>
- <start type='auto'/>
<iommuGroup number='0'/>
</capability>
</device>
<capability type='mdev'>
<type id='i915-GVTg_V5_8'/>
<uuid>435722ea-5f43-468a-874f-da34f1217f13</uuid>
- <start type='manual'/>
<iommuGroup number='0'/>
<attr name='testattr' value='42'/>
</capability>
<capability type='mdev'>
<type id='vfio_ap-passthrough'/>
<uuid>783e6dbb-ea0e-411f-94e2-717eaad438bf</uuid>
- <start type='manual'/>
<iommuGroup number='0'/>
<attr name='assign_adapter' value='5'/>
<attr name='assign_adapter' value='6'/>
+++ /dev/null
-<device>
- <name>mdev_3627463d_b7f0_4fea_b468_f1da537d301b</name>
- <parent>computer</parent>
- <capability type='mdev'>
- <type id='mtty-1'/>
- <start type='manual'/>
- <iommuGroup number='12'/>
- </capability>
-</device>
--- /dev/null
+../nodedevschemadata/mdev_3627463d_b7f0_4fea_b468_f1da537d301b.xml
\ No newline at end of file
<capability type='mdev'>
<type id='i915-GVTg_V5_8'/>
<uuid>d069d019-36ea-4111-8f0a-8c9a70e21366</uuid>
- <start type='manual'/>
<iommuGroup number='0'/>
</capability>
</device>
<parent>pci_0000_00_02_0</parent>
<capability type='mdev'>
<type id='i915-GVTg_V5_8'/>
- <start type='manual'/>
<iommuGroup number='0'/>
<attr name='example-attribute-1' value='attribute-value-1'/>
<attr name='example-attribute-2' value='attribute-value-2'/>
+++ /dev/null
-<device>
- <name>mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e48ad</name>
- <path>/sys/devices/vfio_ap/matrix/mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e48ad</path>
- <parent>ap_matrix</parent>
- <capability type='mdev'>
- <type id='vfio_ap-passthrough'/>
- <start type='manual'/>
- <iommuGroup number='0'/>
- </capability>
-</device>
--- /dev/null
+../nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml
\ No newline at end of file
<parent>pci_0000_00_02_0</parent>
<capability type='mdev'>
<type id='i915-GVTg_V5_8'/>
- <start type='manual'/>
<iommuGroup number='0'/>
<attr name='example-attribute' value='attribute-value'/>
</capability>