[libvirt] [PATCH] test_driver: implement virDomainSetMemoryStatsPeriod

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

[libvirt] [PATCH] test_driver: implement virDomainSetMemoryStatsPeriod

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

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c10344f6cd..b6394fad2b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2469,6 +2469,40 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
     return 0;
 }

+
+static int testDomainSetMemoryStatsPeriod(virDomainPtr dom,
+                                          int period,
+                                          unsigned int flags)
+{
+    virDomainObjPtr vm;
+    virDomainDefPtr def;
+    int ret = -1;
+
+    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+                  VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+    if (!(vm = testDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (!(def = virDomainObjGetOneDef(vm, flags)))
+        goto cleanup;
+
+    if (!virDomainDefHasMemballoon(def)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("No memory balloon device configured, "
+                         "can not set the collection period"));
+        goto cleanup;
+    }
+
+    def->memballoon->period = period;
+
+    ret = 0;
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
+
 static int testDomainSetMemoryFlags(virDomainPtr domain,
                                     unsigned long memory,
                                     unsigned int flags)
@@ -7619,6 +7653,7 @@ static virHypervisorDriver testHypervisorDriver = {
     .domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
     .domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
     .domainSetMemory = testDomainSetMemory, /* 0.1.4 */
+    .domainSetMemoryStatsPeriod = testDomainSetMemoryStatsPeriod, /* 5.6.0 */
     .domainSetMemoryFlags = testDomainSetMemoryFlags, /* 5.6.0 */
     .domainGetHostname = testDomainGetHostname, /* 5.5.0 */
     .domainGetInfo = testDomainGetInfo, /* 0.1.1 */
--
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 virDomainSetMemoryStatsPeriod

Posted by Erik Skultety 11 weeks ago
On Thu, Jul 11, 2019 at 01:22:02PM +0200, Ilias Stamatis wrote:
> Signed-off-by: Ilias Stamatis <stamatis.iliass@gmail.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>

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