[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/10] migration: factor out "resume_requested" in qmp_migrate()
From: |
Michael Tokarev |
Subject: |
[PULL 08/10] migration: factor out "resume_requested" in qmp_migrate() |
Date: |
Sat, 8 Jul 2023 08:12:48 +0300 |
From: Laszlo Ersek <lersek@redhat.com>
It cuts back on those awkward, duplicated !(has_resume && resume)
expressions.
Cc: Juan Quintela <quintela@redhat.com> (maintainer:Migration)
Cc: Leonardo Bras <leobras@redhat.com> (reviewer:Migration)
Cc: Peter Xu <peterx@redhat.com> (reviewer:Migration)
Cc: qemu-trivial@nongnu.org
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2018404
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
migration/migration.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 096e8191d1..a60a5acee5 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1637,6 +1637,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
bool has_resume, bool resume, Error **errp)
{
+ bool resume_requested;
Error *local_err = NULL;
MigrationState *s = migrate_get_current();
const char *p = NULL;
@@ -1646,13 +1647,14 @@ void qmp_migrate(const char *uri, bool has_blk, bool
blk,
return;
}
+ resume_requested = has_resume && resume;
if (!migrate_prepare(s, has_blk && blk, has_inc && inc,
- has_resume && resume, errp)) {
+ resume_requested, errp)) {
/* Error detected, put into errp */
return;
}
- if (!(has_resume && resume)) {
+ if (!resume_requested) {
if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) {
return;
}
@@ -1671,7 +1673,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
} else if (strstart(uri, "fd:", &p)) {
fd_start_outgoing_migration(s, p, &local_err);
} else {
- if (!(has_resume && resume)) {
+ if (!resume_requested) {
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
}
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri",
@@ -1683,7 +1685,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
}
if (local_err) {
- if (!(has_resume && resume)) {
+ if (!resume_requested) {
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
}
migrate_fd_error(s, local_err);
--
2.39.2
- [PULL trival-patches 00/10] trivial-patches for 2023-07-08, Michael Tokarev, 2023/07/08
- [PULL 01/10] hw/riscv/virt.c: fix typo in 'aia' description, Michael Tokarev, 2023/07/08
- [PULL 02/10] target/avr: Fix handling of interrupts above 33., Michael Tokarev, 2023/07/08
- [PULL 03/10] trivial: man page: document display::gtk::zoom-to-fit, Michael Tokarev, 2023/07/08
- [PULL 06/10] vdpa: Sort vdpa_feature_bits array alphabetically, Michael Tokarev, 2023/07/08
- [PULL 04/10] hw: Simplify calls to pci_nic_init_nofail(), Michael Tokarev, 2023/07/08
- [PULL 05/10] vdpa: Delete duplicated VIRTIO_NET_F_RSS in vdpa_feature_bits, Michael Tokarev, 2023/07/08
- [PULL 07/10] qemu-options.hx: Fix indentation of some option descriptions, Michael Tokarev, 2023/07/08
- [PULL 10/10] hw/arm/virt-acpi-build.c: Add missing header, Michael Tokarev, 2023/07/08
- [PULL 08/10] migration: factor out "resume_requested" in qmp_migrate(),
Michael Tokarev <=
- [PULL 09/10] migration: unexport migrate_fd_error(), Michael Tokarev, 2023/07/08
- Re: [PULL trival-patches 00/10] trivial-patches for 2023-07-08, Richard Henderson, 2023/07/08