From nobody Sun Feb 8 13:16:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652196128; cv=none; d=zohomail.com; s=zohoarc; b=PFmNboXR/ecJ6leAMUhRRsbMwv3hBdZZR52mbahyx0D6JxDGOoAvo1af4k5KleM2yUVsvxaeOKbh/nHVSOBTXaJ15IxVcujb7rTtazpvmoq7P0VIiIESleKUGlKYFRuxzO21gGLd4EKMme/ElQSoIfuB2fvl8JKrR5iwZUo46Z4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652196128; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pUJZ5HSK8zN5hO3O5f03vm6O4/LP3pNfcHnJkjGUfYg=; b=PRKpsPGY7ewxwewZJ6mJ/hMzGJ3aE+Cein3hjHrPwWKG7PiJj+ef9+RbxOXi4yG3I+HoHmJiY9fLFmby9ROB9gffg3LA4KPL4e9jLvpvbKF9EmgMIJjVO7TJjZW8nKuxmmSoOK1quAFofwiUfTfQ3lM80bBjDztwb+STlR8wrGo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652196128485424.2694659968255; Tue, 10 May 2022 08:22:08 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-271-8FkmZURsMUipab5cJg3m3A-1; Tue, 10 May 2022 11:21:55 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06C122919EB3; Tue, 10 May 2022 15:21:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD4E714E09E0; Tue, 10 May 2022 15:21:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 91089194706D; Tue, 10 May 2022 15:21:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B8A9C194704D for ; Tue, 10 May 2022 15:21:44 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A9A69463EDE; Tue, 10 May 2022 15:21:44 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A5F3463E1C for ; Tue, 10 May 2022 15:21:44 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 76EEB2445E8; Tue, 10 May 2022 17:21:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652196127; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pUJZ5HSK8zN5hO3O5f03vm6O4/LP3pNfcHnJkjGUfYg=; b=hS107TSQfU3CiUD9DrsEbivBUl+QcC6Qp3Vid/5a6zfUljaSjeP9b0Z07jv4IhAIgmc5zC DCi7aYUOSg7ZNnM46OdneYXgbVgSSk8cp3v4N9Fr+ZckzY5/Aw3vXokgDOAhzcf7k6DeeX k43jcZW/YZnns71ZNR2hOLg6w+/X4ow= X-MC-Unique: 8FkmZURsMUipab5cJg3m3A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 04/80] qemu: Enable migration events only when disabled Date: Tue, 10 May 2022 17:20:25 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652196130514100007 Content-Type: text/plain; charset="utf-8" When connecting to a QEMU monitor, we always try to enable migration events, but this is an invalid operation during migration. Thus reconnecting to a domain with active migration would fail. Let's check the state of migration events capability and only try to enable it when it is disabled. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_migration_params.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 34416f89be..ed2d9ac103 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1391,13 +1391,16 @@ qemuMigrationCapsCheck(virQEMUDriver *driver, g_autoptr(virBitmap) migEvent =3D NULL; g_autoptr(virJSONValue) json =3D NULL; g_auto(GStrv) caps =3D NULL; + g_autoptr(virBitmap) capState =3D NULL; + g_autoptr(virBitmap) enabled =3D virBitmapNew(QEMU_MIGRATION_CAP_LAST); char **capStr; + size_t i; int rc; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; =20 - rc =3D qemuMonitorGetMigrationCapabilities(priv->mon, &caps, NULL); + rc =3D qemuMonitorGetMigrationCapabilities(priv->mon, &caps, &capState= ); =20 qemuDomainObjExitMonitor(vm); if (rc < 0) @@ -1408,7 +1411,7 @@ qemuMigrationCapsCheck(virQEMUDriver *driver, =20 priv->migrationCaps =3D virBitmapNew(QEMU_MIGRATION_CAP_LAST); =20 - for (capStr =3D caps; *capStr; capStr++) { + for (i =3D 0, capStr =3D caps; *capStr; capStr++, i++) { int cap =3D qemuMigrationCapabilityTypeFromString(*capStr); =20 if (cap < 0) { @@ -1416,10 +1419,20 @@ qemuMigrationCapsCheck(virQEMUDriver *driver, } else { ignore_value(virBitmapSetBit(priv->migrationCaps, cap)); VIR_DEBUG("Found migration capability: '%s'", *capStr); + + if (virBitmapIsBitSet(capState, i)) + ignore_value(virBitmapSetBit(enabled, cap)); } } =20 - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) { + if (virBitmapIsBitSet(enabled, QEMU_MIGRATION_CAP_EVENTS)) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) { + VIR_DEBUG("Migration events already enabled"); + } else { + VIR_DEBUG("Migration events enabled; setting capability"); + virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT); + } + } else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) { migEvent =3D virBitmapNew(QEMU_MIGRATION_CAP_LAST); =20 ignore_value(virBitmapSetBit(migEvent, QEMU_MIGRATION_CAP_EVENTS)); --=20 2.35.1