From nobody Tue Apr 30 09:47:34 2024 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=1658308332; cv=none; d=zohomail.com; s=zohoarc; b=D6Nk1jPFdlTwt+aBGhqcT6TFBS9ichnmspLBE/ClqUDyipbXzLeiXmrerh2sShQvjW3C9eeE4AK7AKLePLHyVba/vXk47MXRFlGpGFFnJAFnFf1EYcbUDSUcsKPS+O+XIqXypkQPq3xx6T5HoiAzLr8OhAUTppxTbCB2gR9cmyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658308332; 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=ycqXpMaV3++XaJbmBXigfNIAPn/yg5qQUs2qv6p9oR0=; b=fLTnYEG5g4kA3cb/GfzP/83ktsEQrtq1v2QrStHQBGDD1zZvgacLCDs4+W5kIiXctbk9FFlTqk/AnhH+XeprTpz4H5bsJgJYHO8ZuJx22yMMPEWY+FHwRl4RAUZbvZNQXvYmCEGtzNvD7lrkgRqHESupq6abCoOvt5gYTIgDPIg= 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 1658308332146111.26801939788174; Wed, 20 Jul 2022 02:12:12 -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-609-Ag1N9dCcNjGMeYPr3buymg-1; Wed, 20 Jul 2022 05:12:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07CDC3802BA7; Wed, 20 Jul 2022 09:12:01 +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 6439BC33B1E; Wed, 20 Jul 2022 09:12:00 +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 3E7411947067; Wed, 20 Jul 2022 09:12:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9105D194705F for ; Wed, 20 Jul 2022 09:11:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 796952027EB4; Wed, 20 Jul 2022 09:11:59 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 515C82026D64; Wed, 20 Jul 2022 09:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658308331; 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=ycqXpMaV3++XaJbmBXigfNIAPn/yg5qQUs2qv6p9oR0=; b=d7emjyGrUydfx2/xK3+teykzgg17T1diiLBFfpBb9dEoihlESwyMShvOxvUPCbbG8Y2ukP cspztOUDpdZuFodftirKdDH6vqd9ztP6s2epu5FGfo6Lmn5Gzc+/qQP5WewNwmOIBgkYOS JqJQu9P/EivnQKaV3uveGqzdePGeTiI= X-MC-Unique: Ag1N9dCcNjGMeYPr3buymg-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 v2 1/5] qemu: introduce capability QEMU_MIGRATION_BLOCKED_REASONS Date: Wed, 20 Jul 2022 11:11:50 +0200 Message-Id: <20220720091154.3135061-2-eperezma@redhat.com> In-Reply-To: <20220720091154.3135061-1-eperezma@redhat.com> References: <20220720091154.3135061-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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 , Jiri Denemark , Jaroslav Suchanek Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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: 1658308332467100005 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 --- 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 Apr 30 09:47:34 2024 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=1658308327; cv=none; d=zohomail.com; s=zohoarc; b=ISJSihkJcB2yvkIjAmtH7nhbSdkEtu9mS/HpsbwbI7njnoPSqSKEOdfGi7FlCNpAPmbZxKSFqBfUQmBMTkLM7K6IUdfZWJ/6n8jh0eQNZaiiB/ZnzNeAHaeQ3i46JoUepIqfceJTK8OMVfkR2Iy0Em29uslCxYQNp+cKQvV+Cck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658308327; 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=fmglLn8xFbO7bSeG5tWrAoPdwt+J0V0GhRfkYdD8FkQ=; b=mvTFUuAi1fCgAj4AtGNMNSvfqvhNDP1VIrA0s4Q59UtofM8y7/RXM1G7IC/AGFxBylyIYdtiLsUsa4s3bukNBrztwDr53vbcWfwXc3KCfmmd1tYLTbxLdBp/G+9Cu2Q9+FOGhFzqXfOMCnCD3sQ6hExG31LDUCv5YNSk7pTeJWY= 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 1658308327966742.1295363461098; Wed, 20 Jul 2022 02:12:07 -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-533-6yW_s6axMu6nI6F7t7qfyA-1; Wed, 20 Jul 2022 05:12:05 -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 67C7585A586; Wed, 20 Jul 2022 09:12:02 +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 4CC68492C3B; Wed, 20 Jul 2022 09:12:02 +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 091E01947066; Wed, 20 Jul 2022 09:12:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C6367194705F for ; Wed, 20 Jul 2022 09:12:00 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B82DA202699A; Wed, 20 Jul 2022 09:12:00 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA6CB2026D64; Wed, 20 Jul 2022 09:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658308327; 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=fmglLn8xFbO7bSeG5tWrAoPdwt+J0V0GhRfkYdD8FkQ=; b=FxT7XIq3LnqAWVdYFXa2LduEO6uBSi9ATIwZJhYi0z3UktLdJ+cH8pcWUAOYJQY6UqkTXK 4MPs76oS5sIn6IICYlQSqxZOz8hniGddWLOk0qH4dWyYua8/0ar3pP1kPEIQKolW4H7a+O r8gy5FX4IKejvBSx0lTEbvdW/hPSHGA= X-MC-Unique: 6yW_s6axMu6nI6F7t7qfyA-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 v2 2/5] qemu_monitor_json: Add qemuMonitorJSONGetMigrationBlockers Date: Wed, 20 Jul 2022 11:11:51 +0200 Message-Id: <20220720091154.3135061-3-eperezma@redhat.com> In-Reply-To: <20220720091154.3135061-1-eperezma@redhat.com> References: <20220720091154.3135061-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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 , 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: 1658308328460100001 This will allow qemuMigrationSrcIsAllowed to dynamically ask for migration blockers, reducing duplication. Signed-off-by: Eugenio P=C3=A9rez --- src/qemu/qemu_monitor_json.c | 35 +++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 +++ 2 files changed, 38 insertions(+) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 5e4a86e5ad..a53d721720 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3338,6 +3338,41 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon, return 0; } =20 +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; + + 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 -1; + + /* NULL terminated array */ + *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 Apr 30 09:47:34 2024 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=1658308332; cv=none; d=zohomail.com; s=zohoarc; b=PERycE6GA89JkH+5K58Gk/tfFGJtShCCR+T8yIjWBjX2Cfi7ZU27iHbrALmSXe7dN/NUdUrqiR+bzCvyHUnsPXMBHUVUpBaOeYQ1/NDM9erC2bhCYQLrOLzARJVYIACrCigIK8jU1/PmH8S8l8Lw91tH1XBUZCfjvkU95TBkBiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658308332; 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=LfujWk7k5Yw2s/SYq2R09Nfswp66czmoBoGOXW/ULvo=; b=gkoa+GIqkqEdhr7xEC+WaoW3hfFpql0HsD1C5PtkuIzeUvAhwekt4DanT2xsgB1rfJfaJCbBl7jeJ3jNzbpOUTCu06vs+xsQgDAtJ2mnHWo2Ex4WtEc7PsJFmP9X3msUpWCTuVc7XlVK4K6oXHY6d5pF4kAeNga8UY/HJ9cnsh8= 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 1658308332723739.8502009835204; Wed, 20 Jul 2022 02:12:12 -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-599-bIvpVNnjNf6qyyGXm2ZR-w-1; Wed, 20 Jul 2022 05:12:06 -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 CF9C41029F77; Wed, 20 Jul 2022 09:12:03 +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 B5FD0141511A; Wed, 20 Jul 2022 09:12:03 +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 8C7F21947066; Wed, 20 Jul 2022 09:12:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7A2111945DA7 for ; Wed, 20 Jul 2022 09:12:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4E00C202699A; Wed, 20 Jul 2022 09:12:02 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 408C22024CBD; Wed, 20 Jul 2022 09:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658308331; 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=LfujWk7k5Yw2s/SYq2R09Nfswp66czmoBoGOXW/ULvo=; b=U8x0QkLYGp3tEhpUoBXLI5petNxxTLYyJJiBI7ZXxiBEG6WfaJmfhhAZSVzxHQUtGnfbMA cqX/1eEj4Zz2dRrqYeiQdDaie5wsHQ0jDlNtjvlOsc4vdQovhdAktVBZUbtkKTOgdk+0J4 xYlPXQ4kdqMRWQls6Sulox9NamD8Ocg= X-MC-Unique: bIvpVNnjNf6qyyGXm2ZR-w-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 v2 3/5] qemu_monitor: add support for get qemu migration blockers Date: Wed, 20 Jul 2022 11:11:52 +0200 Message-Id: <20220720091154.3135061-4-eperezma@redhat.com> In-Reply-To: <20220720091154.3135061-1-eperezma@redhat.com> References: <20220720091154.3135061-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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 , Jiri Denemark , Jaroslav Suchanek 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1658308334457100009 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. Signed-off-by: Eugenio P=C3=A9rez --- src/qemu/qemu_monitor.c | 11 +++++++++++ src/qemu/qemu_monitor.h | 4 ++++ 2 files changed, 15 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); --=20 2.31.1 From nobody Tue Apr 30 09:47:34 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=1658308332; cv=none; d=zohomail.com; s=zohoarc; b=cIXx2kDGu9ziAcK1V2Nz20XmSABcwrFzB/YpulpXj4AG5vZIY+YP6bKldjmPaFOzKZRJueR4DuujH7k8e7WldtwkFInEk28Owqt7c+0PqPdGOOagydEymRSQ0cq3nxxO8Vrow7L5lCqmh2gBtoVP5LvqPQJJ0krhVb7f43YKTXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658308332; 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=3/9RAVqvCXyM97Em9qM/YuOetoqnTbT2nTuHbPsGWsw=; b=dMDAVQJ+y7fLh6akueywrlIP1DoiEyeK7QZhC1TgNt6dwhqzw8ckdkGer1ZkVBkwOoUqMxTsR2qNJ0uIbo9YiNo9Xw2npOG5SFN2Txs6glCe3uMytmHsJQ01Zrn1LQO456MBStKdCcpQdh85491b6Fa0pL/0pdgnoaBqlX6faoA= 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 1658308332223487.97682286100235; Wed, 20 Jul 2022 02:12:12 -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-190-7wEPtXARPaGFVgpTh4Hvmw-1; Wed, 20 Jul 2022 05:12:06 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 23C8B1034ADA; Wed, 20 Jul 2022 09:12:05 +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 0D14C2026D64; Wed, 20 Jul 2022 09:12:05 +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 D64B31947067; Wed, 20 Jul 2022 09:12:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9EED31947074 for ; Wed, 20 Jul 2022 09:12:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 92010202699A; Wed, 20 Jul 2022 09:12:03 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93FDD2024CB6; Wed, 20 Jul 2022 09:12:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658308331; 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=3/9RAVqvCXyM97Em9qM/YuOetoqnTbT2nTuHbPsGWsw=; b=T1R8+kr+EYgwgtcIMZAR+FGJaZhUtIi2pjYId3aoMi4fl75bJ+Nzbd/eZcwQi0jVrDPrVs XSsFag8rjAYdlrpqMims0FULJYODnn3ITz/0NVDwkS/qT/VpJ8b5vadgkt/PgsEw4cPCZf 4getIORcPgst9ktx6GBopgbq35Ztufs= X-MC-Unique: 7wEPtXARPaGFVgpTh4Hvmw-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 v2 4/5] qemu_migration: get migration blockers before hardcoded checks Date: Wed, 20 Jul 2022 11:11:53 +0200 Message-Id: <20220720091154.3135061-5-eperezma@redhat.com> In-Reply-To: <20220720091154.3135061-1-eperezma@redhat.com> References: <20220720091154.3135061-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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 , Jiri Denemark , Jaroslav Suchanek Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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: 1658308332471100006 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 --- src/qemu/qemu_migration.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b12cb518ee..4224339f39 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,25 @@ 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[0]) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("cannot migrate domain, %s"), blockers[0]); + return false; + } + } =20 /* perform these checks only when migrating to remote hosts */ if (remote) { --=20 2.31.1 From nobody Tue Apr 30 09:47:34 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=1658308392; cv=none; d=zohomail.com; s=zohoarc; b=TT0LiFwSifBoN+vImLwuFZqXC2Mhw4MaP/Q32jLfEnHpeESpTmvlRlANfAlfjGOhX+8ci1EJy3ewY188LxFnHtP5DCA9h0TLBlE7R1EnNs8p0Ysmd90LBTW4rwhjwOf5R7t1wfefUoxb92InJjqd+tn0cRabCXSzJVooTz8DshE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658308392; 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=5AECYN4nrfsa5j5uBNk04zLXxJgaYFPsOFLouI1xxe4=; b=YyJglRdVNZcrRC2cJzJxi9T2KnU0RS/Ahjbu1Qmxtf5cVDFvZlOhreoE5zZEejHXZjBnH8+8VjIv0mW4vqd/tz09DILgqX/FCiIA45srutG6zM8LpDP2QYylPTlM2D+AEJqKAVPbM+QU355N6o8x7S81IaGJLjqXugDccSCjNJ0= 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 1658308392368703.5515621655711; Wed, 20 Jul 2022 02:13:12 -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-646-YnsdgO3pMBqtNfurZ6ul3g-1; Wed, 20 Jul 2022 05:12:09 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B77718001EA; Wed, 20 Jul 2022 09:12:07 +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 A489290A11; Wed, 20 Jul 2022 09:12:07 +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 56B8A1947068; Wed, 20 Jul 2022 09:12:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ECFAB194707F for ; Wed, 20 Jul 2022 09:12:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DE7DE2026614; Wed, 20 Jul 2022 09:12:04 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4F6F2026D64; Wed, 20 Jul 2022 09:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658308391; 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=5AECYN4nrfsa5j5uBNk04zLXxJgaYFPsOFLouI1xxe4=; b=bJAmXt5dpejZxNj20nahHy5bgUdVKvsN4yKDkL0Ewz8jQ3zMey61a7GZNff3FuB1vJ4W1D ezcC7KAeNIPGoA622xDxKSUJlulchJv+PDufWTiHJpmdG+ZkIhhzb5oaNUBqjC5qTsEjbt R7dVy5HfPFmRcjuNVZOp7ygColH0XVA= X-MC-Unique: YnsdgO3pMBqtNfurZ6ul3g-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 v2 5/5] qemu_migrate: Do not forbif vDPA devices if can query blockers Date: Wed, 20 Jul 2022 11:11:54 +0200 Message-Id: <20220720091154.3135061-6-eperezma@redhat.com> In-Reply-To: <20220720091154.3135061-1-eperezma@redhat.com> References: <20220720091154.3135061-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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 , Jiri Denemark , Jaroslav Suchanek Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 1658308393178100001 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 --- src/qemu/qemu_migration.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 4224339f39..2f5c1d8121 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_REAS= ONS); =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) { @@ -1579,7 +1581,8 @@ 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