From nobody Tue May 7 06:46:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1658320228; cv=none; d=zohomail.com; s=zohoarc; b=Nhc4sv6lmEKwRLgX2TqWKSP0+4JePHZkWltSxG2aI8qL77oIhvJMa4W3blpIS39HXT0VEGVW975BwlW2clkyT8dx+IO3iWt9/XFEt974ptxflheNxrLPKqlCf5Ng/Ud21dnBstDF8xCJ6Vxpzf3m0KS3jVC4Sf/4rQvRlF6gNd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658320228; h=Content-Type:Content-Transfer-Encoding:Cc: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=snHtnQ1C/bN4mc3P3Is2qNDXclnU8t72sAgJtYtmEUg=; b=UbRxdXUUXo7y5nPwXcuRGd8pirOcrwUqoCqS1x2tqqS+rsxUWYrLs5jcemOOsWKBzA3nSx8AerEAAGUZjjv2t3O6kHfBrvH8ZT1Nhwp/ULyACwzfX8bjbAY54c3ToX/0utgQw2IBQSqCouzYJhhXXRksaJlin7Mi4QoCxREmZZ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 16583202283841011.3534518086406; Wed, 20 Jul 2022 05:30:28 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-284-9B71JfyyMW6zNAZxFG7WXA-1; Wed, 20 Jul 2022 08:30:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C589E85A585; Wed, 20 Jul 2022 12:30:16 +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 B2A6E2166B29; Wed, 20 Jul 2022 12:30:16 +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 747AE19452D8; Wed, 20 Jul 2022 12:30:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 43F731947066 for ; Wed, 20 Jul 2022 12:16:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 125091121320; Wed, 20 Jul 2022 12:16:03 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2B421121315; Wed, 20 Jul 2022 12:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658320227; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=snHtnQ1C/bN4mc3P3Is2qNDXclnU8t72sAgJtYtmEUg=; b=eLqdWX0QPRF1nTGcBpVThpFQU+8mGAZoTfurqpRgzUHWaEOoqB55sjBzhAhQ35zi/d20SR awZE56pVa17kgyspToBf9bBXRqkBCmNkmr6cQ6doqtuTU2nZgJXBiKICGp6vjwT8Y0Bv6z RbPIE1T9uzxw9oJ9VZLHQ4O+X4m3h+A= X-MC-Unique: 9B71JfyyMW6zNAZxFG7WXA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: libvir-list@redhat.com Subject: [libvirt PATCH v3 1/4] qemu: introduce capability QEMU_CAPS_MIGRATION_BLOCKED_REASONS Date: Wed, 20 Jul 2022 14:15:55 +0200 Message-Id: <20220720121558.3150209-2-eperezma@redhat.com> In-Reply-To: <20220720121558.3150209-1-eperezma@redhat.com> References: <20220720121558.3150209-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: , Cc: Laurent Vivier , Jason Wang , Laine Stump , Jiri Denemark , Jaroslav Suchanek Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658320230703100001 From: Jonathon Jongsma since qemu 6.0, if migration is blocked for some reason, 'query-migrate' will return an array of error strings describing the migration blockers. This can be used to check whether there are any devices blocking migration, etc. Signed-off-by: Jonathon Jongsma Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Jiri Denemark --- v3: s/QEMU_MIGRATION_BLOCKED_REASONS/QEMU_CAPS_MIGRATION_BLOCKED_REASONS/ --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 + 13 files changed, 14 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 30b396d32d..b002fb98ed 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -672,6 +672,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "display-dbus", /* QEMU_CAPS_DISPLAY_DBUS */ "iothread.thread-pool-max", /* QEMU_CAPS_IOTHREAD_THREAD_POO= L_MAX */ "usb-host.guest-resets-all", /* QEMU_CAPS_USB_HOST_GUESTS_RE= SETS_ALL */ + "migration.blocked-reasons", /* QEMU_CAPS_MIGRATION_BLOCKED_= REASONS */ ); =20 =20 @@ -1622,6 +1623,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSc= hemaQueries[] =3D { { "chardev-add/arg-type/backend/+qemu-vdagent", QEMU_CAPS_CHARDEV_QEMU= _VDAGENT }, { "query-display-options/ret-type/+dbus", QEMU_CAPS_DISPLAY_DBUS }, { "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_= THREAD_POOL_MAX }, + { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKE= D_REASONS }, }; =20 typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index d979a5ba3b..8f3090e2ce 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -651,6 +651,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_DISPLAY_DBUS, /* -display dbus */ QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX, /* -object iothread.thread-pool-ma= x */ QEMU_CAPS_USB_HOST_GUESTS_RESETS_ALL, /* -device usb-host.guest-resets= -all */ + QEMU_CAPS_MIGRATION_BLOCKED_REASONS, /* query-migrate returns 'blocked= -reasons */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_6.0.0.aarch64.xml index 01e30f4e02..4afd7b26ce 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml @@ -187,6 +187,7 @@ + 6000000 0 61700242 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_6.0.0.s390x.xml index aa7b5deab5..c9cb85daa0 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml @@ -144,6 +144,7 @@ + 6000000 0 39100242 diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.0.0.x86_64.xml index d9e385ab1d..508804521c 100644 --- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml @@ -229,6 +229,7 @@ + 6000000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.1.0.x86_64.xml index 05f297dfa2..d4a540fafd 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml @@ -234,6 +234,7 @@ + 6001000 0 43100243 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_6.2.0.aarch64.xml index 9cb1a32354..71697fac95 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml @@ -199,6 +199,7 @@ + 6001050 0 61700244 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_6.2.0.ppc64.xml index 5df148d787..3f86e03f18 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml @@ -193,6 +193,7 @@ + 6002000 0 42900244 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.2.0.x86_64.xml index dd011f8408..1a1a9643d4 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml @@ -236,6 +236,7 @@ + 6002000 0 43100244 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_7.0.0.aarch64.xml index 39a5cd154d..a3991e9853 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml @@ -207,6 +207,7 @@ + 6002092 0 61700243 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_7.0.0.ppc64.xml index 6e872f4f85..67dff32f50 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml @@ -211,6 +211,7 @@ + 7000000 0 42900243 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.0.0.x86_64.xml index a8f46df1cd..8ce423557e 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml @@ -241,6 +241,7 @@ + 7000000 0 43100243 diff --git a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.1.0.x86_64.xml index 8464909698..2b2f1aef52 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml @@ -242,6 +242,7 @@ + 7000050 0 43100244 --=20 2.31.1 From nobody Tue May 7 06:46:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1658320236; cv=none; d=zohomail.com; s=zohoarc; b=UfH51K6HuGk0jTg9S0myAVYIDjURkXsnN7ANZYSsaFnCV8Sbivl1K7HOMMUz4xlyXcqE3uVPPu+oscCDJmOu89JIJgfNULi6AlQoQXbtU2nhcNEel86jCHDlCrxYcAPn7ZMdhfkYDXTuup43c0UtNRWvHt1yiEhr7HguhE349YI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658320236; h=Content-Type:Content-Transfer-Encoding:Cc: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=CATkul8vBX6GxEDXeqqc4OkPIWtgZHbAfH308YPj578=; b=PnO9viluyow+0MjwNnXqdAuQvybVd+3dpXPynjNvX/UXq9YQ4zgOu6lbT5JthDaGI1TBXZiKy4TxgYQS+hRyzMTozlNfrvSxi3lA8i0d2fXeiVH6Z1kBLtXw3LoyydnjEFp/syWfQYBhtQGCDzaa/eA4meY2wSTlcY9BhvdEq0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1658320236147133.63630175594324; Wed, 20 Jul 2022 05:30:36 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-mD2VAM3jNkahcf4qSDT11Q-1; Wed, 20 Jul 2022 08:30:20 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CAEE6824065; Wed, 20 Jul 2022 12:30:17 +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 B61A1492CA6; Wed, 20 Jul 2022 12:30:17 +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 844791923C93; Wed, 20 Jul 2022 12:30:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8ED3C1947066 for ; Wed, 20 Jul 2022 12:16:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 744EA1121315; Wed, 20 Jul 2022 12:16:04 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55DDF1121314; Wed, 20 Jul 2022 12:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658320234; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=CATkul8vBX6GxEDXeqqc4OkPIWtgZHbAfH308YPj578=; b=BfUZ4E3HN2xKee6z532eMwqa/N0Inb1oHiYe/nv4Wc4JTKG8eDyTmeSASJIuaSZqm/frHG rZ1DAB5pdJfvkjIihLRFA+dox8i76ktLUzBUfl0w+D0bkJD/U6Csdv9MZVEpDcaSimBIsS QG66ajHoAgRD2adz2wK6tcLgGacZRq8= X-MC-Unique: mD2VAM3jNkahcf4qSDT11Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: libvir-list@redhat.com Subject: [libvirt PATCH v3 2/4] qemu_monitor: add support for get qemu migration blockers Date: Wed, 20 Jul 2022 14:15:56 +0200 Message-Id: <20220720121558.3150209-3-eperezma@redhat.com> In-Reply-To: <20220720121558.3150209-1-eperezma@redhat.com> References: <20220720121558.3150209-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: , Cc: Laurent Vivier , Jason Wang , Laine Stump , Jiri Denemark , Jaroslav Suchanek Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658320237975100001 since qemu 6.0, if migration is blocked for some reason, 'query-migrate' will return an array of error strings describing the migration blockers. This can be used to check whether there are any devices blocking migration, etc. Enable qemu monitor to send this query. This will allow qemuMigrationSrcIsAllowed to dynamically ask for migration blockers, reducing duplication. Signed-off-by: Eugenio P=C3=A9rez Reviewed-by: Jiri Denemark --- v3: * Squash some patches * Return ok in qemuMonitorJSONGetMigrationBlockers is there are no blockers. * Move note to function doc. --- src/qemu/qemu_monitor.c | 11 +++++++++ src/qemu/qemu_monitor.h | 4 ++++ src/qemu/qemu_monitor_json.c | 43 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 4 files changed, 61 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 109107eaae..e0939beecd 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4486,3 +4486,14 @@ qemuMonitorMigrateRecover(qemuMonitor *mon, =20 return qemuMonitorJSONMigrateRecover(mon, uri); } + +int +qemuMonitorGetMigrationBlockers(qemuMonitor *mon, + char ***blockers) +{ + VIR_DEBUG("blockers=3D%p", blockers); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONGetMigrationBlockers(mon, blockers); +} diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index cc1a0bc8c9..b82f198285 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1543,3 +1543,7 @@ qemuMonitorChangeMemoryRequestedSize(qemuMonitor *mon, int qemuMonitorMigrateRecover(qemuMonitor *mon, const char *uri); + +int +qemuMonitorGetMigrationBlockers(qemuMonitor *mon, + char ***blockers); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 5e4a86e5ad..6d15a458a3 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3338,6 +3338,49 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon, return 0; } =20 +/* + * Get the exposed migration blockers. + * + * This function assume qemu has the capability of request them. + * + * It returns a NULL terminated array on blockers if there are any, or it = set + * it to NULL otherwise. + */ +int qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon, + char ***blockers) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + virJSONValue *data; + virJSONValue *jblockers; + size_t i; + + *blockers =3D NULL; + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-migrate", NULL))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT) < 0) + return -1; + + data =3D virJSONValueObjectGetObject(reply, "return"); + + if (!(jblockers =3D virJSONValueObjectGetArray(data, "blocked-reasons"= ))) + return 0; + + *blockers =3D g_new0(char *, virJSONValueArraySize(jblockers) + 1); + for (i =3D 0; i < virJSONValueArraySize(jblockers); i++) { + virJSONValue *jblocker =3D virJSONValueArrayGet(jblockers, i); + const char *blocker =3D virJSONValueGetString(jblocker); + + (*blockers)[i] =3D g_strdup(blocker); + } + + return 0; +} + int qemuMonitorJSONMigrateCancel(qemuMonitor *mon) { g_autoptr(virJSONValue) cmd =3D qemuMonitorJSONMakeCommand("migrate_ca= ncel", NULL); diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 2759566892..e4c65e250e 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -184,6 +184,9 @@ qemuMonitorJSONMigrate(qemuMonitor *mon, unsigned int flags, const char *uri); int +qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon, + char ***blockers); +int qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitor *mon, bool *spice_migrated); =20 --=20 2.31.1 From nobody Tue May 7 06:46:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1658320736; cv=none; d=zohomail.com; s=zohoarc; b=lr+L+6w/4hcHahjn+XHwqjnKRCYOgir7SIttHExwF75Lbiopi+hihTf59A7S9H23qUsmc1JCDq71YD8DbXpU4MCYXER3IpSCIMXCEk1LDsuzhC3jh3DhPaUwS47wMKmy/yBpxz+nTPdXxNz9FAhjR1ejNcUlPUllg1XFCgwJZb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658320736; h=Content-Type:Content-Transfer-Encoding:Cc: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=0ci2EZA55ysEWdocMnDtvx2lOPOEukpH1ag48bHdIuw=; b=J9O3qukzDluqi8I1iR2jk5kgOKR9rpo5zC7QHlQ7GYXQ/xyNyeMziBb0G8IQE9T9jr57SZzustLTbw8TRoO+DuuL3SQZrPtHKrvR9yl+81tfpmxZAjDBnHVEWp+QKDrdnB06JjhIx7OJhG4FzEss+LZaAGmQoi6gHx2oyZA6PxY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1658320736878114.1894021744829; Wed, 20 Jul 2022 05:38:56 -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-110-m2LXWVvyP0GX21SWPnsaYw-1; Wed, 20 Jul 2022 08:38:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD9E03817A7C; Wed, 20 Jul 2022 12:38:51 +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 732EF2166B26; Wed, 20 Jul 2022 12:38:51 +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 0CE411935016; Wed, 20 Jul 2022 12:38:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E308C1947066 for ; Wed, 20 Jul 2022 12:16:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D57631121315; Wed, 20 Jul 2022 12:16:05 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7A1C1121314; Wed, 20 Jul 2022 12:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658320735; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=0ci2EZA55ysEWdocMnDtvx2lOPOEukpH1ag48bHdIuw=; b=EmKdBS/ZXA5mtDsWmLcqxE3Nb+G62hK0NLtOdjm1RNyZR4W6/Uo5i4K94R3LJlcBCpp3aC wUDdjV6PzVRnSa7B+VpwsQy5owDfENhWpwMvl7RLlwf4SklUzmPwSwcF6R8NNnWRQMHcl6 VhQrVLrp60AHQKn3rzlCyD+Fd0GZNZI= X-MC-Unique: m2LXWVvyP0GX21SWPnsaYw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: libvir-list@redhat.com Subject: [libvirt PATCH v3 3/4] qemu_migration: get migration blockers before hardcoded checks Date: Wed, 20 Jul 2022 14:15:57 +0200 Message-Id: <20220720121558.3150209-4-eperezma@redhat.com> In-Reply-To: <20220720121558.3150209-1-eperezma@redhat.com> References: <20220720121558.3150209-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: , Cc: Laurent Vivier , Jason Wang , Laine Stump , Jiri Denemark , Jaroslav Suchanek Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658320737421100001 since qemu 6.0, if migration is blocked for some reason, 'query-migrate' will return an array of error strings describing the migration blockers. This can be used to check whether there are any devices blocking migration, etc. Enable qemuMigrationSrcIsAllowed to query it. Signed-off-by: Eugenio P=C3=A9rez --- v3: * Report message with a colon. * Report all blockers instead of only the first. --- src/qemu/qemu_migration.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b12cb518ee..6ac4ef150b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1414,6 +1414,20 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef = *def) return true; } =20 +static int +qemuDomainGetMigrationBlockers(virQEMUDriver *driver, + virDomainObj *vm, + char ***blockers) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + int rc; + + qemuDomainObjEnterMonitor(driver, vm); + rc =3D qemuMonitorGetMigrationBlockers(priv->mon, blockers); + qemuDomainObjExitMonitor(vm); + + return rc; +} =20 /** * qemuMigrationSrcIsAllowed: @@ -1439,6 +1453,26 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, int nsnapshots; int pauseReason; size_t i; + int r; + + /* Ask qemu if it have a migration blocker */ + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS= )) { + g_auto(GStrv) blockers =3D NULL; + r =3D qemuDomainGetMigrationBlockers(driver, vm, &blockers); + if (r !=3D 0) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("cannot migrate domain: %s"), + _("error getting blockers")); + return false; + } + + if (blockers && blockers[0]) { + g_autofree char *reasons =3D g_strjoinv(", ", blockers); + virReportError(VIR_ERR_OPERATION_INVALID, + _("cannot migrate domain: %s"), reasons); + return false; + } + } =20 /* perform these checks only when migrating to remote hosts */ if (remote) { --=20 2.31.1 From nobody Tue May 7 06:46:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1658320013; cv=none; d=zohomail.com; s=zohoarc; b=WadN1UfjnMN05ILb/Tk8+09XciVlg7z7nJ9uNwNCDTkKfzgudCI9AVKwn+miHxZGYFTFfGFibpm7dTpqE5sqmJOTkVEqfkobXSrA+vbxlTJAxG+M/Nc6joabXdjf8Dvpd3U0p9Zx9nAHefq95esi7o0V7xhX7pqJjaq32Tg5Nts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658320013; h=Content-Type:Content-Transfer-Encoding:Cc: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=QdDHr0Ak+npuhOVSIjtbTqmrWANAGVMpToc1jRSemaY=; b=e6GgBDMGBQtfhgHNUWxOm7ewur+nE1LQPwPyZGFeGv1Hx6FGr4CcXJHk7Fkjq08j96UMDi2+Qko7M8SZkNN0gKqcbsIAURpddSvWX7uZVwiKde6b6fMMXjNospB5asyV3TG92Lfp2qOUPI/ItTZdvoe12TU0/r8utQdrz5eG2ws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1658320013921984.7138599699789; Wed, 20 Jul 2022 05:26:53 -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-612-oqkoBy23MO2rKmMdYJkBZw-1; Wed, 20 Jul 2022 08:26:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5C913804069; Wed, 20 Jul 2022 12:26:48 +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 C120840CF8ED; Wed, 20 Jul 2022 12:26:46 +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 84F07194706C; Wed, 20 Jul 2022 12:26:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 599A11947066 for ; Wed, 20 Jul 2022 12:16:07 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 49E45112131B; Wed, 20 Jul 2022 12:16:07 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23D781121314; Wed, 20 Jul 2022 12:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658320012; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=QdDHr0Ak+npuhOVSIjtbTqmrWANAGVMpToc1jRSemaY=; b=K1qUlEEaM94Dm0GfYPq4ZCMLgbjM/TxS1SfqO/mBa+ThqLNQmJG60OZOAynVBkrkybG9UC nwqTwA754v8crHYg9DFVvxs+NS8MUIkqhMQCbSjO14IKeFFeCleNBhg8unNzB1gvCnXxrj T31eTRC1lIPGLP0DIEDmblE6vkB0Q30= X-MC-Unique: oqkoBy23MO2rKmMdYJkBZw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: libvir-list@redhat.com Subject: [libvirt PATCH v3 4/4] qemu_migration: Do not forbid vDPA devices if can query blockers Date: Wed, 20 Jul 2022 14:15:58 +0200 Message-Id: <20220720121558.3150209-5-eperezma@redhat.com> In-Reply-To: <20220720121558.3150209-1-eperezma@redhat.com> References: <20220720121558.3150209-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: , Cc: Laurent Vivier , Jason Wang , Laine Stump , Jiri Denemark , Jaroslav Suchanek Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658320014788100003 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=C3=A9rez Reviewed-by: Jiri Denemark --- 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 =3D virQEMUCapsGet(priv->qemuCaps, + QEMU_CAPS_MIGRATION_BLOCKED_RE= ASONS); =20 /* Ask qemu if it have a migration blocker */ - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS= )) { + if (blockedReasonsCap) { g_auto(GStrv) blockers =3D NULL; r =3D qemuDomainGetMigrationBlockers(driver, vm, &blockers); if (r !=3D 0) { @@ -1467,7 +1469,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, } =20 if (blockers && blockers[0]) { - g_autofree char *reasons =3D g_strjoinv(", ", blockers); + g_autofree char *reasons =3D g_strjoinv("; ", blockers); virReportError(VIR_ERR_OPERATION_INVALID, _("cannot migrate domain: %s"), reasons); return false; @@ -1580,7 +1582,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver, virDomainNetDef *net =3D vm->def->nets[i]; qemuSlirp *slirp; =20 - if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_VDPA) { + if (!blockedReasonsCap && net->type =3D=3D VIR_DOMAIN_NET_TYPE= _VDPA) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("vDPA devices cannot be migrated")); return false; --=20 2.31.1