From nobody Sun May 12 23:39:04 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1698772700703370.9121260149301; Tue, 31 Oct 2023 10:18:20 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A11AA1721; Tue, 31 Oct 2023 13:18:19 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B78AF17B7; Tue, 31 Oct 2023 13:14:10 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D3FBF1756; Tue, 31 Oct 2023 13:13:58 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0A8E1177F for ; Tue, 31 Oct 2023 13:13:22 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-454-CYbJt-vcNCO-3APTafJsAA-1; Tue, 31 Oct 2023 13:13:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F137585A58B for ; Tue, 31 Oct 2023 17:13:04 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.45.224.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B57440C6EBE for ; Tue, 31 Oct 2023 17:13:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: CYbJt-vcNCO-3APTafJsAA-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [libvirt PATCH 1/3] include: Introduce VIR_MIGRATE_ASSUME_SHARED_STORAGE Date: Tue, 31 Oct 2023 18:12:58 +0100 Message-ID: <20231031171300.139023-2-abologna@redhat.com> In-Reply-To: <20231031171300.139023-1-abologna@redhat.com> References: <20231031171300.139023-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3DLRJI3TNFRXUWOLRH7RVBWJ345E5XS7 X-Message-ID-Hash: 3DLRJI3TNFRXUWOLRH7RVBWJ345E5XS7 X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZM-MESSAGEID: 1698772701282100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Andrea Bolognani Reviewed-by: Peter Krempa --- include/libvirt/libvirt-domain.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index a1902546bb..37c55c5ae8 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1100,6 +1100,20 @@ typedef enum { * Since: 8.5.0 */ VIR_MIGRATE_ZEROCOPY =3D (1 << 20), + + /* Assume that the storage used for VM disks is shared even when + * it appears to be local storage. + * + * This can be the case, for example, when a directory is mounted + * using NFS on the destination host but is bind-mounted on the + * source host, because the latter happens to be the host that + * storage is physically attached to. + * + * Effectively a subset of VIR_MIGRATE_UNSAFE. + * + * Since: 9.10.0 + */ + VIR_MIGRATE_ASSUME_SHARED_STORAGE =3D (1 << 21), } virDomainMigrateFlags; =20 =20 --=20 2.41.0 From nobody Sun May 12 23:39:04 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1698772543380268.7681751990766; Tue, 31 Oct 2023 10:15:43 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2AD0C17B5; Tue, 31 Oct 2023 13:15:42 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A6FC91781; Tue, 31 Oct 2023 13:13:24 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 372B01758; Tue, 31 Oct 2023 13:13:09 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 721321745 for ; Tue, 31 Oct 2023 13:13:08 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-602-dTnYdadrP1KbUpdIjxagoQ-1; Tue, 31 Oct 2023 13:13:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A16D811E82 for ; Tue, 31 Oct 2023 17:13:06 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.45.224.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65DAA40C6EBE for ; Tue, 31 Oct 2023 17:13:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: dTnYdadrP1KbUpdIjxagoQ-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [libvirt PATCH 2/3] qemu: Implement VIR_MIGRATE_ASSUME_SHARED_STORAGE support Date: Tue, 31 Oct 2023 18:12:59 +0100 Message-ID: <20231031171300.139023-3-abologna@redhat.com> In-Reply-To: <20231031171300.139023-1-abologna@redhat.com> References: <20231031171300.139023-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: B3XQH3UUSBD3EOUD6OBSSLWNB6NWLRBH X-Message-ID-Hash: B3XQH3UUSBD3EOUD6OBSSLWNB6NWLRBH X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZM-MESSAGEID: 1698772543991100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Andrea Bolognani Reviewed-by: Peter Krempa --- src/qemu/qemu_migration.c | 5 +++++ src/qemu/qemu_migration.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ac58aa1a8c..bf6f1de310 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1600,6 +1600,11 @@ qemuMigrationSrcIsSafe(virDomainDef *def, if ((rc =3D virFileIsSharedFS(src)) < 0) { return false; } else if (rc =3D=3D 0) { + /* Ignore the outcome of this check if we've been + * asked to assume that storage is shared */ + if (flags & VIR_MIGRATE_ASSUME_SHARED_STORAGE) + break; + unsafe =3D true; } if ((rc =3D virFileIsClusterFS(src)) < 0) diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index ed62fd4a91..c21417084a 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -62,6 +62,7 @@ VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES | \ VIR_MIGRATE_POSTCOPY_RESUME | \ VIR_MIGRATE_ZEROCOPY | \ + VIR_MIGRATE_ASSUME_SHARED_STORAGE | \ 0) =20 /* All supported migration parameters and their types. */ --=20 2.41.0 From nobody Sun May 12 23:39:04 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1698772614664258.7008429011172; Tue, 31 Oct 2023 10:16:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 987BA1793; Tue, 31 Oct 2023 13:16:53 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 08EE917D3; Tue, 31 Oct 2023 13:13:45 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2F47117B1; Tue, 31 Oct 2023 13:13:33 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 75B081769 for ; Tue, 31 Oct 2023 13:13:09 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-359-m5lNw21eOUKxeQq_hIiNow-1; Tue, 31 Oct 2023 13:13:07 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35899892248 for ; Tue, 31 Oct 2023 17:13:07 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.45.224.114]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80ACF40C6EBE for ; Tue, 31 Oct 2023 17:13:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: m5lNw21eOUKxeQq_hIiNow-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [libvirt PATCH 3/3] virsh: Wire up VIR_MIGRATE_ASSUME_SHARED_STORAGE support Date: Tue, 31 Oct 2023 18:13:00 +0100 Message-ID: <20231031171300.139023-4-abologna@redhat.com> In-Reply-To: <20231031171300.139023-1-abologna@redhat.com> References: <20231031171300.139023-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GQDAE7VJQPIAYLMHOTUUSVHU547IAC5E X-Message-ID-Hash: GQDAE7VJQPIAYLMHOTUUSVHU547IAC5E X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZM-MESSAGEID: 1698772615462100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Andrea Bolognani Reviewed-by: Peter Krempa --- docs/manpages/virsh.rst | 5 ++++- tools/virsh-domain.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 3e7a4c6c22..849933fa2e 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3382,6 +3382,7 @@ migrate [--parallel [--parallel-connections connections]] [--bandwidth bandwidth] [--tls-destination hostname] [--disks-uri URI] [--copy-storage-synchronous-writes] + [--assume-shared-storage] =20 Migrate domain to another host. Add *--live* for live migration; <--p2p> for peer-2-peer migration; *--direct* for direct migration; or *--tunnelle= d* @@ -3461,7 +3462,9 @@ considered unsafe. For QEMU domain, this may happen i= f the domain uses disks without explicitly setting cache mode to "none". Migrating such domains is unsafe unless the disk images are stored on coherent clustered filesystem, such as GFS2 or GPFS. If you are sure the migration is safe or you just do= not -care, use *--unsafe* to force the migration. +care, use *--unsafe* to force the migration. *--assume-shared-storage* is a +weaker version of *--unsafe* which allows migration if the source disk is +detected as local while retaining all other checks. =20 *dname* is used for renaming the domain to new name during migration, which also usually can be omitted. Likewise, *--xml* ``file`` is usually diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 66f933dead..cccf079c34 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11128,6 +11128,10 @@ static const vshCmdOptDef opts_migrate[] =3D { .type =3D VSH_OT_INT, .help =3D N_("compress level for zstd compression") }, + {.name =3D "assume-shared-storage", + .type =3D VSH_OT_BOOL, + .help =3D N_("assume that disk storage is shared even if libvirt dete= cts it as local") + }, {.name =3D NULL} }; =20 @@ -11177,6 +11181,7 @@ doMigrate(void *opaque) { "tls", VIR_MIGRATE_TLS }, { "parallel", VIR_MIGRATE_PARALLEL }, { "suspend", VIR_MIGRATE_PAUSED }, + { "assume-shared-storage", VIR_MIGRATE_ASSUME_SHARED_STORAGE }, }; =20 #ifndef WIN32 --=20 2.41.0