On Wed, Jul 20, 2022 at 4:02 PM Jiri Denemark <jdenemar(a)redhat.com> wrote:
On Wed, Jul 20, 2022 at 14:15:58 +0200, Eugenio Pérez wrote:
> vDPA devices will be migratable soon. Since they are not migratable
> before qemu 6.0, and qemu pre-6.0 didn't have the capability of asking
> for migration blockers, let it hardcoded in that case.
>
> Otherwise, ask qemu about the explicit blocker.
>
> Signed-off-by: Eugenio Pérez <eperezma(a)redhat.com>
> ---
> v3: Fix indentation
> ---
> src/qemu/qemu_migration.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index 6ac4ef150b..45e16242f0 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -1454,9 +1454,11 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
> int pauseReason;
> size_t i;
> int r;
> + bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
> + QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
>
> /* Ask qemu if it have a migration blocker */
> - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) {
> + if (blockedReasonsCap) {
> g_auto(GStrv) blockers = NULL;
> r = qemuDomainGetMigrationBlockers(driver, vm, &blockers);
> if (r != 0) {
> @@ -1467,7 +1469,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
> }
>
> if (blockers && blockers[0]) {
> - g_autofree char *reasons = g_strjoinv(", ", blockers);
> + g_autofree char *reasons = g_strjoinv("; ", blockers);
> virReportError(VIR_ERR_OPERATION_INVALID,
> _("cannot migrate domain: %s"), reasons);
> return false;
This hunk should be squashed into the previous patch.
Sorry, I squashed in the wrong patch, I'll send v4 with this.
Thanks!
> @@ -1580,7 +1582,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver
*driver,
> virDomainNetDef *net = vm->def->nets[i];
> qemuSlirp *slirp;
>
> - if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
> + if (!blockedReasonsCap && net->type ==
VIR_DOMAIN_NET_TYPE_VDPA) {
> virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> _("vDPA devices cannot be migrated"));
> return false;
With that change
Reviewed-by: Jiri Denemark <jdenemar(a)redhat.com>