From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 2A73E1FF173
	for <inbox@lore.proxmox.com>; Mon, 25 Nov 2024 12:01:06 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 69AE610783;
	Mon, 25 Nov 2024 12:00:54 +0100 (CET)
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon, 25 Nov 2024 12:00:42 +0100
Message-Id: <20241125110044.22235-3-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20241125110044.22235-1-f.ebner@proxmox.com>
References: <20241125110044.22235-1-f.ebner@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.054 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH qemu 2/4] async snapshot: code cleanup: use
 error_setg() helper
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 ...async-for-background-state-snapshots.patch | 23 ++++++++-----------
 ...add-optional-buffer-size-to-QEMUFile.patch |  8 +++----
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch b/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
index f1053f4..1fe4648 100644
--- a/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
+++ b/debian/patches/pve/0017-PVE-add-savevm-async-for-background-state-snapshots.patch
@@ -37,13 +37,13 @@ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
  include/migration/snapshot.h |   2 +
  include/monitor/hmp.h        |   3 +
  migration/meson.build        |   1 +
- migration/savevm-async.c     | 540 +++++++++++++++++++++++++++++++++++
+ migration/savevm-async.c     | 537 +++++++++++++++++++++++++++++++++++
  monitor/hmp-cmds.c           |  38 +++
  qapi/migration.json          |  34 +++
  qapi/misc.json               |  18 ++
  qemu-options.hx              |  12 +
  system/vl.c                  |  10 +
- 11 files changed, 688 insertions(+)
+ 11 files changed, 685 insertions(+)
  create mode 100644 migration/savevm-async.c
 
 diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
@@ -141,10 +141,10 @@ index 020127d901..4b0c4f0f51 100644
    'threadinfo.c',
 diff --git a/migration/savevm-async.c b/migration/savevm-async.c
 new file mode 100644
-index 0000000000..4f1ef0ebd8
+index 0000000000..59bb0b57d9
 --- /dev/null
 +++ b/migration/savevm-async.c
-@@ -0,0 +1,540 @@
+@@ -0,0 +1,537 @@
 +#include "qemu/osdep.h"
 +#include "migration/channel-savevm-async.h"
 +#include "migration/migration.h"
@@ -292,7 +292,7 @@ index 0000000000..4f1ef0ebd8
 +    DPRINTF("save_snapshot_error: %s\n", msg);
 +
 +    if (!snap_state.error) {
-+        error_set(&snap_state.error, ERROR_CLASS_GENERIC_ERROR, "%s", msg);
++        error_setg(&snap_state.error, "%s", msg);
 +    }
 +
 +    g_free (msg);
@@ -483,14 +483,12 @@ index 0000000000..4f1ef0ebd8
 +    int bdrv_oflags = BDRV_O_RDWR | BDRV_O_RESIZE | BDRV_O_NO_FLUSH;
 +
 +    if (snap_state.state != SAVE_STATE_DONE) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR,
-+                  "VM snapshot already started\n");
++        error_setg(errp, "VM snapshot already started\n");
 +        return;
 +    }
 +
 +    if (migration_is_running()) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR,
-+                  "There's a migration process in progress");
++        error_setg(errp, "There's a migration process in progress");
 +        return;
 +    }
 +
@@ -522,7 +520,7 @@ index 0000000000..4f1ef0ebd8
 +    qdict_put_str(options, "driver", "raw");
 +    snap_state.target = blk_new_open(statefile, NULL, options, bdrv_oflags, &local_err);
 +    if (!snap_state.target) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
++        error_setg(errp, "failed to open '%s'", statefile);
 +        goto restart;
 +    }
 +
@@ -531,7 +529,7 @@ index 0000000000..4f1ef0ebd8
 +    snap_state.file = qemu_file_new_output(ioc);
 +
 +    if (!snap_state.file) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
++        error_setg(errp, "failed to open '%s'", statefile);
 +        goto restart;
 +    }
 +
@@ -608,8 +606,7 @@ index 0000000000..4f1ef0ebd8
 +void qmp_savevm_end(Error **errp)
 +{
 +    if (snap_state.state == SAVE_STATE_DONE) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR,
-+                  "VM snapshot not started\n");
++        error_setg(errp, "VM snapshot not started\n");
 +        return;
 +    }
 +
diff --git a/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch b/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
index 176ce0a..cd2e2d2 100644
--- a/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
+++ b/debian/patches/pve/0018-PVE-add-optional-buffer-size-to-QEMUFile.patch
@@ -184,10 +184,10 @@ index 11c2120edd..edf3c5d147 100644
  
  /*
 diff --git a/migration/savevm-async.c b/migration/savevm-async.c
-index 4f1ef0ebd8..84e10b2c4c 100644
+index 59bb0b57d9..9a4dd1e4f5 100644
 --- a/migration/savevm-async.c
 +++ b/migration/savevm-async.c
-@@ -381,7 +381,7 @@ void qmp_savevm_start(const char *statefile, Error **errp)
+@@ -379,7 +379,7 @@ void qmp_savevm_start(const char *statefile, Error **errp)
  
      QIOChannel *ioc = QIO_CHANNEL(qio_channel_savevm_async_new(snap_state.target,
                                                                 &snap_state.bs_pos));
@@ -195,8 +195,8 @@ index 4f1ef0ebd8..84e10b2c4c 100644
 +    snap_state.file = qemu_file_new_output_sized(ioc, 4 * 1024 * 1024);
  
      if (!snap_state.file) {
-         error_set(errp, ERROR_CLASS_GENERIC_ERROR, "failed to open '%s'", statefile);
-@@ -505,7 +505,8 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
+         error_setg(errp, "failed to open '%s'", statefile);
+@@ -502,7 +502,8 @@ int load_snapshot_from_blockdev(const char *filename, Error **errp)
      blk_op_block_all(be, blocker);
  
      /* restore the VM state */
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel