]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: monitor: Remove HMP monitor code
authorPeter Krempa <pkrempa@redhat.com>
Tue, 1 Apr 2025 19:32:53 +0000 (21:32 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 2 Apr 2025 14:51:41 +0000 (16:51 +0200)
Now that we've replaced the final two HMP commands used by libvirt we
can fully drop the 'text' monitor support.

The only thing we keep is the HMP passtrhough with
'virsh qemu-monitor-command'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
po/POTFILES
src/qemu/meson.build
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_text.c [deleted file]
src/qemu/qemu_monitor_text.h [deleted file]

index 0c83affb44b057b637088c8f55c002be3834b6df..9747c3895146393062bd54334cebc1dac8180090 100644 (file)
@@ -188,7 +188,6 @@ src/qemu/qemu_migration_cookie.c
 src/qemu/qemu_migration_params.c
 src/qemu/qemu_monitor.c
 src/qemu/qemu_monitor_json.c
-src/qemu/qemu_monitor_text.c
 src/qemu/qemu_namespace.c
 src/qemu/qemu_nbdkit.c
 src/qemu/qemu_passt.c
index 7a07d4f2c4107074858f6f8b21e289ea21affff6..5cf20f426fe330257af0a22b96c65135e38580fe 100644 (file)
@@ -27,7 +27,6 @@ qemu_driver_sources = [
   'qemu_migration_params.c',
   'qemu_monitor.c',
   'qemu_monitor_json.c',
-  'qemu_monitor_text.c',
   'qemu_namespace.c',
   'qemu_nbdkit.c',
   'qemu_passt.c',
index fc215def13708e861416cc11b91787a84fdde2a7..6340f437dd876580055a33fed92525c95041e3e4 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "qemu_alias.h"
 #include "qemu_monitor.h"
-#include "qemu_monitor_text.h"
 #include "qemu_monitor_json.h"
 #include "qemu_domain.h"
 #include "qemu_capabilities.h"
@@ -2745,30 +2744,6 @@ qemuMonitorDelObject(qemuMonitor *mon,
 }
 
 
-int
-qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name)
-{
-    VIR_DEBUG("name=%s", name);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    /* there won't ever be a direct QMP replacement for this function */
-    return qemuMonitorTextCreateSnapshot(mon, name);
-}
-
-
-int
-qemuMonitorDeleteSnapshot(qemuMonitor *mon, const char *name)
-{
-    VIR_DEBUG("name=%s", name);
-
-    QEMU_CHECK_MONITOR(mon);
-
-    /* there won't ever be a direct QMP replacement for this function */
-    return qemuMonitorTextDeleteSnapshot(mon, name);
-}
-
-
 int
 qemuMonitorSnapshotSave(qemuMonitor *mon,
                         const char *jobname,
index 9a55b494720fe08c0018f4a43f81b0cd407981d9..db451c448b9f2d01cd3e966844c0e5edea90fb8a 100644 (file)
@@ -976,9 +976,6 @@ int qemuMonitorDelObject(qemuMonitor *mon,
                          const char *objalias,
                          bool report_error);
 
-int qemuMonitorCreateSnapshot(qemuMonitor *mon, const char *name);
-int qemuMonitorDeleteSnapshot(qemuMonitor *mon, const char *name);
-
 int qemuMonitorTransaction(qemuMonitor *mon, virJSONValue **actions)
     ATTRIBUTE_NONNULL(2);
 int qemuMonitorBlockdevMirror(qemuMonitor *mon,
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
deleted file mode 100644 (file)
index 3482972..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * qemu_monitor_text.c: interaction with QEMU monitor console
- *
- * Copyright (C) 2006-2014 Red Hat, Inc.
- * Copyright (C) 2006 Daniel P. Berrange
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-
-#include "qemu_monitor_text.h"
-#include "qemu_monitor_json.h"
-#include "virlog.h"
-#include "virerror.h"
-
-#define VIR_FROM_THIS VIR_FROM_QEMU
-
-VIR_LOG_INIT("qemu.qemu_monitor_text");
-
-int
-qemuMonitorTextCreateSnapshot(qemuMonitor *mon,
-                              const char *name)
-{
-    g_autofree char *cmd = NULL;
-    g_autofree char *reply = NULL;
-
-    cmd = g_strdup_printf("savevm \"%s\"", name);
-
-    if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply))
-        return -1;
-
-    if (strstr(reply, "Error while creating snapshot") ||
-        strstr(reply, "Could not open VM state file") ||
-        strstr(reply, "State blocked by non-migratable device") ||
-        strstr(reply, "Error: ") ||
-        (strstr(reply, "Error") && strstr(reply, "while writing VM"))) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Failed to take snapshot: %1$s"), reply);
-        return -1;
-    } else if (strstr(reply, "No block device can accept snapshots")) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("this domain does not have a device to take snapshots"));
-        return -1;
-    }
-
-    return 0;
-}
-
-int qemuMonitorTextDeleteSnapshot(qemuMonitor *mon, const char *name)
-{
-    g_autofree char *cmd = NULL;
-    g_autofree char *reply = NULL;
-
-    cmd = g_strdup_printf("delvm \"%s\"", name);
-    if (qemuMonitorJSONHumanCommand(mon, cmd, -1, &reply))
-        return -1;
-
-    if (strstr(reply, "No block device supports snapshots")) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("this domain does not have a device to delete snapshots"));
-        return -1;
-    } else if (strstr(reply, "Snapshots not supported on device")) {
-        virReportError(VIR_ERR_OPERATION_INVALID, "%s", reply);
-        return -1;
-    } else if (strstr(reply, "Error: ") ||
-               (strstr(reply, "Error") &&
-                strstr(reply, "while deleting snapshot"))) {
-        virReportError(VIR_ERR_OPERATION_FAILED,
-                       _("Failed to delete snapshot: %1$s"), reply);
-        return -1;
-    }
-
-    return 0;
-}
diff --git a/src/qemu/qemu_monitor_text.h b/src/qemu/qemu_monitor_text.h
deleted file mode 100644 (file)
index 27d0f06..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * qemu_monitor_text.h: interaction with QEMU monitor console
- *
- * Copyright (C) 2006-2009, 2011-2012 Red Hat, Inc.
- * Copyright (C) 2006 Daniel P. Berrange
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "internal.h"
-
-#include "qemu_monitor.h"
-
-int qemuMonitorTextCreateSnapshot(qemuMonitor *mon, const char *name);
-int qemuMonitorTextDeleteSnapshot(qemuMonitor *mon, const char *name);