mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
nodedev: Add parser validation for node devices
At the moment, this is only for mediated devices. When a new mediated device is created or defined, the xml is expected specify the nodedev name of an existing device as its parent. We were not previously validating this and were simply accepting any string here. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
|
||||
#define VIRT_TYPE "QEMU"
|
||||
|
||||
static virNodeDeviceDefParserCallbacks parser_callbacks = {
|
||||
.validate = nodeDeviceDefValidate
|
||||
};
|
||||
|
||||
struct TestInfo {
|
||||
const char *filename;
|
||||
virMdevctlCommand command;
|
||||
@@ -66,7 +70,8 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE)))
|
||||
if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE,
|
||||
&parser_callbacks, NULL)))
|
||||
return -1;
|
||||
|
||||
/* this function will set a stdin buffer containing the json configuration
|
||||
|
||||
@@ -25,7 +25,8 @@ testCompareXMLToXMLFiles(const char *xml, const char *outfile)
|
||||
if (virTestLoadFile(xml, &xmlData) < 0)
|
||||
goto fail;
|
||||
|
||||
if (!(dev = virNodeDeviceDefParseString(xmlData, EXISTING_DEVICE, NULL)))
|
||||
if (!(dev = virNodeDeviceDefParseString(xmlData, EXISTING_DEVICE, NULL,
|
||||
NULL, NULL)))
|
||||
goto fail;
|
||||
|
||||
/* Calculate some things that are not read in */
|
||||
|
||||
Reference in New Issue
Block a user