On 5/7/19 10:23 PM, Ilias Stamatis wrote:
Return the number of disks present in the configuration of the fake
driver when called with @errors as NULL and @maxerrors as 0.

Otherwise return 0 as the number of errors encountered.

Signed-off-by: Ilias Stamatis <[email protected]>
---
  src/test/test_driver.c | 27 +++++++++++++++++++++++++++
  1 file changed, 27 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 460c896ef6..5fa9ab30f1 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -3046,6 +3046,32 @@ static int testDomainSetAutostart(virDomainPtr domain,
      return 0;
  }
+static int testDomainGetDiskErrors(virDomainPtr dom,
+                                   virDomainDiskErrorPtr errors,
+                                   unsigned int maxerrors ATTRIBUTE_UNUSED,
+                                   unsigned int flags)
+{
+    int ret = -1;
+    virDomainObjPtr vm = NULL;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = testDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (virDomainObjCheckActive(vm) < 0)
+        goto cleanup;
+
+    if (!errors)
+        ret = vm->def->ndisks;
+    else
+        ret = 0;

Don't we want to actually set some errors? That might be more helpful because mgmt app can actually test if it reports disk errors properly.

Michal

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to