[PATCH 7/7] qemu: monitor: Remove unused migration property getters/setters

Peter Krempa pkrempa at redhat.com
Fri Jul 15 12:31:42 UTC 2022


The getters/setters for individual properties of migration
speed/downtime/cache size are unused once we switched to setting them
purely via migration parameters. Remove the unused helpers.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_monitor.c      | 55 ---------------------
 src/qemu/qemu_monitor.h      | 11 -----
 src/qemu/qemu_monitor_json.c | 96 ------------------------------------
 src/qemu/qemu_monitor_json.h | 15 ------
 tests/qemumonitorjsontest.c  | 39 ---------------
 5 files changed, 216 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fda5d2f368..109107eaae 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2245,61 +2245,6 @@ qemuMonitorSetDBusVMStateIdList(qemuMonitor *mon,
 }


-int
-qemuMonitorSetMigrationSpeed(qemuMonitor *mon,
-                             unsigned long bandwidth)
-{
-    VIR_DEBUG("bandwidth=%lu", bandwidth);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    if (bandwidth > QEMU_DOMAIN_MIG_BANDWIDTH_MAX) {
-        virReportError(VIR_ERR_OVERFLOW,
-                       _("bandwidth must be less than %llu"),
-                       QEMU_DOMAIN_MIG_BANDWIDTH_MAX + 1ULL);
-        return -1;
-    }
-
-    return qemuMonitorJSONSetMigrationSpeed(mon, bandwidth);
-}
-
-
-int
-qemuMonitorSetMigrationDowntime(qemuMonitor *mon,
-                                unsigned long long downtime)
-{
-    VIR_DEBUG("downtime=%llu", downtime);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONSetMigrationDowntime(mon, downtime);
-}
-
-
-int
-qemuMonitorGetMigrationCacheSize(qemuMonitor *mon,
-                                 unsigned long long *cacheSize)
-{
-    VIR_DEBUG("cacheSize=%p", cacheSize);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONGetMigrationCacheSize(mon, cacheSize);
-}
-
-
-int
-qemuMonitorSetMigrationCacheSize(qemuMonitor *mon,
-                                 unsigned long long cacheSize)
-{
-    VIR_DEBUG("cacheSize=%llu", cacheSize);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    return qemuMonitorJSONSetMigrationCacheSize(mon, cacheSize);
-}
-
-
 /**
  * qemuMonitorGetMigrationParams:
  * @mon: Pointer to the monitor object.
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 95267ec6c7..f7e01f71fe 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -770,17 +770,6 @@ int qemuMonitorSavePhysicalMemory(qemuMonitor *mon,
 int qemuMonitorSetDBusVMStateIdList(qemuMonitor *mon,
                                     GSList *list);

-int qemuMonitorSetMigrationSpeed(qemuMonitor *mon,
-                                 unsigned long bandwidth);
-
-int qemuMonitorSetMigrationDowntime(qemuMonitor *mon,
-                                    unsigned long long downtime);
-
-int qemuMonitorGetMigrationCacheSize(qemuMonitor *mon,
-                                     unsigned long long *cacheSize);
-int qemuMonitorSetMigrationCacheSize(qemuMonitor *mon,
-                                     unsigned long long cacheSize);
-
 int qemuMonitorGetMigrationParams(qemuMonitor *mon,
                                   virJSONValue **params);
 int qemuMonitorSetMigrationParams(qemuMonitor *mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 80696de731..5e4a86e5ad 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3034,102 +3034,6 @@ qemuMonitorJSONSavePhysicalMemory(qemuMonitor *mon,
 }


-int qemuMonitorJSONSetMigrationSpeed(qemuMonitor *mon,
-                                     unsigned long bandwidth)
-{
-    g_autoptr(virJSONValue) cmd = NULL;
-    g_autoptr(virJSONValue) reply = NULL;
-
-    cmd = qemuMonitorJSONMakeCommand("migrate_set_speed",
-                                     "U:value", bandwidth * 1024ULL * 1024ULL,
-                                     NULL);
-    if (!cmd)
-        return -1;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        return -1;
-
-    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        return -1;
-
-    return 0;
-}
-
-
-int qemuMonitorJSONSetMigrationDowntime(qemuMonitor *mon,
-                                        unsigned long long downtime)
-{
-    g_autoptr(virJSONValue) cmd = NULL;
-    g_autoptr(virJSONValue) reply = NULL;
-
-    cmd = qemuMonitorJSONMakeCommand("migrate_set_downtime",
-                                     "d:value", downtime / 1000.0,
-                                     NULL);
-    if (!cmd)
-        return -1;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        return -1;
-
-    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        return -1;
-
-    return 0;
-}
-
-
-int
-qemuMonitorJSONGetMigrationCacheSize(qemuMonitor *mon,
-                                     unsigned long long *cacheSize)
-{
-    g_autoptr(virJSONValue) cmd = NULL;
-    g_autoptr(virJSONValue) reply = NULL;
-
-    *cacheSize = 0;
-
-    cmd = qemuMonitorJSONMakeCommand("query-migrate-cache-size", NULL);
-    if (!cmd)
-        return -1;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        return -1;
-
-    if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_NUMBER) < 0)
-        return -1;
-
-    if (virJSONValueObjectGetNumberUlong(reply, "return", cacheSize) < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("invalid cache size in query-migrate-cache-size reply"));
-        return -1;
-    }
-
-    return 0;
-}
-
-
-int
-qemuMonitorJSONSetMigrationCacheSize(qemuMonitor *mon,
-                                     unsigned long long cacheSize)
-{
-    g_autoptr(virJSONValue) cmd = NULL;
-    g_autoptr(virJSONValue) reply = NULL;
-
-    cmd = qemuMonitorJSONMakeCommand("migrate-set-cache-size",
-                                     "U:value", cacheSize,
-                                     NULL);
-    if (!cmd)
-        return -1;
-
-    if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
-        return -1;
-
-    if (qemuMonitorJSONCheckError(cmd, reply) < 0)
-        return -1;
-
-    return 0;
-}
-
-
 int
 qemuMonitorJSONGetMigrationParams(qemuMonitor *mon,
                                   virJSONValue **params)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index ad3853ae69..7006aa8c46 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -152,21 +152,6 @@ qemuMonitorJSONSavePhysicalMemory(qemuMonitor *mon,
                                   unsigned long long length,
                                   const char *path);

-int
-qemuMonitorJSONSetMigrationSpeed(qemuMonitor *mon,
-                                 unsigned long bandwidth);
-
-int
-qemuMonitorJSONSetMigrationDowntime(qemuMonitor *mon,
-                                    unsigned long long downtime);
-
-int
-qemuMonitorJSONGetMigrationCacheSize(qemuMonitor *mon,
-                                     unsigned long long *cacheSize);
-int
-qemuMonitorJSONSetMigrationCacheSize(qemuMonitor *mon,
-                                     unsigned long long cacheSize);
-
 int
 qemuMonitorJSONGetMigrationParams(qemuMonitor *mon,
                                   virJSONValue **params);
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index ca1b8c3000..692aa75791 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1203,8 +1203,6 @@ GEN_TEST_FUNC(qemuMonitorJSONEjectMedia, "hdc", true)
 GEN_TEST_FUNC(qemuMonitorJSONChangeMedia, "hdc", "/foo/bar", "formatstr")
 GEN_TEST_FUNC(qemuMonitorJSONSaveVirtualMemory, 0, 1024, "/foo/bar")
 GEN_TEST_FUNC(qemuMonitorJSONSavePhysicalMemory, 0, 1024, "/foo/bar")
-GEN_TEST_FUNC(qemuMonitorJSONSetMigrationSpeed, 1024)
-GEN_TEST_FUNC(qemuMonitorJSONSetMigrationDowntime, 1)
 GEN_TEST_FUNC(qemuMonitorJSONMigrate, QEMU_MONITOR_MIGRATE_BACKGROUND |
               QEMU_MONITOR_MIGRATE_NON_SHARED_DISK |
               QEMU_MONITOR_MIGRATE_NON_SHARED_INC, "tcp:localhost:12345")
@@ -1714,40 +1712,6 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo(const void *opaque)
 }


-static int
-testQemuMonitorJSONqemuMonitorJSONGetMigrationCacheSize(const void *opaque)
-{
-    const testGenericData *data = opaque;
-    virDomainXMLOption *xmlopt = data->xmlopt;
-    unsigned long long cacheSize;
-    g_autoptr(qemuMonitorTest) test = NULL;
-
-    if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
-        return -1;
-
-    qemuMonitorTestSkipDeprecatedValidation(test, true);
-
-    if (qemuMonitorTestAddItem(test, "query-migrate-cache-size",
-                               "{"
-                               "    \"return\": 67108864,"
-                               "    \"id\": \"libvirt-12\""
-                               "}") < 0)
-        return -1;
-
-    if (qemuMonitorJSONGetMigrationCacheSize(qemuMonitorTestGetMonitor(test),
-                                             &cacheSize) < 0)
-        return -1;
-
-    if (cacheSize != 67108864) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "Invalid cacheSize: %llu, expected 67108864",
-                       cacheSize);
-        return -1;
-    }
-
-    return 0;
-}
-
 static int
 testQemuMonitorJSONqemuMonitorJSONGetMigrationStats(const void *opaque)
 {
@@ -3105,8 +3069,6 @@ mymain(void)
     DO_TEST_GEN_DEPRECATED(qemuMonitorJSONChangeMedia, true);
     DO_TEST_GEN(qemuMonitorJSONSaveVirtualMemory);
     DO_TEST_GEN(qemuMonitorJSONSavePhysicalMemory);
-    DO_TEST_GEN_DEPRECATED(qemuMonitorJSONSetMigrationSpeed, true);
-    DO_TEST_GEN_DEPRECATED(qemuMonitorJSONSetMigrationDowntime, true);
     DO_TEST_GEN(qemuMonitorJSONMigrate);
     DO_TEST_GEN(qemuMonitorJSONMigrateRecover);
     DO_TEST_SIMPLE("migrate-pause", qemuMonitorJSONMigratePause);
@@ -3136,7 +3098,6 @@ mymain(void)
     DO_TEST(qemuMonitorJSONGetBalloonInfo);
     DO_TEST(qemuMonitorJSONGetBlockInfo);
     DO_TEST(qemuMonitorJSONGetAllBlockStatsInfo);
-    DO_TEST(qemuMonitorJSONGetMigrationCacheSize);
     DO_TEST(qemuMonitorJSONGetMigrationStats);
     DO_TEST(qemuMonitorJSONGetChardevInfo);
     DO_TEST(qemuMonitorJSONSetBlockIoThrottle);
-- 
2.36.1



More information about the libvir-list mailing list