From nobody Sun May 19 14:14:26 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=1691591972; cv=none; d=zohomail.com; s=zohoarc; b=CYxPJJRUq5/QirRCqV9aZDWrhy1Zuzy5bvDS/TMTBnEAFEemQhomKxgUwfQTUJulRTeEs54EPnbsUaWvmyFWm4AIngJdJiAja3foXhKihm7mpcrT6LVcoGCBQBU7NxEJowVdz3guJLbVhWc6a1c6YaQLRAfz4X+4gMSnY7Uc4/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691591972; 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=LGFXIGST60hT4I2erKYmHVI0SOGIhTBXi2Y0rqq/yUQ=; b=BhaPjIiO9sIPZ/TyLj3GXrD2s14g9MnmaoERVpBFZm6GhCsUYdUdulQiA7UkysTEaLOWDfPPhxW7QUqaoabupzlkUkHu0tN25TpbrLiFh+Glh9GBy3jsUgFquOXnVOD/Vr2TNmhD5QqS5J9UMLOeiMqW3ZbXIFPzCtSi2PlHeqw= 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 1691591972253490.369449343455; Wed, 9 Aug 2023 07:39:32 -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-502-TXujfBDCPPCUK86QXsTH4Q-1; Wed, 09 Aug 2023 10:39:28 -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 485EE185A7A3; Wed, 9 Aug 2023 14:39:26 +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 C9ACC140E96E; Wed, 9 Aug 2023 14:39:25 +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 A4A991946589; Wed, 9 Aug 2023 14:39:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8D4241946588 for ; Wed, 9 Aug 2023 14:14:35 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6D07A4A9005; Wed, 9 Aug 2023 14:14:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3E13401E30 for ; Wed, 9 Aug 2023 14:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691591971; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LGFXIGST60hT4I2erKYmHVI0SOGIhTBXi2Y0rqq/yUQ=; b=inK50xxSZ4Z7D+hN4aVeuR8Sk0zHTD/wXy1SJIQ1pATTGo44JvzTnwlj8Dir0kh7oehI8j cBM3feZuoHFABOnfXJ5zz9aKmePFfZmITgSMSL4SL/vc8yu45qGhZKIL3+ihUlR1MTP4E3 TKFj8lrwttyjxqpXE+Dyxiqe+1SpNqc= X-MC-Unique: TXujfBDCPPCUK86QXsTH4Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/4] qemuMigrationSrcBeginPhase: Properly report error when non-shared storage migration is requested over tunnel Date: Wed, 9 Aug 2023 16:14:20 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691591973959100001 Content-Type: text/plain; charset="utf-8" When VIR_MIGRATE_TUNNELLED is used without VIR_MIGRATE_NON_SHARED_DISK/VIR_MIGRATE_NON_SHARED_INC an error was reported without actually returning failure. This was caused by a refactor which dropped many error paths. Fixes: 6111b235224 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_migration.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index ed41a03851..a3fe6be4e9 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2617,6 +2617,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver, if (flags & VIR_MIGRATE_TUNNELLED) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("migration of non-shared storage is not suppo= rted with tunnelled migration and this QEMU")); + return NULL; } if (nmigrate_disks) { --=20 2.41.0 From nobody Sun May 19 14:14:26 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=1691590500; cv=none; d=zohomail.com; s=zohoarc; b=CImTb0XRkQd3WgXnFUAEQl5iNHAQWgKxiQ/aanOPl2FbLnoeogPxWZ2It3EE/FDNbFsXAue7J3RnkidxExtWKPXBepRkzNXrSjC5YYic8iV4iqL+AP2DeaQ0Uno9ZyNqfztc3kkEDQvvE7HuLCCNP6VTWnJuglD7K2MH2eQyh7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691590500; 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=RVPv9Func7u51oBo4Gl3fNfznzjSGlTa17SBG9+EocE=; b=SguTrGFwvKLMBET/ftZfrk40j+bXiSpBKldswnUqDJgn1PE5GI8bRMj18sPiOnmX+Bqq874XkC7E4czAEsaBqLXDUdLzd3HdkYRm/gU4E94F4yaxj/1OdVCNhPZVIlRvX14DqSw6hDgdkY+5N57Er/SbggjdGSOSLZZIias4Y3o= 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 1691590500753947.3350840550017; Wed, 9 Aug 2023 07:15:00 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-185-nklq1aKsNc27-hvmwbZjJw-1; Wed, 09 Aug 2023 10:14:54 -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 0EDFF3C0FCA2; Wed, 9 Aug 2023 14:14: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 A7E8DC15E6B; Wed, 9 Aug 2023 14:14:50 +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 7AAD819465B8; Wed, 9 Aug 2023 14:14:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 945C019465A3 for ; Wed, 9 Aug 2023 14:14:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6F0DD401E6A; Wed, 9 Aug 2023 14:14:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5E18401E63 for ; Wed, 9 Aug 2023 14:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691590499; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RVPv9Func7u51oBo4Gl3fNfznzjSGlTa17SBG9+EocE=; b=SORiLTh5Yx6C4D2Tub05dn2hj3vDcZzg+8YYuK/pm+srveLr4ukgkb1o7MOlVTLXUhBLmn AoY7veaYFhaWoa1WlrXasKHaWRi1sbrIogphVfCteXoYSOGgJmAjGcNrt7nqbrBasy6Sfp y58Ks17LXDkcxZ3CiXK2z7Q7mQ1hfxQ= X-MC-Unique: nklq1aKsNc27-hvmwbZjJw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/4] qemuMigrationSrcBeginPhase: Require storage migration when 'migrate_disks' parameter is specified Date: Wed, 9 Aug 2023 16:14:21 +0200 Message-ID: <031ea84b93c2ee2fdfc646e1d02662bb3843dce5.1691590342.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691590546129100001 Content-Type: text/plain; charset="utf-8" If a user passes a list of disks to migrate but don't actually use 'VIR_MIGRATE_NON_SHARED_DISK' or 'VIR_MIGRATE_NON_SHARED_INC' flags the parameter would be simply ignored without informing the user of the error. Add a proper error in such case. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_migration.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index a3fe6be4e9..9057590c94 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2644,6 +2644,12 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver, migrate_disks, nmigrate_disks)) cookieFlags |=3D QEMU_MIGRATION_COOKIE_NBD; + } else { + if (nmigrate_disks > 0) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("use of the 'VIR_MIGRATE_PARAM_MIGRATE_DISKS'= requires use of 'VIR_MIGRATE_NON_SHARED_DISK' or 'VIR_MIGRATE_NON_SHARED_I= NC' flag")); + return NULL; + } } if (virDomainDefHasMemoryHotplug(vm->def) || --=20 2.41.0 From nobody Sun May 19 14:14:26 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=1691590489; cv=none; d=zohomail.com; s=zohoarc; b=hw6zyKrqEtdPsN1D3AWPmn398VrQ8e28/qU4//pQM+F7K+xT1FXVigRUftKqjhJJVrocnn8I+eLKACpLbGfpI9t008xF71wYbmgU0Bi848Y/WcyLMOyZCd+0l6EiMbC7vV3V3WZPB0aBgLhDj5WN+hPt3mNVXYXL2Q8lGkGIZUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691590489; 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=MoBuFbv+ATQMYdba/eU8829wgPWZHwHhhV34yDuk5F8=; b=ESAJ5g+zvcLHknPvWswXgaN28k98nFlyLi2osrd4UjOzvz6heXX/6wDLuq3WNKvm1ijYDG5zIYcGc9jbyczroNTI93sybSXjGfkHnvoMk0sks7kSh0RkQjib/nPC3TuyeeRuJLTO+aBJuP7lkL9P0h48SkLTl/sk4BHCv3LH9Ac= 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 1691590489576625.4734019600753; Wed, 9 Aug 2023 07:14:49 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-270-oqVVjY9fOQiI5Vutiu5YkA-1; Wed, 09 Aug 2023 10:14:45 -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 01E7A3C0FC8F; Wed, 9 Aug 2023 14:14:43 +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 E1D1D2026D4B; Wed, 9 Aug 2023 14:14:42 +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 4121B19465B9; Wed, 9 Aug 2023 14:14:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 964D219465A4 for ; Wed, 9 Aug 2023 14:14:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5B4A9401E9C; Wed, 9 Aug 2023 14:14:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1A27401E30 for ; Wed, 9 Aug 2023 14:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691590488; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MoBuFbv+ATQMYdba/eU8829wgPWZHwHhhV34yDuk5F8=; b=fsppP+4mbiaWy42XM+BbpmKsEEFY54QREAO1nHPL9rRXU71pJvlP7fV8qKM01zaFtlfKWV iQITfjeudW5MIYLaJbsy85lp1PRY6iRm+EbbiZdHu1/QrcDdv5yxGk+15xCvAyrcwn52as zlgQEYcTGYStlPe3ixcHpzSb2yPPaXs= X-MC-Unique: oqVVjY9fOQiI5Vutiu5YkA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/4] virsh: doMigrate: Rework virsh option to migration flag conversion Date: Wed, 9 Aug 2023 16:14:22 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691590490948100001 Content-Type: text/plain; charset="utf-8" Convert the flags declaratively as in the vast majority of cases it's a simple binary addition if the flag exists. In one instance there was also an additional check, which was moved up after the new code, and the error message was fixed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 108 +++++++++++++++++-------------------------- 1 file changed, 42 insertions(+), 66 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index f8758f18a3..84bf62057b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11082,6 +11082,11 @@ static const vshCmdOptDef opts_migrate[] =3D { {.name =3D NULL} }; +struct doMigrateFlagMapping { + const char *optionname; + unsigned int migflag; +}; + static void doMigrate(void *opaque) { @@ -11099,6 +11104,32 @@ doMigrate(void *opaque) unsigned long long ullOpt =3D 0; int rv; virConnectPtr dconn =3D data->dconn; + size_t i; + + static const struct doMigrateFlagMapping flagmap[] =3D { + { "live", VIR_MIGRATE_LIVE }, + { "p2p", VIR_MIGRATE_PEER2PEER }, + { "tunnelled", VIR_MIGRATE_TUNNELLED }, + { "persistent", VIR_MIGRATE_PERSIST_DEST }, + { "undefinesource", VIR_MIGRATE_UNDEFINE_SOURCE }, + { "copy-storage-all", VIR_MIGRATE_NON_SHARED_DISK }, + { "copy-storage-inc", VIR_MIGRATE_NON_SHARED_INC }, + { "copy-storage-synchronous-writes", VIR_MIGRATE_NON_SHARED_SYNCHR= ONOUS_WRITES }, + { "change-protection", VIR_MIGRATE_CHANGE_PROTECTION }, + { "unsafe", VIR_MIGRATE_UNSAFE }, + { "compressed", VIR_MIGRATE_COMPRESSED }, + { "auto-converge", VIR_MIGRATE_AUTO_CONVERGE }, + { "rdma-pin-all", VIR_MIGRATE_RDMA_PIN_ALL }, + { "offline", VIR_MIGRATE_OFFLINE }, + { "abort-on-error", VIR_MIGRATE_ABORT_ON_ERROR }, + { "postcopy", VIR_MIGRATE_POSTCOPY }, + { "postcopy-resume", VIR_MIGRATE_POSTCOPY_RESUME }, + { "zerocopy", VIR_MIGRATE_ZEROCOPY }, + { "tls", VIR_MIGRATE_TLS }, + { "parallel", VIR_MIGRATE_PARALLEL }, + { "suspend", VIR_MIGRATE_PAUSED }, + }; + #ifndef WIN32 sigset_t sigmask, oldsigmask; @@ -11108,6 +11139,17 @@ doMigrate(void *opaque) goto out_sig; #endif /* !WIN32 */ + for (i =3D 0; i < G_N_ELEMENTS(flagmap); i++) { + if (vshCommandOptBool(cmd, flagmap[i].optionname)) + flags |=3D flagmap[i].migflag; + } + + if (flags & VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES && + !(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_DI= SK))) { + vshError(ctl, "'--copy-storage-synchronous-writes' requires one of= '--copy-storage-all', '--copy-storage-inc'"); + goto out; + } + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) goto out; @@ -11325,72 +11367,6 @@ doMigrate(void *opaque) VIR_MIGRATE_PARAM_TLS_DESTINATION, opt) < = 0) goto save_error; - if (vshCommandOptBool(cmd, "live")) - flags |=3D VIR_MIGRATE_LIVE; - if (vshCommandOptBool(cmd, "p2p")) - flags |=3D VIR_MIGRATE_PEER2PEER; - if (vshCommandOptBool(cmd, "tunnelled")) - flags |=3D VIR_MIGRATE_TUNNELLED; - - if (vshCommandOptBool(cmd, "persistent")) - flags |=3D VIR_MIGRATE_PERSIST_DEST; - if (vshCommandOptBool(cmd, "undefinesource")) - flags |=3D VIR_MIGRATE_UNDEFINE_SOURCE; - - if (vshCommandOptBool(cmd, "suspend")) - flags |=3D VIR_MIGRATE_PAUSED; - - if (vshCommandOptBool(cmd, "copy-storage-all")) - flags |=3D VIR_MIGRATE_NON_SHARED_DISK; - - if (vshCommandOptBool(cmd, "copy-storage-inc")) - flags |=3D VIR_MIGRATE_NON_SHARED_INC; - - if (vshCommandOptBool(cmd, "copy-storage-synchronous-writes")) { - if (!(flags & VIR_MIGRATE_NON_SHARED_DISK) && - !(flags & VIR_MIGRATE_NON_SHARED_INC)) { - vshError(ctl, "'--copy-storage-synchronous-writes' requires on= e of '--copy-storage-all', 'copy-storage-inc'"); - goto out; - } - flags |=3D VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES; - } - - if (vshCommandOptBool(cmd, "change-protection")) - flags |=3D VIR_MIGRATE_CHANGE_PROTECTION; - - if (vshCommandOptBool(cmd, "unsafe")) - flags |=3D VIR_MIGRATE_UNSAFE; - - if (vshCommandOptBool(cmd, "compressed")) - flags |=3D VIR_MIGRATE_COMPRESSED; - - if (vshCommandOptBool(cmd, "auto-converge")) - flags |=3D VIR_MIGRATE_AUTO_CONVERGE; - - if (vshCommandOptBool(cmd, "rdma-pin-all")) - flags |=3D VIR_MIGRATE_RDMA_PIN_ALL; - - if (vshCommandOptBool(cmd, "offline")) - flags |=3D VIR_MIGRATE_OFFLINE; - - if (vshCommandOptBool(cmd, "abort-on-error")) - flags |=3D VIR_MIGRATE_ABORT_ON_ERROR; - - if (vshCommandOptBool(cmd, "postcopy")) - flags |=3D VIR_MIGRATE_POSTCOPY; - - if (vshCommandOptBool(cmd, "postcopy-resume")) - flags |=3D VIR_MIGRATE_POSTCOPY_RESUME; - - if (vshCommandOptBool(cmd, "zerocopy")) - flags |=3D VIR_MIGRATE_ZEROCOPY; - - if (vshCommandOptBool(cmd, "tls")) - flags |=3D VIR_MIGRATE_TLS; - - if (vshCommandOptBool(cmd, "parallel")) - flags |=3D VIR_MIGRATE_PARALLEL; - if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct"))= { if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) = =3D=3D 0) data->ret =3D 0; --=20 2.41.0 From nobody Sun May 19 14:14:26 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=1691590501; cv=none; d=zohomail.com; s=zohoarc; b=lL3O3rl7VtMakTjeQVjEpBSmEkHaFqIiQQaf9Exex2FIr4SDzuLQXh3wPyOIpm1xde4KEIXg6W0ufTSGDAE9SzCvuR9bqXM64cuI8YzBZUXzXO0MR50kjR5hm+WV4KWLMOMgz6hB/p5Qoq2pkis16Jy5R8KOaElQyjfZ44TEubY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691590501; 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=lAz7LbL3XqICdqcGsM8kygySpp1kqddqLCK2Vy1m/1w=; b=MpSfMR5d04ZN3BdFv1vricAsFIF2FiAlucrvkjApqqMEfnMIh0NIyTT5rsB5RCX5wb3a2iEZZK5OrgSrzv1vjjswZ011gLDipCH7UD3qIN+g8DgD1BUXL2KSg3g8q10UAAG0fU1fBOza6sgkiqzEGVGPsCqVH3/8ESekIa484dw= 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 1691590501417550.3708897152574; Wed, 9 Aug 2023 07:15:01 -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-248-Gr67JakpOHqBQOc0kqfpkg-1; Wed, 09 Aug 2023 10:14:54 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 734F7185A7A4; Wed, 9 Aug 2023 14:14:50 +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 6164440D2839; Wed, 9 Aug 2023 14:14:50 +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 43B321946589; Wed, 9 Aug 2023 14:14:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9651319465B1 for ; Wed, 9 Aug 2023 14:14:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 351BD4021AD; Wed, 9 Aug 2023 14:14:28 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABA0F401E30 for ; Wed, 9 Aug 2023 14:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691590500; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lAz7LbL3XqICdqcGsM8kygySpp1kqddqLCK2Vy1m/1w=; b=FyO9zCLq1k6qLQby3Jr9cZC3593Tr8bH3HQuYP84j75SQSuATBAY4iaZkaV5YLzhTpkxtB NicSf4NsYv5Mhn+h7puLkUcUw99PPo2KpXm1ERsi5XwktIWYW7tuLM0E4aXvf5zac4RS/s Z40kHuI7Ta18T6FRucgtJ7z/5tSU8wI= X-MC-Unique: Gr67JakpOHqBQOc0kqfpkg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/4] virsh: doMigrate: Require --copy-storage-(all|inc) with --migrate-disks Date: Wed, 9 Aug 2023 16:14:23 +0200 Message-ID: <42f21fdf8640975b7e60dd647799564e7f5814ae.1691590343.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691590557341100001 Content-Type: text/plain; charset="utf-8" Users need to enable non-shared-storage migration, otherwise the disks specified via '--migrate-disks' will be ignored. Add an error message to inform the users of their wrong config. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 84bf62057b..e0776c991f 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11204,6 +11204,11 @@ doMigrate(void *opaque) if (opt) { g_autofree char **val =3D NULL; + if (!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARE= D_INC))) { + vshError(ctl, "'--migrate-disks' requires one of '--copy-stora= ge-all', '--copy-storage-inc'"); + goto out; + } + val =3D g_strsplit(opt, ",", 0); if (virTypedParamsAddStringList(¶ms, --=20 2.41.0