[libvirt] [PATCH] test_driver: implement virDomainGetBlockInfo

Ilias Stamatis posted 1 patch 1 week ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190808103023.24797-1-stamatis.iliass@gmail.com
src/test/test_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

[libvirt] [PATCH] test_driver: implement virDomainGetBlockInfo

Posted by Ilias Stamatis 1 week ago
Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
---
 src/test/test_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 6f18baa265..106e8f027e 100755
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -7729,6 +7729,45 @@ testDomainMemoryPeek(virDomainPtr dom,
 }


+static int
+testDomainGetBlockInfo(virDomainPtr dom,
+                       const char *path,
+                       virDomainBlockInfoPtr info,
+                       unsigned int flags)
+{
+    virDomainObjPtr vm = NULL;
+    virDomainDiskDefPtr disk;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = testDomObjFromDomain(dom)))
+        return -1;
+
+    if (!(disk = virDomainDiskByName(vm->def, path, false))) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("invalid path %s not assigned to domain"), path);
+        goto cleanup;
+    }
+
+    if (virStorageSourceIsEmpty(disk->src)) {
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("disk '%s' does not currently have a source assigned"),
+                       path);
+        goto cleanup;
+    }
+
+    info->capacity = 1099506450432;
+    info->allocation = 1099511627776;
+    info->physical = 1099511627776;
+
+    ret = 0;
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
+
 /*
  * Snapshot APIs
  */
@@ -9031,6 +9070,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainManagedSaveRemove = testDomainManagedSaveRemove, /* 1.1.4 */
     .domainMemoryStats = testDomainMemoryStats, /* 5.7.0 */
     .domainMemoryPeek = testDomainMemoryPeek, /* 5.4.0 */
+    .domainGetBlockInfo = testDomainGetBlockInfo, /* 5.7.0 */

     .domainSnapshotNum = testDomainSnapshotNum, /* 1.1.4 */
     .domainSnapshotListNames = testDomainSnapshotListNames, /* 1.1.4 */
--
2.22.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] test_driver: implement virDomainGetBlockInfo

Posted by Erik Skultety 1 week ago
On Thu, Aug 08, 2019 at 12:30:24PM +0200, Ilias Stamatis wrote:
> Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> ---
>  src/test/test_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list