From nobody Sat Apr 27 08:54:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1603709370; cv=none; d=zohomail.com; s=zohoarc; b=KHxwCvTZasE/6shz3QT0j1ya18OxXdFhN+aXB7zol5oRASEtDzJ3Df5vBP9LUn7mIzeQ2oWMfX2Mz2bTitB0CkgQc0OmzhddLnHUg3hnw0wQ9XqX2LiHoKiBiIYj5EqkXJAhECgXxu8Gy3lqueYIfmbGyPFqr9zG0FJ2YM39x8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603709370; 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=wrjzbaOHh10nk9bu6BGLcAKAgYJlHYQ3u0rBMISbDRw=; b=Utp0U+/OPT4ze6tq1/zZplzomWO7zf//h/tKubNXVkQCMZmEFPwWtW8kN9Br7q9ZRObvXBMlZ2yfycKZhJf34TxqMmvt+GP7qwX142n962+5ZBd0/qdxye76qzavuT8MUikOU3OYi7/yIyo6xdOue2pAVh9U95LIcuwlYEWmmsg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1603709370991910.5086275865754; Mon, 26 Oct 2020 03:49:30 -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-9-Ryh8VQfJNpm93K1W7MOZRQ-1; Mon, 26 Oct 2020 06:49:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8CA0D1009E27; Mon, 26 Oct 2020 10:49:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24E5A5B4A4; Mon, 26 Oct 2020 10:49:21 +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 844AE92F27; Mon, 26 Oct 2020 10:49:19 +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 09QAfiko009535 for ; Mon, 26 Oct 2020 06:41:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0716B6EF58; Mon, 26 Oct 2020 10:41:44 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DDE36EF67 for ; Mon, 26 Oct 2020 10:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603709370; 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=wrjzbaOHh10nk9bu6BGLcAKAgYJlHYQ3u0rBMISbDRw=; b=Qoc0z9UEzgcrRjjAtFUcG6AcnC8keV8z4rFIgH315WFpZpitWFseEN6oMpSPFycKqWcz4v XxuRr3MCNFZNiHUjoTA7cmPVYfe2VUAYX/B8MNcLtzZsw9l/xm3xyY4kIhOFcWVpwZQNcy DQmhAqyXiOOPgQVzrH+Qn4q5Ot9KB+M= X-MC-Unique: Ryh8VQfJNpm93K1W7MOZRQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: Don't try to start NBD server twice Date: Mon, 26 Oct 2020 11:41:35 +0100 Message-Id: <07a52a103d7cc44a63f94b44f2859e0536073641.1603708799.git.mprivozn@redhat.com> 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.11 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" In one of recent patches the way that we start NBD server for incoming migration was reworked (v6.8.0-rc1~298). A new boolean was introduced that tracks whether the NBD server was started so that we don't start it twice nor record in the port in the port allocator twice. Well, this idea is good, but in the implementation the boolean is never set, so we are reserving the port twice and would be starting the NBD server twice too if it wasn't for port reservation fail. Fixes: e74d627bb3bc2684cbe3edc1e2f7cc745b4e1ff3 Reported-by: Vjaceslavs Klimovs Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_migration.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 2f5d61f8e7..6f764b0c73 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -479,9 +479,11 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, QEMU_ASYNC_JOB_MIGRATION_IN) < = 0) goto cleanup; =20 - if (!server_started && - qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) < 0) - goto exit_monitor; + if (!server_started) { + if (qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) <= 0) + goto exit_monitor; + server_started =3D true; + } =20 if (qemuBlockExportAddNBD(vm, diskAlias, disk->src, diskAlias, tru= e, NULL) < 0) goto exit_monitor; --=20 2.26.2 From nobody Sat Apr 27 08:54:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1603708958; cv=none; d=zohomail.com; s=zohoarc; b=A6YwYXdVyO2ZUQNvTTg3ZPdmoRj4m3NJlqH3dIy4k5TQ4Kd7cRs9lDWIYWeQOLsNHbZknv8Az7E+qAElrApHTcVWcogExaN38pkkuak8q5aCtRKNicwSUdye6kJ/uSlXAz5sDxUB/AWMgdpk6/l7ceOb7CARc1GZPxmClwc8R3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603708958; 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=s3faIPmlA3mB6QLd3RuZqenQicCzCfBpkHhgi7PyP58=; b=esa5evJHnOG4RZh1L/CErO/W3A3O67oIlUugDIFGaAAjSdwz1sDLqKOpaDuBEU1t4C03JY6PeHuhLTbIk6EViHlc9QKk2bNVU+zctfTzyHmnwsl9iZHTzRsDixnXB7eCI96SK+1eDbafGcHER47UVsPg2pUNZbN7KiNEAhLe1iA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1603708958067675.3270362213833; Mon, 26 Oct 2020 03:42:38 -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-490-ZpGuw1UYMiK8DkB1ggjINw-1; Mon, 26 Oct 2020 06:42:34 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73AF58049E4; Mon, 26 Oct 2020 10:42:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E835B60C07; Mon, 26 Oct 2020 10:42:28 +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 29B4892F25; Mon, 26 Oct 2020 10:42:28 +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 09QAfiCv009543 for ; Mon, 26 Oct 2020 06:41:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5D306EF58; Mon, 26 Oct 2020 10:41:44 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5838C6EF6A for ; Mon, 26 Oct 2020 10:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603708956; 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=s3faIPmlA3mB6QLd3RuZqenQicCzCfBpkHhgi7PyP58=; b=AIAwvbhhKTV6jotRew7ZvDbgGs+lWtJ8fXZDyQ28UyNbMkYaId/Tw4YTAwhDM2/vXu1Tn5 b3XFmheJOFBDRbLpZown5RhXuBAuo3fx7VEGuLgCyH8IYzsRzgHY3dOd8wxGxKxJLZD4Zi A5EuNMmDv7h8HW4BT7xP/r0tf4DMwSc= X-MC-Unique: ZpGuw1UYMiK8DkB1ggjINw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu_migration: Don't mangle NBD part of migration cookie Date: Mon, 26 Oct 2020 11:41:36 +0100 Message-Id: <895a8d164593a9b6056c0c4bdd64e465893be43e.1603708799.git.mprivozn@redhat.com> 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.12 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" In recent commit v6.8.0-135-g518be41aaa the formatting of NBD into migration cookie was moved into a separate function and with it it was switched from direct printing into the output buffer to virXMLFormatElement(). But there was a typo. The virXMLFormatElement() accepts two buffers on input, one for element attributes and another for child elements. Well, the line that was supposed to add NBD port into the attributes buffer printed the attribute directly into the output buffer which produced this mangled XML: port=3D'49153' Changing the incriminated line to print into the attributes buffer fixes the problem. Fixes: 518be41aaa3ebaac5f2307f268d24dc1b40b6b5c Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/qemu/qemu_migration_cookie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index 708c2cced7..39445ef8de 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -747,7 +747,7 @@ qemuMigrationCookieNBDXMLFormat(qemuMigrationCookieNBDP= tr nbd, size_t i; =20 if (nbd->port) - virBufferAsprintf(buf, " port=3D'%d'", nbd->port); + virBufferAsprintf(&attrBuf, " port=3D'%d'", nbd->port); =20 for (i =3D 0; i < nbd->ndisks; i++) { virBufferEscapeString(&childBuf, "disks= [i].target); --=20 2.26.2