[PATCH 3/6] nodedev|test: Implement support for validating node device XMLs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/node_device/node_device_driver.c | 10 ++++++----
 src/test/test_driver.c               |  6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index d067234ab3..0fdfe1db96 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -876,8 +876,9 @@ nodeDeviceCreateXML(virConnectPtr conn,
     g_autofree char *wwpn = NULL;
     virNodeDevicePtr device = NULL;
     const char *virt_type = NULL;
+    bool validate = flags & VIR_NODE_DEVICE_CREATE_XML_VALIDATE;

-    virCheckFlags(0, NULL);
+    virCheckFlags(VIR_NODE_DEVICE_CREATE_XML_VALIDATE, NULL);

     if (nodeDeviceInitWait() < 0)
         return NULL;
@@ -885,7 +886,7 @@ nodeDeviceCreateXML(virConnectPtr conn,
     virt_type  = virConnectGetType(conn);

     if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt_type,
-                                      &driver->parserCallbacks, NULL, false)))
+                                      &driver->parserCallbacks, NULL, validate)))
         return NULL;

     if (virNodeDeviceCreateXMLEnsureACL(conn, def) < 0)
@@ -1397,8 +1398,9 @@ nodeDeviceDefineXML(virConnect *conn,
     const char *virt_type = NULL;
     g_autofree char *uuid = NULL;
     g_autofree char *name = NULL;
+    bool validate = flags & VIR_NODE_DEVICE_DEFINE_XML_VALIDATE;

-    virCheckFlags(0, NULL);
+    virCheckFlags(VIR_NODE_DEVICE_DEFINE_XML_VALIDATE, NULL);

     if (nodeDeviceInitWait() < 0)
         return NULL;
@@ -1406,7 +1408,7 @@ nodeDeviceDefineXML(virConnect *conn,
     virt_type  = virConnectGetType(conn);

     if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, virt_type,
-                                      &driver->parserCallbacks, NULL, false)))
+                                      &driver->parserCallbacks, NULL, validate)))
         return NULL;

     if (virNodeDeviceDefineXMLEnsureACL(conn, def) < 0)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 9b397e66b1..58c2a02561 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -7688,10 +7688,12 @@ testNodeDeviceCreateXML(virConnectPtr conn,
     virNodeDeviceDef *objdef;
     g_autofree char *wwnn = NULL;
     g_autofree char *wwpn = NULL;
+    bool validate = flags & VIR_NODE_DEVICE_CREATE_XML_VALIDATE;

-    virCheckFlags(0, NULL);
+    virCheckFlags(VIR_NODE_DEVICE_CREATE_XML_VALIDATE, NULL);

-    if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, NULL, NULL, NULL, false)))
+    if (!(def = virNodeDeviceDefParse(xmlDesc, NULL, CREATE_DEVICE, NULL, NULL,
+                                      NULL, validate)))
         goto cleanup;

     /* We run this simply for validation - it essentially validates that
-- 
2.37.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux