From nobody Sun Feb 8 15:07:35 2026 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=1618328423; cv=none; d=zohomail.com; s=zohoarc; b=nYeI4w5ypavDKhBli269Mpcol+c6FHNrd7suxkc6Z0ROjcXYBcFtOYQJsVvADF+Q/xjz2BmNMC5bwsyKEuOqDGw+OuCL8kcs3PiqpO9xAgpTtRIFasIP/MLB4FURIwxJTlsOPOPIsg9/dv9WC0ao9uG5ROashSwREWqPn9q4oOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618328423; 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=fbNgDPmOc6vAU5SzwCXtILfOKJEnpIaQby8KhrQEV2k=; b=bh6Vq+2f7SjIHb2tFVsz6dztYqoUdiHjZf3KqW99paXg+cpRW901GvSNc3H6D6CNlEhUsHdfFk4NDyE5gCUKoulCrOxiQ2WAqahrab2cZsle9zIzyY8ll5JMGCsK8IGQ9Wx+KQaRM1uXE7/fbNXSxo5VJIAK2DyN9viYh93qLVQ= 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) header.from= 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 1618328423081612.1754316647649; Tue, 13 Apr 2021 08:40:23 -0700 (PDT) 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-318-h7fhet-5NEuQfwf5IZJJlw-1; Tue, 13 Apr 2021 11:38:50 -0400 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 163E4107ACF3; Tue, 13 Apr 2021 15:38:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4AC12E06F; Tue, 13 Apr 2021 15:38:42 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ADFDD1806D1B; Tue, 13 Apr 2021 15:38:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13DFcf51012945 for ; Tue, 13 Apr 2021 11:38:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0BB0F2B0A9; Tue, 13 Apr 2021 15:38:41 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5906D226E0 for ; Tue, 13 Apr 2021 15:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618328421; 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=fbNgDPmOc6vAU5SzwCXtILfOKJEnpIaQby8KhrQEV2k=; b=gpdWanFtc03aqFGrUMBemoeK+UH2J2trXGcRISZpjRV+q1u+2WKxeTYwhqgQmaa7nZrjd1 3cjBKfB5/VRw/Pty3tRf4fO0gq3n2ERhZYnjWLA7SV6Rr4BnfttMW4Yv0uka5hfvWsvqa3 AITUsBnEs2yIWQ5EJRZRh6SfH04+sJ0= X-MC-Unique: h7fhet-5NEuQfwf5IZJJlw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [RFC PATCH 7/7] qemuMigrationSrcBeginPhase: Don't offer 'nbd' in cookie if there are no disks to migrate Date: Tue, 13 Apr 2021 17:38:27 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Don't try to setup disk migration and the NBD stuff if we end up migrating nothing. The destination side has luckily no setup for the non-NBD cases so omitting the element fully is okay. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 119459342e..3a622d38cd 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2365,26 +2365,30 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver, return NULL; } } else { - cookieFlags |=3D QEMU_MIGRATION_COOKIE_NBD; - priv->nbdPort =3D 0; - } - - if (nmigrate_disks) { - size_t i, j; - /* Check user requested only known disk targets. */ - for (i =3D 0; i < nmigrate_disks; i++) { - for (j =3D 0; j < vm->def->ndisks; j++) { - if (STREQ(vm->def->disks[j]->dst, migrate_disks[i])) - break; - } + if (nmigrate_disks) { + size_t i, j; + /* Check user requested only known disk targets. */ + for (i =3D 0; i < nmigrate_disks; i++) { + for (j =3D 0; j < vm->def->ndisks; j++) { + if (STREQ(vm->def->disks[j]->dst, migrate_disks[i]= )) + break; + } - if (j =3D=3D vm->def->ndisks) { - virReportError(VIR_ERR_INVALID_ARG, - _("disk target %s not found"), - migrate_disks[i]); - return NULL; + if (j =3D=3D vm->def->ndisks) { + virReportError(VIR_ERR_INVALID_ARG, + _("disk target %s not found"), + migrate_disks[i]); + return NULL; + } } } + + priv->nbdPort =3D 0; + + if (qemuMigrationHasAnyStorageMigrationDisks(vm->def, + migrate_disks, + nmigrate_disks)) + cookieFlags |=3D QEMU_MIGRATION_COOKIE_NBD; } } --=20 2.30.2