From nobody Fri May 17 16:58:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612276775; cv=none; d=zohomail.com; s=zohoarc; b=P/DTWIberlK6mSiLXHQJDhoTDwvOxKgx26bZc5KMYvdCPWMs6S1FIngPr+PHkD1stenxjLLqjHGbVzubg2EsEOaqqbu2M1yoTZAI8miAlV8eN5sfHQ1AP3G4R0Amixc8JYL4LBpf2f/H8okXMTosj10kXqoiaCLMZ8nlDTxnE7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276775; 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=1CoBnH81Tr+i7txWtCWUqs9kKr55/VytW3HZEUxgb5s=; b=kxMnqjSVLgZrHJGictcf8KdbRmM7vpxoRp3Le23sxL0AkaLGFocYQnh4P5eoG73mCROsq/5DIan9pnI4asg/tZA7HtVBRRt5cJE92DzGnIfCLu3NBX5H5E/HLqZl+hEut97f1Wx0yJpZWE/DOLPkfB0VfCeOGNbjqa7TOT0Hmmw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612276775423821.5864318676837; Tue, 2 Feb 2021 06:39:35 -0800 (PST) Received: from localhost ([::1]:48500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wMG-0000G9-87 for importer@patchew.org; Tue, 02 Feb 2021 09:08:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6w9n-0005aq-NK for qemu-devel@nongnu.org; Tue, 02 Feb 2021 08:55:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6w9k-0005Yu-1f for qemu-devel@nongnu.org; Tue, 02 Feb 2021 08:55:51 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-6Wtzu4D5OM25zwAdn7GrEQ-1; Tue, 02 Feb 2021 08:55:42 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93EFA107ACE3 for ; Tue, 2 Feb 2021 13:55:41 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-113-83.ams2.redhat.com [10.36.113.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26D656EF46; Tue, 2 Feb 2021 13:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612274145; h=from:from: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; bh=1CoBnH81Tr+i7txWtCWUqs9kKr55/VytW3HZEUxgb5s=; b=WyV2naBbvUVnWR2HdgKChMy3WebW1b4qAIpxchr8ovZjlJ01IiGORv/8lqdq4dyNI6swo0 gP5IOO9HrEbkhgCcwh0kj9NjlwiRmXhwzyHzRUzNkdnqbr5NQDcmonmqCldxq5dvvd4p2t 3s7gJ9tYk9b1p/smSEszVpgrQR2Qq6A= X-MC-Unique: 6Wtzu4D5OM25zwAdn7GrEQ-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, eblake@redhat.com, alex.williamson@redhat.com, laine@redhat.com Subject: [PATCH 1/2] migration: Add blocker information Date: Tue, 2 Feb 2021 13:55:21 +0000 Message-Id: <20210202135522.127380-2-dgilbert@redhat.com> In-Reply-To: <20210202135522.127380-1-dgilbert@redhat.com> References: <20210202135522.127380-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Modify query-migrate so that it has a flag indicating if outbound migration is blocked, and if it is a list of reasons. Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake Reviewed-by: Peter Xu --- migration/migration.c | 25 +++++++++++++++++++++++-- migration/savevm.c | 13 +++++++++++++ migration/savevm.h | 1 + qapi/migration.json | 6 ++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 1986cb8573..21d7ab1fa4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -141,6 +141,8 @@ enum mig_rp_message_type { static MigrationState *current_migration; static MigrationIncomingState *current_incoming; =20 +static GSList *migration_blockers; + static bool migration_object_check(MigrationState *ms, Error **errp); static int migration_maybe_pause(MigrationState *s, int *current_active_state, @@ -1041,6 +1043,27 @@ static void fill_source_migration_info(MigrationInfo= *info) { MigrationState *s =3D migrate_get_current(); =20 + info->blocked =3D migration_is_blocked(NULL); + info->has_blocked_reasons =3D info->blocked; + info->blocked_reasons =3D NULL; + if (info->blocked) { + GSList *cur_blocker =3D migration_blockers; + + /* + * There are two types of reasons a migration might be blocked; + * a) devices marked in VMState as non-migratable, and + * b) Explicit migration blockers + * We need to add both of them here. + */ + qemu_savevm_non_migratable_list(&info->blocked_reasons); + + while (cur_blocker) { + QAPI_LIST_PREPEND(info->blocked_reasons, + g_strdup(error_get_pretty(cur_blocker->data)= )); + cur_blocker =3D g_slist_next(cur_blocker); + } + } + switch (s->state) { case MIGRATION_STATUS_NONE: /* no migration has happened ever */ @@ -1934,8 +1957,6 @@ void migrate_init(MigrationState *s) s->threshold_size =3D 0; } =20 -static GSList *migration_blockers; - int migrate_add_blocker(Error *reason, Error **errp) { if (only_migratable) { diff --git a/migration/savevm.c b/migration/savevm.c index 4f3b69ecfc..7ddf400ca3 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1131,6 +1131,19 @@ bool qemu_savevm_state_blocked(Error **errp) return false; } =20 +void qemu_savevm_non_migratable_list(strList **reasons) +{ + SaveStateEntry *se; + + QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { + if (se->vmsd && se->vmsd->unmigratable) { + QAPI_LIST_PREPEND(*reasons, + g_strdup_printf("non-migratable device: %s", + se->idstr)); + } + } +} + void qemu_savevm_state_header(QEMUFile *f) { trace_savevm_state_header(); diff --git a/migration/savevm.h b/migration/savevm.h index ba64a7e271..ec789b161d 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -30,6 +30,7 @@ #define QEMU_VM_SECTION_FOOTER 0x7e =20 bool qemu_savevm_state_blocked(Error **errp); +void qemu_savevm_non_migratable_list(strList **reasons); void qemu_savevm_state_setup(QEMUFile *f); bool qemu_savevm_state_guest_unplug_pending(void); int qemu_savevm_state_resume_prepare(MigrationState *s); diff --git a/qapi/migration.json b/qapi/migration.json index d1d9632c2a..2f9d3d7237 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -224,6 +224,10 @@ # only returned if VFIO device is present, migration is supported b= y all # VFIO devices and status is 'active' or 'completed' (since 5.2) # +# @blocked: True if outgoing migration is blocked (since 6.0) +# +# @blocked-reasons: A list of reasons an outgoing migration is blocked (si= nce 6.0) +# # Since: 0.14 ## { 'struct': 'MigrationInfo', @@ -237,6 +241,8 @@ '*setup-time': 'int', '*cpu-throttle-percentage': 'int', '*error-desc': 'str', + 'blocked': 'bool', + '*blocked-reasons': ['str'], '*postcopy-blocktime' : 'uint32', '*postcopy-vcpu-blocktime': ['uint32'], '*compression': 'CompressionStats', --=20 2.29.2 From nobody Fri May 17 16:58:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612276186; cv=none; d=zohomail.com; s=zohoarc; b=D4QxR6gMQbtQr2rk5I96XxfF2N9euP5r6t4Ezs2vpuWGdw7FOpkxYBFgYyeImQrVhTv/1DLa7tX1y856AGM/BxOftLl0j5CtCPbUZMub7j5T2/UJd3N7kWuZr1ZLy+XIFPSo+aaxVga8+R+/qNEwRYjmhQbHUFfpe1CgvhDmHIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612276186; 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=w5V1cOG4naTOB/COZ6/JrnO6hdM6BVewsFWA2JDFqRU=; b=OLTUWXAMGB71UmxMvvmiwobHiczPTGgJO0NYGWce7ilpCNrnZmSE8Ze3nPYQKwRlOEA8L6Fk81vt/CHx3Bg3YLhqunnAQfs7iWXGxhHjjV0Dz9iVMVpuQX+qOHDgqSkyeP28wbtd+dSjZB1WprdFm8whpEdbsGpu8uDSmbath04= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1612276186004139.44004762446355; Tue, 2 Feb 2021 06:29:46 -0800 (PST) Received: from localhost ([::1]:47166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l6wLh-000853-9U for importer@patchew.org; Tue, 02 Feb 2021 09:08:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l6w9n-0005ae-KD for qemu-devel@nongnu.org; Tue, 02 Feb 2021 08:55:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45814) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l6w9j-0005Yv-Sx for qemu-devel@nongnu.org; Tue, 02 Feb 2021 08:55:50 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-C0nueydYPgqiSg4aVULOzw-1; Tue, 02 Feb 2021 08:55:43 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16BD89CC0B for ; Tue, 2 Feb 2021 13:55:43 +0000 (UTC) Received: from dgilbert-t580.localhost (ovpn-113-83.ams2.redhat.com [10.36.113.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE8676EF41; Tue, 2 Feb 2021 13:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612274145; h=from:from: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; bh=w5V1cOG4naTOB/COZ6/JrnO6hdM6BVewsFWA2JDFqRU=; b=C7FRwQsDjKhYa+qXpHjkx0cSLKX8UXEFJ5vmAimSwCyJhdzl7eVPLihvda/zxDdVp120aX LayQutDSgEdA23KO6Pp6ROZuHQoaoxKhCgh0DFprt3scq0o5kg7kFoJZSeRX45Mmb04nNv L+M7Fe+mqaWaSnynf8QbeV8XtZACVtc= X-MC-Unique: C0nueydYPgqiSg4aVULOzw-1 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, peterx@redhat.com, eblake@redhat.com, alex.williamson@redhat.com, laine@redhat.com Subject: [PATCH 2/2] migration: Display the migration blockers Date: Tue, 2 Feb 2021 13:55:22 +0000 Message-Id: <20210202135522.127380-3-dgilbert@redhat.com> In-Reply-To: <20210202135522.127380-1-dgilbert@redhat.com> References: <20210202135522.127380-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.386, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Update 'info migrate' to display migration blocking information. If the outbound migration is not blocked, there is no change, however if it is blocked a message is displayed with a list of reasons why, e.g. qemu-system-x86_64 -nographic -smp 4 -m 4G -M pc,usb=3Don \ -chardev null,id=3Dn -device usb-serial,chardev=3Dn \ -virtfs local,path=3D/home,mount_tag=3Dfs,security_model=3Dnone \ -drive if=3Dvirtio,file=3Dmyimage.qcow2 (qemu) info migrate globals: store-global-state: on only-migratable: off send-configuration: on send-section-footer: on decompress-error-check: on clear-bitmap-shift: 18 Outgoing migration blocked: Migration is disabled when VirtFS export path '/home' is mounted in the g= uest using mount_tag 'fs' non-migratable device: 0000:00:01.2/1/usb-serial Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake Reviewed-by: Peter Xu --- monitor/hmp-cmds.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index a48bc1e904..1f744f6041 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -224,6 +224,15 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) =20 migration_global_dump(mon); =20 + if (info->blocked) { + strList *reasons =3D info->blocked_reasons; + monitor_printf(mon, "Outgoing migration blocked:\n"); + while (reasons) { + monitor_printf(mon, " %s\n", reasons->value); + reasons =3D reasons->next; + } + } + if (info->has_status) { monitor_printf(mon, "Migration status: %s", MigrationStatus_str(info->status)); --=20 2.29.2