From nobody Tue May 7 22:00:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1598334493; cv=none; d=zohomail.com; s=zohoarc; b=J8amL9dS3RTjwzEuun6ydKJME52Bb37Z5/NebNvPdAtFhkwLbqgrQOD6YsVuRAAgkJXhJdD474ei3p+0YEKPpZ3OiAntp3r0XjKumL3CGSMmM2Ha0sXoBw+p1PqSAnsds5GtuH/Uf0O9Ax9YE+yCbLAHQWGEDlLtC41Ba7u9kFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598334493; 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=5PLs4bOSJqXq6Iw7ApfdsVSCC102/HwYvdbpjxHQIow=; b=FTI19qNZlsizbdLqjE8RqsPhvFTvTbW4JbBLJpaQP84beHC4+n/OUgdayUUjViHm9Hf9DiCWY8YwE/yYFLh1u0rl/ryaRL7+/Emqy3+T10JMHZHN5EuyT0cXRdirx3ED87e7d/CX/59SAp99VGuHUoIs+w4iTc3Nd9g/2h91aD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1598334493147716.3443355873901; Mon, 24 Aug 2020 22:48:13 -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-172-hgb4IlcyOESr5h3g7DK9Vw-1; Tue, 25 Aug 2020 01:48:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4423801AF2; Tue, 25 Aug 2020 05:48:03 +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 D872F808AA; Tue, 25 Aug 2020 05:48:00 +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 0DCE4181A06D; Tue, 25 Aug 2020 05:47:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lJq0008043 for ; Tue, 25 Aug 2020 01:47:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9A77860C13; Tue, 25 Aug 2020 05:47:19 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C0DD60C0F for ; Tue, 25 Aug 2020 05:47:16 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 625A3C20041 for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598334491; 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=5PLs4bOSJqXq6Iw7ApfdsVSCC102/HwYvdbpjxHQIow=; b=LIxWpoaY3hjpGirb78eocAO99XZhWvcjOw2ym8nhFnOQY0G6xZBH9QbQJiYidF/cLi2m56 uJXwxKmJEFjOdU5CDMBZWE77gmRqSpPCUH5tS27bNzjcIGWKCnz+iZXlRfoToZwVBcXrQi Iqwu5k1SeiXxTOrgCuA8+fohvpm8ZzM= X-MC-Unique: hgb4IlcyOESr5h3g7DK9Vw-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 1/9] qemu: Use g_autofree in qemuMigrationSrcConnect Date: Tue, 25 Aug 2020 07:47:07 +0200 Message-Id: <5446102a5004c366d2b62f9145a5641d923bc6ba.1598334399.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 142faa2cf997..60ddfde65d46 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3369,7 +3369,7 @@ qemuMigrationSrcConnect(virQEMUDriverPtr driver, { virNetSocketPtr sock; const char *host; - char *port =3D NULL; + g_autofree char *port =3D NULL; int ret =3D -1; =20 host =3D spec->dest.host.name; @@ -3400,7 +3400,6 @@ qemuMigrationSrcConnect(virQEMUDriverPtr driver, ret =3D 0; =20 cleanup: - VIR_FREE(port); if (ret < 0) VIR_FORCE_CLOSE(spec->dest.fd.qemu); return ret; --=20 2.28.0 From nobody Tue May 7 22:00:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1598335740; cv=none; d=zohomail.com; s=zohoarc; b=S3prlPvQRdJdZ5Ra3gb/sTIutotjl8O2BoWG4H/uxm/Z8/6PStlWY9Gk+tp6I1LdKTGpORQZ1sW80R33pXmh2rhE10p54A2jOb6CmO4R8RHtlG6TUpqi45qbEET9sU7J2z9pTL7ip1qnbtnHmqFxXhhZypD8Hu3uyEhpDW9a4tE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598335740; 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=iklfdl5AH/xUGGgg71Ak1SvK5sx/D1GfbdDUYqPt5ZY=; b=FRCIB3ZxJ/PSH4yR9m0HZDn/3u4t+YISH6MbJmeHJHGlfmhst1x+ks7Kkk3SeV9KwI5Ul6IUUkMrL0Oz48/AfPbidg2woWrt22zIKKy2pM8MzcpZVMrLrqmafERgkmh6doE4HMJE2I88UtO/7BayeHwoEMNlCuZsCDoVY9oE8k4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1598335740455227.46783314429456; Mon, 24 Aug 2020 23:09:00 -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-202-T-gbbKkbOnelWn_Ts9R6nA-1; Tue, 25 Aug 2020 02:08:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6FB0A18A2251; Tue, 25 Aug 2020 06:08:51 +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 4F8507E33D; Tue, 25 Aug 2020 06:08:51 +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 215A0668F6; Tue, 25 Aug 2020 06:08:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lJ7p008051 for ; Tue, 25 Aug 2020 01:47:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id BA7D35D9CA; Tue, 25 Aug 2020 05:47:19 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 898485D9D5 for ; Tue, 25 Aug 2020 05:47:17 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 6307CC20084 for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598335739; 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=iklfdl5AH/xUGGgg71Ak1SvK5sx/D1GfbdDUYqPt5ZY=; b=hucdXv7G8q9i1Z4dkgzA5cajVairnOMlLYglGtAQohcUQf8H5koaXIM0ctWJbBmddA80nj 0PpYH/0E6hN/3EOjSIVJrIODNs2lCqVJ5k3KaUT1aKqbM8bLXLNRLffZl1nVZo4GjRVe3w A+HJOHXYonpCLvRvKvyPhD/NYKqSKNA= X-MC-Unique: T-gbbKkbOnelWn_Ts9R6nA-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 2/9] qemu: Rework qemuMigrationSrcConnect Date: Tue, 25 Aug 2020 07:47:08 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Instead of saving some data from a union up front and changing an overlayed struct before using said data, let's just set the new values after they are decided. This will increase the readability of future commit(s). Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 60ddfde65d46..1a3cdb71f424 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -3368,24 +3368,24 @@ qemuMigrationSrcConnect(virQEMUDriverPtr driver, qemuMigrationSpecPtr spec) { virNetSocketPtr sock; - const char *host; g_autofree char *port =3D NULL; + int fd_qemu =3D -1; int ret =3D -1; =20 - host =3D spec->dest.host.name; - port =3D g_strdup_printf("%d", spec->dest.host.port); - - spec->destType =3D MIGRATION_DEST_FD; - spec->dest.fd.qemu =3D -1; - if (qemuSecuritySetSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; - if (virNetSocketNewConnectTCP(host, port, + port =3D g_strdup_printf("%d", spec->dest.host.port); + if (virNetSocketNewConnectTCP(spec->dest.host.name, + port, AF_UNSPEC, &sock) =3D=3D 0) { - spec->dest.fd.qemu =3D virNetSocketDupFD(sock, true); + fd_qemu =3D virNetSocketDupFD(sock, true); virObjectUnref(sock); } + + spec->destType =3D MIGRATION_DEST_FD; + spec->dest.fd.qemu =3D fd_qemu; + if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0= || spec->dest.fd.qemu =3D=3D -1) goto cleanup; --=20 2.28.0 From nobody Tue May 7 22:00:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1598335695; cv=none; d=zohomail.com; s=zohoarc; b=VYkK3urwhH/y8vn/s+XlILxntR64Oi2+Fxen4s4X9esIz7Vczb1eDshI1UJay7wRXj21e6YpcY+QjBRLNpQKirzTQGO2uiUtcd0XCPukK+wwHyX7hf31aRDm1Yl6iQB22AA5mxmg02XK4/t5RkXAiv1CZm9SWZywnr0pr4Z95OU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598335695; 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=c8qCwM9mFB0naWcD2g7ElxdMy08ko4Np8AET+SnpsRg=; b=ix2hc7wGbdeb2O2opcKPClM2Lyi0XVBH+tRC2KMB7vmk3EjFdk9oeetcg6iX1VUWp0YmKIkWnlgTGTw5yntoav7jQ6YEJmMwTksHknQJy9jYhsUI/urZbFCaG3oy1h5m44y3fGTeHG7blQ3q0lx4OJgivCirjOmr1CLqsoQPqmo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1598335695752377.7689012104322; Mon, 24 Aug 2020 23:08:15 -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-465-0xgkXpfDMWa0NzOwhQrmCg-1; Tue, 25 Aug 2020 02:08:12 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF2BF1005E6A; Tue, 25 Aug 2020 06:08:05 +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 51DEC10098A5; Tue, 25 Aug 2020 06:08:04 +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 C88C3668F1; Tue, 25 Aug 2020 06:08:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lJYe008049 for ; Tue, 25 Aug 2020 01:47:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id B7AA05D9DC; Tue, 25 Aug 2020 05:47:19 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 897EA5D9D3 for ; Tue, 25 Aug 2020 05:47:16 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 63A99C20098 for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598335694; 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=c8qCwM9mFB0naWcD2g7ElxdMy08ko4Np8AET+SnpsRg=; b=F4cjr//33FQbig9XRlPd1zA3f3YyV4L2hjIQr/oduQrjB+RlhY/TCs/op/F3Kns93WtrR4 Ilqgt7x4BZUB90qipfUYRl5ZSV6wBJ3+crXPORq85pbDV9+0xwGj8AHqHVVb8mZyFq5VsM bU1CDpZYjt/X5F5t0aj0SpP+nXPIWbk= X-MC-Unique: 0xgkXpfDMWa0NzOwhQrmCg-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 3/9] virsh: Reuse existing variable when parsing migrate --disks-port Date: Tue, 25 Aug 2020 07:47:09 +0200 Message-Id: <1019a0aa0a5ab19627ca19671b13e230467c3640.1598334399.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- tools/virsh-domain.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 1f3a549d9ab0..c606900a9268 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10704,7 +10704,6 @@ doMigrate(void *opaque) virDomainPtr dom =3D NULL; const char *desturi =3D NULL; const char *opt =3D NULL; - int disksPort =3D 0; unsigned int flags =3D 0; virshCtrlData *data =3D opaque; vshControl *ctl =3D data->ctl; @@ -10752,11 +10751,11 @@ doMigrate(void *opaque) VIR_MIGRATE_PARAM_LISTEN_ADDRESS, opt) < 0) goto save_error; =20 - if (vshCommandOptInt(ctl, cmd, "disks-port", &disksPort) < 0) + if (vshCommandOptInt(ctl, cmd, "disks-port", &intOpt) < 0) goto out; - if (disksPort && + if (intOpt && virTypedParamsAddInt(¶ms, &nparams, &maxparams, - VIR_MIGRATE_PARAM_DISKS_PORT, disksPort) < 0) + VIR_MIGRATE_PARAM_DISKS_PORT, intOpt) < 0) goto save_error; =20 if (vshCommandOptStringReq(ctl, cmd, "dname", &opt) < 0) --=20 2.28.0 From nobody Tue May 7 22:00:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1598334530; cv=none; d=zohomail.com; s=zohoarc; b=ngIMWC+PMf12xXLkl0ssdmbToJZ1sMc40hcA+5WuAa9pOPZMwwoqY+QSQTowICS3ymkQcdjniIjn22seCYyjPOEF6kXVs4MAYmILrmfkYHHrsiBE5QnrSRbxBWI7unCK3DdCH2/8sskmlWR+sjrAMZJciKbGyqFwCwv2SRhjdDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598334530; 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=ZT4yys1uXf1ZNpTHGrBV0DO7GCw/C5v0bjhUx6+XZ00=; b=Q7obCcSgmR8EevR4g3+WoTEuF0E4Cc+1/ulvVq+jH0CijkTgS1foXVGB0U9B/lZ6uXN72NEyfhDsBllPs9FLClv3ilNvVVY68L4ALNtYSNx2H8x0sGb+wIc5KuGR5+2dyftodStLbs7CdjvVsCVi6HQjfMlaw50B95YkVMQKP78= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1598334530792577.4522051993692; Mon, 24 Aug 2020 22:48:50 -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-171-5eLDLbVqPoG7w4e615fNoA-1; Tue, 25 Aug 2020 01:48:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A3B581F021; Tue, 25 Aug 2020 05:48:41 +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 DA99C3C89; Tue, 25 Aug 2020 05:48:40 +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 934A7181A06D; Tue, 25 Aug 2020 05:48:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lJqE008048 for ; Tue, 25 Aug 2020 01:47:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id B690A5C22A; Tue, 25 Aug 2020 05:47:19 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88F265C6D9 for ; Tue, 25 Aug 2020 05:47:16 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 643B1C2009E for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598334529; 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=ZT4yys1uXf1ZNpTHGrBV0DO7GCw/C5v0bjhUx6+XZ00=; b=TzWU0fnXozz+Ig4MJcgnNVAwVmGWH00bw0gZKc6AJP1FOM/jd6OkJHZxg9bjg5gz4vcCc6 v/b9xm+ZvHKnwEn0ZZz9cCzkpXotS+eY0BUm69AJoP+8B8ryI3rfikkcjLUvWvbQeTZyxm DJqoTLOShCDexLtqPjcF6Dov3df2TVQ= X-MC-Unique: 5eLDLbVqPoG7w4e615fNoA-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 4/9] qemu: Rework starting NBD server for migration Date: Tue, 25 Aug 2020 07:47:10 +0200 Message-Id: <871522a71aac8ae52f0e5a9306db99002621a258.1598334400.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Clean up the semantics by using one extra self-describing variable. This also fixes the port allocation when the port is specified. Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- src/qemu/qemu_migration.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 1a3cdb71f424..b887185d012d 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -383,12 +383,13 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr drive= r, { int ret =3D -1; qemuDomainObjPrivatePtr priv =3D vm->privateData; - unsigned short port =3D 0; size_t i; virStorageNetHostDef server =3D { .name =3D (char *)listenAddr, /* cast away const */ .transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP, + .port =3D nbdPort, }; + bool server_started =3D false; =20 if (nbdPort < 0 || nbdPort > USHRT_MAX) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -424,20 +425,27 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr drive= r, devicename =3D diskAlias; } =20 + if (!server_started) { + if (server.port) { + if (virPortAllocatorSetUsed(server.port) < 0) + goto cleanup; + } else { + unsigned short port =3D 0; + + if (virPortAllocatorAcquire(driver->migrationPorts, &port)= < 0) + goto cleanup; + + server.port =3D port; + } + } + if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN) < = 0) goto cleanup; =20 - if (port =3D=3D 0) { - if (nbdPort) - port =3D nbdPort; - else if (virPortAllocatorAcquire(driver->migrationPorts, &port= ) < 0) - goto exit_monitor; - - server.port =3D port; - if (qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) <= 0) - goto exit_monitor; - } + if (!server_started && + qemuMonitorNBDServerStart(priv->mon, &server, tls_alias) < 0) + goto exit_monitor; =20 if (qemuMonitorNBDServerAdd(priv->mon, devicename, exportname, tru= e, NULL) < 0) goto exit_monitor; @@ -445,12 +453,13 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr drive= r, goto cleanup; } =20 - priv->nbdPort =3D port; + priv->nbdPort =3D server.port; + ret =3D 0; =20 cleanup: - if (ret < 0 && nbdPort =3D=3D 0) - virPortAllocatorRelease(port); + if (ret < 0) + virPortAllocatorRelease(server.port); return ret; =20 exit_monitor: --=20 2.28.0 From nobody Tue May 7 22:00:06 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=1598335760; cv=none; d=zohomail.com; s=zohoarc; b=ibmTfX7ZjHy9I4J7jxY0jMiJG7blwSb6Nz86UPfiJ4CKKbRK5RPloNsLmqXyIkpuU0I92FhDaNNHpCYXynUbhUf+/xxVgfvYFYC5A46F2HyOzTz9eabLgiU6Cb6msfWFwgLpgkVSXRMnB2E7NMgvbubkOMuQUhDZTHABUrnItkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598335760; 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=D9CiXL8CMM+9LBtszpeflWUYuR5dA/harbjVExWDEWY=; b=Hn6+cYA9DvXAeC4YDjqZB0BBwNCLee/f9iNe3CXmyl+dWvaUfZn8eif8N7HBzbjkkiORsbtbwX+7GBF2OzPvH7mxhkf7oQ7DN5NYzNIpob+OI3wYp3Lvz6vULziGmCwbge0ukpJ7VK1RURDUHmP4WQR0COyuCMUX51T3dH9HrLM= 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 1598335760911718.396216811736; Mon, 24 Aug 2020 23:09:20 -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-20-mROOiS5bO7iKSJNafx2duA-1; Tue, 25 Aug 2020 02:09:17 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC8D51084C99; Tue, 25 Aug 2020 06:09:11 +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 B3A591014164; Tue, 25 Aug 2020 06:09:11 +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 7F1B9181A050; Tue, 25 Aug 2020 06:09:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lLQ2008070 for ; Tue, 25 Aug 2020 01:47:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5890F60C13; Tue, 25 Aug 2020 05:47:21 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00AAB60C0F for ; Tue, 25 Aug 2020 05:47:20 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 6F6E1C200AD for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598335759; 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=D9CiXL8CMM+9LBtszpeflWUYuR5dA/harbjVExWDEWY=; b=KWtVSvdx6nVDR2SwRgScJ6HVqKf6/YLMbvtpD4ZZeX23ceY81vDO9nJ3f9C2DKp56MJyhU E6YZA30u1Psn+U9Hr3nyTmsRAXHHGGZ2JQRU/P39pgbSQvBv2L1jMcf9mm18njOoR555vk S0kDn9a55jA0FuIrPLou8NBaW1QQWss= X-MC-Unique: mROOiS5bO7iKSJNafx2duA-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 5/9] tests: Add simple test for virDomainMigrateCheckNotLocal Date: Tue, 25 Aug 2020 07:47:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For this we need to make the function accessible (at least privately). The behaviour will change in following patches and the test helps explaining the change. Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- scripts/apibuild.py | 1 + src/libvirt-domain.c | 4 +- src/libvirt_internal.h | 2 + src/libvirt_private.syms | 1 + tests/meson.build | 1 + tests/virmigtest.c | 90 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 tests/virmigtest.c diff --git a/scripts/apibuild.py b/scripts/apibuild.py index 58ae76d29cfc..b94c0f6c09dd 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -81,6 +81,7 @@ ignored_words =3D { =20 ignored_functions =3D { "virConnectSupportsFeature": "private function for remote access", + "virDomainMigrateCheckNotLocal": "private function for migration", "virDomainMigrateFinish": "private function for migration", "virDomainMigrateFinish2": "private function for migration", "virDomainMigratePerform": "private function for migration", diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index ad60a92da879..4d958ca5219d 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -3269,8 +3269,7 @@ virDomainMigrateVersion3Params(virDomainPtr domain, params, nparams, true, flags); } =20 - -static int +int virDomainMigrateCheckNotLocal(const char *dconnuri) { g_autoptr(virURI) tempuri =3D NULL; @@ -3286,7 +3285,6 @@ virDomainMigrateCheckNotLocal(const char *dconnuri) return 0; } =20 - static int virDomainMigrateUnmanagedProto2(virDomainPtr domain, const char *dconnuri, diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h index 72c61274a74e..cb239b3c1c44 100644 --- a/src/libvirt_internal.h +++ b/src/libvirt_internal.h @@ -129,6 +129,8 @@ typedef enum { =20 int virConnectSupportsFeature(virConnectPtr conn, int feature); =20 +int virDomainMigrateCheckNotLocal(const char *dconnuri); + int virDomainMigratePrepare (virConnectPtr dconn, char **cookie, int *cookielen, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index f950a681792c..2f6d67cebe07 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1481,6 +1481,7 @@ virHostdevUpdateActiveUSBDevices; virConnectSupportsFeature; virDomainMigrateBegin3; virDomainMigrateBegin3Params; +virDomainMigrateCheckNotLocal; virDomainMigrateConfirm3; virDomainMigrateConfirm3Params; virDomainMigrateFinish; diff --git a/tests/meson.build b/tests/meson.build index b5f6e2267aaf..49bcf5eb8a8d 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -331,6 +331,7 @@ tests +=3D [ { 'name': 'virtypedparamtest' }, { 'name': 'viruritest' }, { 'name': 'vshtabletest', 'link_with': [ libvirt_shell_lib ] }, + { 'name': 'virmigtest' }, ] =20 if host_machine.system() =3D=3D 'linux' diff --git a/tests/virmigtest.c b/tests/virmigtest.c new file mode 100644 index 000000000000..9539aadb5157 --- /dev/null +++ b/tests/virmigtest.c @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2020 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include "libvirt_internal.h" + +#include "testutils.h" +#include "virlog.h" +#include "viruri.h" + +#define VIR_FROM_THIS VIR_FROM_RPC + +VIR_LOG_INIT("tests.migtest"); + +struct MigLocalData { + const char *uri; + bool fail; +}; + +extern int virDomainMigrateCheckNotLocal(const char *dconnuri); + +static int testMigNotLocal(const void *args) +{ + int ret =3D -1; + const struct MigLocalData *data =3D args; + + ret =3D virDomainMigrateCheckNotLocal(data->uri); + + if (ret =3D=3D -1) { + if (data->fail) { + virResetLastError(); + return 0; + } + return -1; + } + + if (data->fail) { + VIR_TEST_DEBUG("passed instead of expected failure"); + return -1; + } + + return ret; +} + +static int +mymain(void) +{ + int ret =3D 0; + +#define TEST_FULL(uri, fail) \ + do { \ + const struct MigLocalData data =3D { \ + uri, fail \ + }; \ + if (virTestRun("Test URI " # uri, testMigNotLocal, &data) < 0) \ + ret =3D -1; \ + } while (0) + +#define TEST(uri) TEST_FULL(uri, false) +#define TEST_FAIL(uri) TEST_FULL(uri, true) + + TEST_FAIL("qemu:///system"); + + TEST_FAIL("//localhost"); + TEST_FAIL("tcp://localhost.localdomain/"); + + TEST("scheme://some.cryptorandom.fqdn.tld"); + + TEST_FAIL("hehe+unix:///?socket=3D/path/to/some-sock"); + + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +VIR_TEST_MAIN(mymain) --=20 2.28.0 From nobody Tue May 7 22:00:06 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=1598334616; cv=none; d=zohomail.com; s=zohoarc; b=WDe1AevWIsm54ISR8ey5zz5yIVbj3M6f1DTvGCpvd46ICoTio6eh6jFyrdymWrM3o6ZsXrXAKw5n+hiMyvEPVssOTE+fqnxsqZwg/X1YFU1rDqvlcL5Of6i3C7ceJyhTBku4yRTg3pLP0rd432+stMLG9VBdeoKpsgdGQf9xrow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598334616; 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=jL6Rg2HL0sq4kB58zljhEptQMNjMhqeuJBQA8/3WQ1Y=; b=kEJ22+E3aoCeB96aNmsA0fSqLtD+VSzbA910EwcaAixi8/bZdEcYMAVVcap/zw044ceUkwQui+hGjTfhqCPvxuNQB80iyZNGaJRbdDQ+UW3Aq+NR/MyhWJpIlk45Obn5i4FVsXB9dSkK70pAUG5g4WBnNeWi+6LezVcBZv2fAFM= 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 1598334616098239.0339248461811; Mon, 24 Aug 2020 22:50:16 -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-327-NLFLUAm_OjSqDEC3KNNlKg-1; Tue, 25 Aug 2020 01:50:11 -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 0891E10060F1; Tue, 25 Aug 2020 05:50:06 +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 D4B617D4E2; Tue, 25 Aug 2020 05:50:05 +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 8F865181A06D; Tue, 25 Aug 2020 05:50:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lLtr008086 for ; Tue, 25 Aug 2020 01:47:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id AAC615C22A; Tue, 25 Aug 2020 05:47:21 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 015B25C6D9 for ; Tue, 25 Aug 2020 05:47:20 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 71601C200B0 for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598334614; 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=jL6Rg2HL0sq4kB58zljhEptQMNjMhqeuJBQA8/3WQ1Y=; b=Miy1Vz6U83pnsxs5C+VnGtojBd2w4xH/xVkwpXbDb9ad/xMkuo3MtHPnTnSgOWGaorwXsW qGrwJw+BGkN9q/Mh0gTodfLd7kEa05CB2Ki1tqKFbBu7T3932/L/OihlRnkliNPldErovx H8du63/Ttrh2QGpM0SniH/PWycQd6vQ= X-MC-Unique: NLFLUAm_OjSqDEC3KNNlKg-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 6/9] qemu: Allow NBD migration over UNIX socket Date: Tue, 25 Aug 2020 07:47:12 +0200 Message-Id: <8490b6048a10637d7e11f89c48c48a54fc574ca5.1598334400.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Adds new typed param for migration and uses this as a UNIX socket path that should be used for the NBD part of migration. And also adds virsh support. Partially resolves: https://bugzilla.redhat.com/1638889 Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- docs/manpages/virsh.rst | 8 +++ include/libvirt/libvirt-domain.h | 12 ++++ src/qemu/qemu_domain.h | 1 + src/qemu/qemu_driver.c | 33 ++++++++-- src/qemu/qemu_migration.c | 110 ++++++++++++++++++++++--------- src/qemu/qemu_migration.h | 3 + src/qemu/qemu_migration_cookie.c | 22 +++++-- src/qemu/qemu_migration_cookie.h | 1 + tools/virsh-domain.c | 12 ++++ 9 files changed, 160 insertions(+), 42 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 9187037a5615..75f475eea6ad 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3113,6 +3113,7 @@ migrate [--postcopy-bandwidth bandwidth] [--parallel [--parallel-connections connections]] [--bandwidth bandwidth] [--tls-destination hostname] + [--disks-socket socket-path] =20 Migrate domain to another host. Add *--live* for live migration; <--p2p> for peer-2-peer migration; *--direct* for direct migration; or *--tunnelle= d* @@ -3292,6 +3293,13 @@ error if this parameter is used. Optional *disks-port* sets the port that hypervisor on destination side sh= ould bind to for incoming disks traffic. Currently it is supported only by QEMU. =20 +Optional *disks-socket* path can also be specified (mutually exclusive with +*disks-port*) in case you need the disk migration to happen over a UNIX so= cket +with that specified path. In this case you need to make sure the same soc= ket +path is accessible to both source and destination hypervisors and connecti= ng to +the socket on the source (after hypervisor creates it on the destination) = will +actually connect to the destination. + =20 migrate-compcache ----------------- diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 8b9d9c110c19..b6c6b402b9b6 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -981,6 +981,18 @@ typedef enum { */ # define VIR_MIGRATE_PARAM_DISKS_PORT "disks_port" =20 +/** + * VIR_MIGRATE_PARAM_DISKS_SOCKET: + * + * virDomainMigrate* params field: path of a UNIX socket that destination = server + * should use for incoming disks migration. Type is VIR_TYPED_PARAM_STRING= . If + * omitted, migration will proceed over network (default). At the moment t= his is + * only supported by the QEMU driver. This is only usable if the manageme= nt + * application makes sure that socket created with this name on the destin= ation + * will be reachable from the source under the same exact path. + */ +# define VIR_MIGRATE_PARAM_DISKS_SOCKET "disks_socket" + /** * VIR_MIGRATE_PARAM_COMPRESSION: * diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index adba79aded54..71a644ca6b95 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -166,6 +166,7 @@ struct _qemuDomainObjPrivate { unsigned long migMaxBandwidth; char *origname; int nbdPort; /* Port used for migration with NBD */ + char *nbdSocketPath; /* Port used for migration with NBD */ unsigned short migrationPort; int preMigrationState; =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3636716ceea1..74b0348ccc4c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11233,7 +11233,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn, ret =3D qemuMigrationDstPrepareDirect(driver, dconn, NULL, 0, NULL, NULL, /* No cookies= */ uri_in, uri_out, - &def, origname, NULL, 0, NULL, 0, + &def, origname, NULL, 0, NULL, 0, = NULL, migParams, flags); =20 cleanup: @@ -11289,6 +11289,7 @@ qemuDomainMigratePerform(virDomainPtr dom, */ ret =3D qemuMigrationSrcPerform(driver, dom->conn, vm, NULL, NULL, dconnuri, uri, NULL, NULL, 0, NULL= , 0, + NULL, migParams, cookie, cookielen, NULL, NULL, /* No output cookies in v2 */ flags, dname, resource, false); @@ -11459,7 +11460,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn, cookieout, cookieoutlen, uri_in, uri_out, &def, origname, NULL, 0, NULL, 0, - migParams, flags); + NULL, migParams, flags); } =20 static int @@ -11485,6 +11486,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn, g_autofree const char **migrate_disks =3D NULL; g_autofree char *origname =3D NULL; g_autoptr(qemuMigrationParams) migParams =3D NULL; + const char *nbdSocketPath =3D NULL; =20 virCheckFlags(QEMU_MIGRATION_FLAGS, -1); if (virTypedParamsValidate(params, nparams, QEMU_MIGRATION_PARAMETERS)= < 0) @@ -11502,6 +11504,9 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn, virTypedParamsGetString(params, nparams, VIR_MIGRATE_PARAM_LISTEN_ADDRESS, &listenAddress) < 0 || + virTypedParamsGetString(params, nparams, + VIR_MIGRATE_PARAM_DISKS_SOCKET, + &nbdSocketPath) < 0 || virTypedParamsGetInt(params, nparams, VIR_MIGRATE_PARAM_DISKS_PORT, &nbdPort) < 0) @@ -11518,6 +11523,13 @@ qemuDomainMigratePrepare3Params(virConnectPtr dcon= n, QEMU_MIGRATION_DESTINAT= ION))) return -1; =20 + if (nbdSocketPath && nbdPort) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Both port and socket requested for disk migratio= n " + "while being mutually exclusive")); + return -1; + } + if (flags & VIR_MIGRATE_TUNNELLED) { /* this is a logical error; we never should have gotten here with * VIR_MIGRATE_TUNNELLED set @@ -11540,7 +11552,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn, uri_in, uri_out, &def, origname, listenAddress, nmigrate_disks, migrate_disks, nb= dPort, - migParams, flags); + nbdSocketPath, migParams, flags); } =20 =20 @@ -11682,7 +11694,7 @@ qemuDomainMigratePerform3(virDomainPtr dom, =20 ret =3D qemuMigrationSrcPerform(driver, dom->conn, vm, xmlin, NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0, - migParams, + NULL, migParams, cookiein, cookieinlen, cookieout, cookieoutlen, flags, dname, resource, true); @@ -11716,6 +11728,7 @@ qemuDomainMigratePerform3Params(virDomainPtr dom, unsigned long long bandwidth =3D 0; int nbdPort =3D 0; g_autoptr(qemuMigrationParams) migParams =3D NULL; + const char *nbdSocketPath =3D NULL; int ret =3D -1; =20 virCheckFlags(QEMU_MIGRATION_FLAGS, -1); @@ -11743,11 +11756,21 @@ qemuDomainMigratePerform3Params(virDomainPtr dom, virTypedParamsGetInt(params, nparams, VIR_MIGRATE_PARAM_DISKS_PORT, &nbdPort) < 0 || + virTypedParamsGetString(params, nparams, + VIR_MIGRATE_PARAM_DISKS_SOCKET, + &nbdSocketPath) < 0 || virTypedParamsGetString(params, nparams, VIR_MIGRATE_PARAM_PERSIST_XML, &persist_xml) < 0) goto cleanup; =20 + if (nbdSocketPath && nbdPort) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Both port and socket requested for disk migratio= n " + "while being mutually exclusive")); + goto cleanup; + } + nmigrate_disks =3D virTypedParamsGetStringList(params, nparams, VIR_MIGRATE_PARAM_MIGRATE= _DISKS, &migrate_disks); @@ -11768,7 +11791,7 @@ qemuDomainMigratePerform3Params(virDomainPtr dom, ret =3D qemuMigrationSrcPerform(driver, dom->conn, vm, dom_xml, persis= t_xml, dconnuri, uri, graphicsuri, listenAddres= s, nmigrate_disks, migrate_disks, nbdPort, - migParams, + nbdSocketPath, migParams, cookiein, cookieinlen, cookieout, cookie= outlen, flags, dname, bandwidth, true); cleanup: diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b887185d012d..3f4690f8fb72 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -379,6 +379,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, const char *tls_alias) { int ret =3D -1; @@ -386,7 +387,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, size_t i; virStorageNetHostDef server =3D { .name =3D (char *)listenAddr, /* cast away const */ - .transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP, + .transport =3D VIR_STORAGE_NET_HOST_TRANS_UNIX, .port =3D nbdPort, }; bool server_started =3D false; @@ -397,6 +398,13 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, return -1; } =20 + /* Prefer nbdSocketPath as there is no way to indicate we do not want = to + * listen on a port */ + if (nbdSocketPath) { + server.socket =3D (char *)nbdSocketPath; + server.transport =3D VIR_STORAGE_NET_HOST_TRANS_UNIX; + } + for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDefPtr disk =3D vm->def->disks[i]; g_autofree char *diskAlias =3D NULL; @@ -425,7 +433,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, devicename =3D diskAlias; } =20 - if (!server_started) { + if (!server_started && !nbdSocketPath) { if (server.port) { if (virPortAllocatorSetUsed(server.port) < 0) goto cleanup; @@ -453,7 +461,10 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver, goto cleanup; } =20 - priv->nbdPort =3D server.port; + if (nbdSocketPath) + priv->nbdSocketPath =3D g_strdup(server.socket); + else + priv->nbdPort =3D server.port; =20 ret =3D 0; =20 @@ -793,6 +804,7 @@ static virStorageSourcePtr qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(virDomainDiskDefPtr di= sk, const char *host, int port, + const char *socket, const char *tlsAlias) { g_autoptr(virStorageSource) copysrc =3D NULL; @@ -813,9 +825,14 @@ qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(vi= rDomainDiskDefPtr disk, copysrc->hosts =3D g_new0(virStorageNetHostDef, 1); =20 copysrc->nhosts =3D 1; - copysrc->hosts->transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; - copysrc->hosts->port =3D port; - copysrc->hosts->name =3D g_strdup(host); + if (socket) { + copysrc->hosts->transport =3D VIR_STORAGE_NET_HOST_TRANS_UNIX; + copysrc->hosts->socket =3D g_strdup(socket); + } else { + copysrc->hosts->transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; + copysrc->hosts->port =3D port; + copysrc->hosts->name =3D g_strdup(host); + } =20 copysrc->tlsAlias =3D g_strdup(tlsAlias); =20 @@ -835,6 +852,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr= driver, bool persistjob, const char *host, int port, + const char *socket, unsigned long long mirror_speed, unsigned int mirror_shallow, const char *tlsAlias) @@ -846,7 +864,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr= driver, =20 VIR_DEBUG("starting blockdev mirror for disk=3D%s to host=3D%s", disk-= >dst, host); =20 - if (!(copysrc =3D qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(= disk, host, port, tlsAlias))) + if (!(copysrc =3D qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(= disk, host, port, socket, tlsAlias))) return -1; =20 /* Migration via blockdev-mirror was supported sooner than the auto-re= ad-only @@ -885,13 +903,17 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriv= erPtr driver, const char *diskAlias, const char *host, int port, + const char *socket, unsigned long long mirror_speed, bool mirror_shallow) { g_autofree char *nbd_dest =3D NULL; int mon_ret; =20 - if (strchr(host, ':')) { + if (socket) { + nbd_dest =3D g_strdup_printf("nbd+unix:///%s?socket=3D%s", + diskAlias, socket); + } else if (strchr(host, ':')) { nbd_dest =3D g_strdup_printf("nbd:[%s]:%d:exportname=3D%s", host, = port, diskAlias); } else { @@ -920,6 +942,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr driv= er, virDomainDiskDefPtr disk, const char *host, int port, + const char *socket, unsigned long long mirror_speed, bool mirror_shallow, const char *tlsAlias, @@ -958,13 +981,13 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriverPtr dr= iver, rc =3D qemuMigrationSrcNBDStorageCopyBlockdev(driver, vm, disk, jobname, sourcename, persistjob, - host, port, + host, port, socket, mirror_speed, mirror_shallow, tlsAlias); } else { rc =3D qemuMigrationSrcNBDStorageCopyDriveMirror(driver, vm, diskA= lias, - host, port, + host, port, socket, mirror_speed, mirror_shallow); } @@ -1014,6 +1037,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr drive= r, const char **migrate_disks, virConnectPtr dconn, const char *tlsAlias, + const char *socket, unsigned int flags) { qemuDomainObjPrivatePtr priv =3D vm->privateData; @@ -1038,6 +1062,9 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr drive= r, port =3D mig->nbd->port; mig->nbd->port =3D 0; =20 + if (qemuSecurityDomainSetPathLabel(driver, vm, socket, false) < 0) + return -1; + for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDefPtr disk =3D vm->def->disks[i]; =20 @@ -1046,6 +1073,7 @@ qemuMigrationSrcNBDStorageCopy(virQEMUDriverPtr drive= r, continue; =20 if (qemuMigrationSrcNBDStorageCopyOne(driver, vm, disk, host, port, + socket, mirror_speed, mirror_shallow, tlsAlias, flags) < 0) return -1; @@ -2329,6 +2357,8 @@ qemuMigrationDstPrepare(virDomainObjPtr vm, =20 if (tunnel) { migrateFrom =3D g_strdup("stdio"); + } else if (g_strcmp0(protocol, "unix") =3D=3D 0) { + migrateFrom =3D g_strdup_printf("%s:%s", protocol, listenAddress); } else { bool encloseAddress =3D false; bool hostIPv6Capable =3D false; @@ -2397,6 +2427,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, unsigned long flags) { @@ -2650,7 +2681,8 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, =20 if (qemuMigrationDstStartNBDServer(driver, vm, incoming->address, nmigrate_disks, migrate_disks, - nbdPort, nbdTLSAlias) < 0) { + nbdPort, nbdSocketPath, + nbdTLSAlias) < 0) { goto stopjob; } cookieFlags |=3D QEMU_MIGRATION_COOKIE_NBD; @@ -2785,7 +2817,7 @@ qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver, return qemuMigrationDstPrepareAny(driver, dconn, cookiein, cookieinlen, cookieout, cookieoutlen, def, origna= me, st, NULL, 0, false, NULL, 0, NULL, 0, - migParams, flags); + NULL, migParams, flags); } =20 =20 @@ -2826,6 +2858,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, unsigned long flags) { @@ -2840,11 +2873,13 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driv= er, VIR_DEBUG("driver=3D%p, dconn=3D%p, cookiein=3D%s, cookieinlen=3D%d, " "cookieout=3D%p, cookieoutlen=3D%p, uri_in=3D%s, uri_out=3D%= p, " "def=3D%p, origname=3D%s, listenAddress=3D%s, " - "nmigrate_disks=3D%zu, migrate_disks=3D%p, nbdPort=3D%d, fla= gs=3D0x%lx", + "nmigrate_disks=3D%zu, migrate_disks=3D%p, nbdPort=3D%d, " + "nbdSocketPath=3D%s, flags=3D0x%lx", driver, dconn, NULLSTR(cookiein), cookieinlen, cookieout, cookieoutlen, NULLSTR(uri_in), uri_out, *def, origname, NULLSTR(listenAddress), - nmigrate_disks, migrate_disks, nbdPort, flags); + nmigrate_disks, migrate_disks, nbdPort, NULLSTR(nbdSocketPat= h), + flags); =20 *uri_out =3D NULL; =20 @@ -2947,7 +2982,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver, NULL, uri ? uri->scheme : "tcp", port, autoPort, listenAddress, nmigrate_disks, migrate_disks, nbdPor= t, - migParams, flags); + nbdSocketPath, migParams, flags); cleanup: if (ret !=3D 0) { VIR_FREE(*uri_out); @@ -3482,7 +3517,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, const char *graphicsuri, size_t nmigrate_disks, const char **migrate_disks, - qemuMigrationParamsPtr migParams) + qemuMigrationParamsPtr migParams, + const char *nbdSocketPath) { int ret =3D -1; unsigned int migrate_flags =3D QEMU_MONITOR_MIGRATE_BACKGROUND; @@ -3614,7 +3650,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, &migrate_flags, nmigrate_disks, migrate_disks, - dconn, tlsAlias, flags) < 0= ) { + dconn, tlsAlias, + nbdSocketPath, flags) < 0) { goto error; } } else { @@ -3854,7 +3891,8 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver, const char *graphicsuri, size_t nmigrate_disks, const char **migrate_disks, - qemuMigrationParamsPtr migParams) + qemuMigrationParamsPtr migParams, + const char *nbdSocketPath) { qemuDomainObjPrivatePtr priv =3D vm->privateData; g_autoptr(virURI) uribits =3D NULL; @@ -3908,7 +3946,7 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver, ret =3D qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookiei= nlen, cookieout, cookieoutlen, flags, resource, &spec, dconn, graphicsuri, nmigrate_disks, migrate_disks, - migParams); + migParams, nbdSocketPath); =20 if (spec.destType =3D=3D MIGRATION_DEST_FD) VIR_FORCE_CLOSE(spec.dest.fd.qemu); @@ -3971,7 +4009,7 @@ qemuMigrationSrcPerformTunnel(virQEMUDriverPtr driver, ret =3D qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookiei= nlen, cookieout, cookieoutlen, flags, resource, &s= pec, dconn, graphicsuri, nmigrate_disks, migrate_= disks, - migParams); + migParams, NULL); =20 cleanup: VIR_FORCE_CLOSE(spec.dest.fd.qemu); @@ -4078,7 +4116,7 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriverPtr dr= iver, cookie, cookielen, NULL, NULL, /* No out cookie w= ith v2 migration */ flags, resource, dconn, NULL, = 0, NULL, - migParams); + migParams, NULL); =20 /* Perform failed. Make sure Finish doesn't overwrite the error */ if (ret < 0) @@ -4142,6 +4180,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr dr= iver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, unsigned long long bandwidth, bool useParams, @@ -4226,6 +4265,11 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr d= river, VIR_MIGRATE_PARAM_DISKS_PORT, nbdPort) < 0) goto cleanup; + if (nbdSocketPath && + virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_DISKS_SOCKET, + nbdSocketPath) < 0) + goto cleanup; =20 if (qemuMigrationParamsDump(migParams, ¶ms, &nparams, &maxparams, &flags) < 0) @@ -4323,7 +4367,7 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr dr= iver, &cookieout, &cookieoutlen, flags, bandwidth, dconn, graph= icsuri, nmigrate_disks, migrate_disks, - migParams); + migParams, nbdSocketPath); } =20 /* Perform failed. Make sure Finish doesn't overwrite the error */ @@ -4498,6 +4542,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr dri= ver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, unsigned long flags, const char *dname, @@ -4618,7 +4663,7 @@ qemuMigrationSrcPerformPeer2Peer(virQEMUDriverPtr dri= ver, ret =3D qemuMigrationSrcPerformPeer2Peer3(driver, sconn, dconn, dc= onnuri, vm, xmlin, persist_xml, dname, uri, g= raphicsuri, listenAddress, nmigrate_di= sks, migrate_disks, - nbdPort, migParams, resour= ce, + nbdPort, nbdSocketPath, mi= gParams, resource, useParams, flags); } else { ret =3D qemuMigrationSrcPerformPeer2Peer2(driver, sconn, dconn, vm, @@ -4654,6 +4699,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, const char *cookiein, int cookieinlen, @@ -4692,6 +4738,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, ret =3D qemuMigrationSrcPerformPeer2Peer(driver, conn, vm, xmlin, = persist_xml, dconnuri, uri, graphicsuri,= listenAddress, nmigrate_disks, migrate_dis= ks, nbdPort, + nbdSocketPath, migParams, flags, dname, re= source, &v3proto); } else { @@ -4699,7 +4746,7 @@ qemuMigrationSrcPerformJob(virQEMUDriverPtr driver, ret =3D qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri= , cookiein, cookieinlen, cookieout, cookieoutlen, flags, resource, NULL, NULL, 0= , NULL, - migParams); + migParams, nbdSocketPath); } if (ret < 0) goto endjob; @@ -4765,7 +4812,8 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver, char **cookieout, int *cookieoutlen, unsigned long flags, - unsigned long resource) + unsigned long resource, + const char *nbdSocketPath) { qemuDomainObjPrivatePtr priv =3D vm->privateData; qemuDomainJobPrivatePtr jobPriv =3D priv->job.privateData; @@ -4787,7 +4835,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver, ret =3D qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, co= okiein, cookieinlen, cookieout, cookieoutlen, flags, resource, NULL, graphicsuri, - nmigrate_disks, migrate_disks, mig= Params); + nmigrate_disks, migrate_disks, mig= Params, nbdSocketPath); =20 if (ret < 0) { qemuMigrationSrcRestoreDomainState(driver, vm); @@ -4828,6 +4876,7 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, const char *cookiein, int cookieinlen, @@ -4841,11 +4890,12 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver, VIR_DEBUG("driver=3D%p, conn=3D%p, vm=3D%p, xmlin=3D%s, dconnuri=3D%s,= " "uri=3D%s, graphicsuri=3D%s, listenAddress=3D%s, " "nmigrate_disks=3D%zu, migrate_disks=3D%p, nbdPort=3D%d, " + "nbdSocketPath=3D%s, " "cookiein=3D%s, cookieinlen=3D%d, cookieout=3D%p, cookieoutl= en=3D%p, " "flags=3D0x%lx, dname=3D%s, resource=3D%lu, v3proto=3D%d", driver, conn, vm, NULLSTR(xmlin), NULLSTR(dconnuri), NULLSTR(uri), NULLSTR(graphicsuri), NULLSTR(listenAddress), - nmigrate_disks, migrate_disks, nbdPort, + nmigrate_disks, migrate_disks, nbdPort, NULLSTR(nbdSocketPat= h), NULLSTR(cookiein), cookieinlen, cookieout, cookieoutlen, flags, NULLSTR(dname), resource, v3proto); =20 @@ -4859,7 +4909,7 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver, return qemuMigrationSrcPerformJob(driver, conn, vm, xmlin, persist= _xml, dconnuri, uri, graphicsuri, listenAddress, nmigrate_disks, migrate_disks, n= bdPort, - migParams, + nbdSocketPath, migParams, cookiein, cookieinlen, cookieout, cookieoutlen, flags, dname, resource, v3proto); @@ -4877,12 +4927,12 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver, migParams, cookiein, cookieinlen, cookieout, cookieoutlen, - flags, resource); + flags, resource, nbdSocket= Path); } else { return qemuMigrationSrcPerformJob(driver, conn, vm, xmlin, per= sist_xml, NULL, uri, graphicsuri, listenAddr= ess, nmigrate_disks, migrate_disk= s, nbdPort, - migParams, + nbdSocketPath, migParams, cookiein, cookieinlen, cookieout, cookieoutlen, fla= gs, dname, resource, v3proto); diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index b6f88d3fd9ea..f195bda3e367 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -84,6 +84,7 @@ VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_ULLONG, \ VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT, \ VIR_MIGRATE_PARAM_TLS_DESTINATION, VIR_TYPED_PARAM_STRING, \ + VIR_MIGRATE_PARAM_DISKS_SOCKET, VIR_TYPED_PARAM_STRING, \ NULL =20 =20 @@ -149,6 +150,7 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, unsigned long flags); =20 @@ -165,6 +167,7 @@ qemuMigrationSrcPerform(virQEMUDriverPtr driver, size_t nmigrate_disks, const char **migrate_disks, int nbdPort, + const char *nbdSocketPath, qemuMigrationParamsPtr migParams, const char *cookiein, int cookieinlen, diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index 81b557e0a8b4..23511bed67d5 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -91,6 +91,8 @@ qemuMigrationCookieNBDFree(qemuMigrationCookieNBDPtr nbd) while (nbd->ndisks) VIR_FREE(nbd->disks[--nbd->ndisks].target); VIR_FREE(nbd->disks); + + VIR_FREE(nbd->socketPath); VIR_FREE(nbd); } =20 @@ -464,7 +466,10 @@ qemuMigrationCookieAddNBD(qemuMigrationCookiePtr mig, =20 mig->nbd =3D g_new0(qemuMigrationCookieNBD, 1); =20 - mig->nbd->port =3D priv->nbdPort; + if (priv->nbdSocketPath) + mig->nbd->socketPath =3D priv->nbdSocketPath; + else + mig->nbd->port =3D priv->nbdPort; mig->flags |=3D QEMU_MIGRATION_COOKIE_NBD; =20 if (vm->def->ndisks =3D=3D 0) @@ -988,12 +993,15 @@ qemuMigrationCookieNBDXMLParse(xmlXPathContextPtr ctx= t) if (VIR_ALLOC(ret) < 0) goto error; =20 - port =3D virXPathString("string(./nbd/@port)", ctxt); - if (port && virStrToLong_i(port, NULL, 10, &ret->port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Malformed nbd port '%s'"), - port); - goto error; + ret->socketPath =3D virXPathString("string(./nbd/@socketPath)", ctxt); + if (!ret->socketPath) { + port =3D virXPathString("string(./nbd/@port)", ctxt); + if (port && virStrToLong_i(port, NULL, 10, &ret->port) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Malformed nbd port '%s'"), + port); + goto error; + } } =20 /* Now check if source sent a list of disks to prealloc. We might be diff --git a/src/qemu/qemu_migration_cookie.h b/src/qemu/qemu_migration_coo= kie.h index 95e7edb89914..90a320a69c0c 100644 --- a/src/qemu/qemu_migration_cookie.h +++ b/src/qemu/qemu_migration_cookie.h @@ -93,6 +93,7 @@ typedef struct _qemuMigrationCookieNBD qemuMigrationCooki= eNBD; typedef qemuMigrationCookieNBD *qemuMigrationCookieNBDPtr; struct _qemuMigrationCookieNBD { int port; /* on which port does NBD server listen for incoming data */ + char *socketPath; =20 size_t ndisks; /* Number of items in @disk array */ struct qemuMigrationCookieNBDDisk *disks; diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index c606900a9268..20b8ab9837fd 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10639,6 +10639,10 @@ static const vshCmdOptDef opts_migrate[] =3D { .type =3D VSH_OT_INT, .help =3D N_("port to use by target server for incoming disks migrati= on") }, + {.name =3D "disks-socket", + .type =3D VSH_OT_STRING, + .help =3D N_("UNIX socket path to use for disks migration") + }, {.name =3D "comp-methods", .type =3D VSH_OT_STRING, .help =3D N_("comma separated list of compression methods to be used") @@ -10758,6 +10762,14 @@ doMigrate(void *opaque) VIR_MIGRATE_PARAM_DISKS_PORT, intOpt) < 0) goto save_error; =20 + if (vshCommandOptStringReq(ctl, cmd, "disks-socket", &opt) < 0) + goto out; + if (opt && + virTypedParamsAddString(¶ms, &nparams, &maxparams, + VIR_MIGRATE_PARAM_DISKS_SOCKET, + opt) < 0) + goto save_error; + if (vshCommandOptStringReq(ctl, cmd, "dname", &opt) < 0) goto out; if (opt && --=20 2.28.0 From nobody Tue May 7 22:00:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1598334552; cv=none; d=zohomail.com; s=zohoarc; b=iwlT0VyfeGfz5odPFLxQo6D+wi0DaJAwE6aluzRfl3SD2ejtUP2X9aGqHOChgPwd3z2w2Xosr6ECO6DgsDsCjRfklfoYF1qnNxj3SeIeyQWyPnnybsRRl8XN4diqWxNuSq9olv+xIAkt4X2Ui9/ER3fZxnW7RXIA1ZhWnfr21BE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598334552; 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=Btea4ah8NZ5+oZ+gMbZLxfm2DI8nt47CQ2vgh9Juyuw=; b=R0vxGf8gYnaXDRdnlhiXmzKHcC7qBBNSHzdhNV8sw8w0UzVShdfUW2Eif8M/4/XKrmvk3N89At7VGIhBhlHjz+ChNeU1apik9g1p3khYVNl6wlDgFfrzCLtBCa6Ia/6UBmHlPSDzk6Dum+qEvzXVewNjDSkLiWKOEa5bHIVFkJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1598334552538102.5766915913398; Mon, 24 Aug 2020 22:49:12 -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-411-RDMrS-bFOp2_I8Q4hW1UDg-1; Tue, 25 Aug 2020 01:49:09 -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 E99C681F023; Tue, 25 Aug 2020 05:49:02 +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 C4E4A6198B; Tue, 25 Aug 2020 05:49:02 +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 91BC4181A07B; Tue, 25 Aug 2020 05:49:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lLr0008077 for ; Tue, 25 Aug 2020 01:47:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7B0245DD6E; Tue, 25 Aug 2020 05:47:21 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19E4B5D9D5 for ; Tue, 25 Aug 2020 05:47:21 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 7D34CC200B1 for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598334551; 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=Btea4ah8NZ5+oZ+gMbZLxfm2DI8nt47CQ2vgh9Juyuw=; b=NyMlORQ4hPHrhwrtRMx6yz18KXq/8DPUbq2dYVlTeVHylGeOqDYLqs5x9zY0v7z6OS9LIH Xe4jAiVzmpeY5RSGpQOwF7zIQsK5fsPQc7UxHKpzDnbmV7KERdLQIOOcaiixkUM34AnA3k 95+2dR6qSm8WVgZnECwaugoYiG1inrg= X-MC-Unique: RDMrS-bFOp2_I8Q4hW1UDg-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 7/9] peer2peer migration: allow connecting to local sockets Date: Tue, 25 Aug 2020 07:47:13 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Local socket connections were outright disabled because there was no "serve= r" part in the URI. However, given how requirements and usage scenarios are evolving, some management apps might need the source libvirt daemon to conn= ect to the destination daemon over a UNIX socket for peer2peer migration. Sinc= e we cannot know where the socket leads (whether the same daemon or not) let's d= ecide that based on whether the socket path is non-standard, or rather explicitly specified in the URI. Checking non-standard path would require to ask the daemon for configuration and the only misuse that it would prevent would be= a pretty weird one. And that's not worth it. The assumption is that whenever someone uses explicit UNIX socket paths in the URI for migration they better know what they are doing. Partially resolves: https://bugzilla.redhat.com/1638889 Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- docs/manpages/virsh.rst | 9 +++++++++ src/libvirt-domain.c | 8 +++++++- src/remote/remote_driver.c | 8 ++++++-- src/util/viruri.c | 30 ++++++++++++++++++++++++++++++ src/util/viruri.h | 2 ++ tests/virmigtest.c | 2 +- 6 files changed, 55 insertions(+), 4 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 75f475eea6ad..cbb3c18deb30 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3235,6 +3235,15 @@ has different semantics: =20 * peer2peer migration: the *desturi* is an address of the target host as s= een from the source machine. =20 +In a special circumstance where you require a complete control of the conn= ection +and/or libvirt does not have network access to the remote side you can use= a +unix transport in the URI and specify a socket path in the query, for exam= ple +with the qemu driver you could use this: + +.. code-block:: + + qemu+unix://?socket=3D/path/to/socket + When *migrateuri* is not specified, libvirt will automatically determine t= he hypervisor specific URI. Some hypervisors, including QEMU, have an option= al "migration_host" configuration parameter (useful when the host has multiple diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 4d958ca5219d..fba4302e3d00 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -3276,7 +3276,13 @@ virDomainMigrateCheckNotLocal(const char *dconnuri) =20 if (!(tempuri =3D virURIParse(dconnuri))) return -1; - if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) { + + /* + * If someone migrates explicitly to a unix socket, then they have to = know + * what they are doing and it most probably was not a mistake. + */ + if ((tempuri->server && STRPREFIX(tempuri->server, "localhost")) || + (!tempuri->server && !virURICheckProxied(tempuri))) { virReportInvalidArg(dconnuri, "%s", _("Attempt to migrate guest to the same host")= ); return -1; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 0331060a2d5d..77a1c00c63a5 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1430,9 +1430,13 @@ remoteConnectOpen(virConnectPtr conn, =20 /* If there's a driver registered we must defer to that. * If there isn't a driver, we must connect in "direct" - * mode - see doRemoteOpen */ + * mode - see doRemoteOpen. + * One exception is if we are trying to connect to an + * unknown socket path as that might be proxied to remote + * host */ if (!conn->uri->server && - virHasDriverForURIScheme(driver)) { + virHasDriverForURIScheme(driver) && + !virURICheckProxied(conn->uri)) { ret =3D VIR_DRV_OPEN_DECLINED; goto cleanup; } diff --git a/src/util/viruri.c b/src/util/viruri.c index 0112186fdbc4..91f86de19a8e 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -393,3 +393,33 @@ virURIGetParam(virURIPtr uri, const char *name) _("Missing URI parameter '%s'"), name); return NULL; } + + +/** + * virCheckURIProxied: + * @uri: URI to check + * + * Check if the URI looks like it refers to a non-standard socket path. I= n such + * scenario the socket might be proxied to a remote server even though the= URI + * looks like it is only local. + * + * Returns: true if the URI might be proxied to a remote server + */ +bool +virURICheckProxied(virURIPtr uri) +{ + size_t i =3D 0; + + if (!uri->scheme) + return false; + + if (STRNEQ_NULLABLE(strchr(uri->scheme, '+'), "+unix")) + return false; + + for (i =3D 0; i < uri->paramsCount; i++) { + if (STREQ(uri->params[i].name, "socket")) + return true; + } + + return false; +} diff --git a/src/util/viruri.h b/src/util/viruri.h index e607ecc109e7..b71f5501df07 100644 --- a/src/util/viruri.h +++ b/src/util/viruri.h @@ -62,4 +62,6 @@ int virURIResolveAlias(virConfPtr conf, const char *alias= , char **uri); =20 const char *virURIGetParam(virURIPtr uri, const char *name); =20 +bool virURICheckProxied(virURIPtr uri); + #define VIR_URI_SERVER(uri) ((uri) && (uri)->server ? (uri)->server : "loc= alhost") diff --git a/tests/virmigtest.c b/tests/virmigtest.c index 9539aadb5157..5f52beab1421 100644 --- a/tests/virmigtest.c +++ b/tests/virmigtest.c @@ -82,7 +82,7 @@ mymain(void) =20 TEST("scheme://some.cryptorandom.fqdn.tld"); =20 - TEST_FAIL("hehe+unix:///?socket=3D/path/to/some-sock"); + TEST("hehe+unix:///?socket=3D/path/to/some-sock"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } --=20 2.28.0 From nobody Tue May 7 22:00:06 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=1598335795; cv=none; d=zohomail.com; s=zohoarc; b=CNSrlRCYEABoM3AsDCLEdJBhsAChCL8wNxFPOJ/QqCEwOG6yRwbsPSc1qheMt2TooJgzUVSJe/8YkZq1tTINKAgCzREzsDqKMidGI9iyOTh8f+Aec772ZQ096OAde2Ke/HsdU5CytfaFpWMDoa+aLReEkKeMzyjp/5Per3KhXLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598335795; 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=wnqbKxWMBd1RilGFZe4qso1LavBkh2UJyOGwvrHrYmA=; b=mogW9xcJUbCjrm5KiCUkSsxLZxYy/3nHoEb9otXcqBZia1lq5a5NHhGQEUVMMk+NBbZF2GNt8SOSfC+qw/OsL3UsD5iMGj5uiSREGbPMdoa0EU4sg7sgLH2H8qW2FVhIrm5l8bTDm+TzAZEjgPMhIv2L0UU3liNj6NXGSIdNWmU= 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 1598335795385594.5992305510845; Mon, 24 Aug 2020 23:09:55 -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-66-99TnT9JxP22jKQVXG03clQ-1; Tue, 25 Aug 2020 02:09:51 -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 0A77F81F01D; Tue, 25 Aug 2020 06:09:46 +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 DAFDD60C0F; Tue, 25 Aug 2020 06:09:45 +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 ABD5D668E7; Tue, 25 Aug 2020 06:09:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lOVO008118 for ; Tue, 25 Aug 2020 01:47:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2E028100239B; Tue, 25 Aug 2020 05:47:24 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A15531014161 for ; Tue, 25 Aug 2020 05:47:21 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 7EE53C200B3 for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598335794; 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=wnqbKxWMBd1RilGFZe4qso1LavBkh2UJyOGwvrHrYmA=; b=LVDvWpM0UZfQEx1dOduTfzagJFhh15sHpC+qI1pLpQ07DCHNYlcFcTRKbvLKddG5lgQXxB TaSeeLfidDNr/Qd9leZ+cZcrwMHt05fWJ7B2s0D2R3bQanFAqGFeTNfl+0X7c5XMuwSiRp +SJp0aVhsdsZX3cV6JTz2g0jSilZ5sk= X-MC-Unique: 99TnT9JxP22jKQVXG03clQ-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 8/9] qemu: Allow migration over UNIX socket Date: Tue, 25 Aug 2020 07:47:14 +0200 Message-Id: <88f6ba3ba637646b84a5cb1589c8474c61d41662.1598334400.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This allows: a) migration without access to network b) complete control of the migration stream c) easy migration between containerised libvirt daemons on the same host Resolves: https://bugzilla.redhat.com/1638889 Signed-off-by: Martin Kletzander Reviewed-by: Jiri Denemark --- docs/manpages/virsh.rst | 17 ++++- docs/migration.html.in | 33 ++++++++++ src/qemu/qemu_migration.c | 128 +++++++++++++++++++++++++++----------- 3 files changed, 139 insertions(+), 39 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index cbb3c18deb30..82f7c9f77488 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3237,12 +3237,12 @@ has different semantics: =20 In a special circumstance where you require a complete control of the conn= ection and/or libvirt does not have network access to the remote side you can use= a -unix transport in the URI and specify a socket path in the query, for exam= ple +UNIX transport in the URI and specify a socket path in the query, for exam= ple with the qemu driver you could use this: =20 .. code-block:: =20 - qemu+unix://?socket=3D/path/to/socket + qemu+unix:///system?socket=3D/path/to/socket =20 When *migrateuri* is not specified, libvirt will automatically determine t= he hypervisor specific URI. Some hypervisors, including QEMU, have an option= al @@ -3270,6 +3270,14 @@ There are a few scenarios where specifying *migrateu= ri* may help: might be specified to choose a specific port number outside the default = range in order to comply with local firewall policies. =20 +* The *desturi* uses UNIX transport method. In this advanced case libvirt + should not guess a *migrateuri* and it should be specified using + UNIX socket path URI: + +.. code-block:: + + unix://?socket=3D/path/to/socket + See `https://libvirt.org/migration.html#uris `_ for more details on migration URIs. =20 @@ -3296,7 +3304,10 @@ specific parameters separated by '&'. Currently reco= gnized parameters are Optional *listen-address* sets the listen address that hypervisor on the destination side should bind to for incoming migration. Both IPv4 and IPv6 addresses are accepted as well as hostnames (the resolving is done on -destination). Some hypervisors do not support this feature and will return= an +destination). In niche scenarios you can also use UNIX socket to make the +hypervisor connection over UNIX socket in which case you must make sure the +source can connect to the destination using the socket path provided by yo= u. +Some hypervisors do not support specifying the listen address and will ret= urn an error if this parameter is used. =20 Optional *disks-port* sets the port that hypervisor on destination side sh= ould diff --git a/docs/migration.html.in b/docs/migration.html.in index e95ee9de6f1b..9c8417674b22 100644 --- a/docs/migration.html.in +++ b/docs/migration.html.in @@ -201,6 +201,9 @@ numbers. In the latter case the management application may wish to choose a specific port number outside the default range in order to comply with local firewall policies. +
  • The second URI uses UNIX transport method. In this advanced case + libvirt should not guess a *migrateuri* and it should be specified= using + UNIX socket path URI: unix://?socket=3D/path/to/socket.
  • =20

    Configuration file handling

    @@ -628,5 +631,35 @@ virsh migrate --p2p --tunnelled web1 qemu+ssh://destho= st/system qemu+ssh://10.0. Supported by QEMU driver

    =20 + +

    Migration using only UNIX sockets=

    + +

    + In a niche scenarion where libvirt daemon does not have access to the + network (e.g. running in a restricted container on a host that has + accessible network), when a management application wants to have com= plete + control over the transfer or when migrating between two containers o= n the + same host all the communication can be done using UNIX sockets. This + includes connecting to non-standard socket path for the destination + daemon, using UNIX sockets for hypervisor's communication or for the= NBD + data transfer. All of that can be used with both peer2peer and dire= ct + migration options. +

    + +

    + Example using /tmp/migdir as a directory representing t= he + same path visible from both libvirt daemons. That can be achieved by + bind-mounting the same directory to different containers running sep= arate + daemons or forwarding connections to these sockets manually + (using socat, netcat or a custom piece of + software): +

    +virsh migrate web1 [--p2p] --copy-storage-all 'qemu+unix:///system?socket=
    =3D/tmp/migdir/test-sock-driver' 'unix://?socket=3D/tmp/migdir/test-sock-qe=
    mu' [--listen-address /tmp/migdir/test-sock-qemu] --disks-socket /tmp/migdi=
    r/test-sock-nbd
    +    
    + +

    + Supported by QEMU driver +

    + diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3f4690f8fb72..1158d152869c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2943,34 +2943,41 @@ qemuMigrationDstPrepareDirect(virQEMUDriverPtr driv= er, } =20 if (STRNEQ(uri->scheme, "tcp") && - STRNEQ(uri->scheme, "rdma")) { + STRNEQ(uri->scheme, "rdma") && + STRNEQ(uri->scheme, "unix")) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, _("unsupported scheme %s in migration URI %s"), uri->scheme, uri_in); goto cleanup; } =20 - if (uri->server =3D=3D NULL) { - virReportError(VIR_ERR_INVALID_ARG, _("missing host in migrati= on" - " URI: %s"), uri_in); - goto cleanup; - } - - if (uri->port =3D=3D 0) { - if (virPortAllocatorAcquire(driver->migrationPorts, &port) < 0) + if (STREQ(uri->scheme, "unix")) { + autoPort =3D false; + if (!listenAddress) + listenAddress =3D virURIGetParam(uri, "socket"); + } else { + if (uri->server =3D=3D NULL) { + virReportError(VIR_ERR_INVALID_ARG, _("missing host in mig= ration" + " URI: %s"), uri_in); goto cleanup; + } =20 - /* Send well-formed URI only if uri_in was well-formed */ - if (well_formed_uri) { - uri->port =3D port; - if (!(*uri_out =3D virURIFormat(uri))) + if (uri->port =3D=3D 0) { + if (virPortAllocatorAcquire(driver->migrationPorts, &port)= < 0) goto cleanup; + + /* Send well-formed URI only if uri_in was well-formed */ + if (well_formed_uri) { + uri->port =3D port; + if (!(*uri_out =3D virURIFormat(uri))) + goto cleanup; + } else { + *uri_out =3D g_strdup_printf("%s:%d", uri_in, port); + } } else { - *uri_out =3D g_strdup_printf("%s:%d", uri_in, port); + port =3D uri->port; + autoPort =3D false; } - } else { - port =3D uri->port; - autoPort =3D false; } } =20 @@ -3185,6 +3192,7 @@ qemuMigrationSrcConfirm(virQEMUDriverPtr driver, enum qemuMigrationDestinationType { MIGRATION_DEST_HOST, MIGRATION_DEST_CONNECT_HOST, + MIGRATION_DEST_CONNECT_SOCKET, MIGRATION_DEST_FD, }; =20 @@ -3204,6 +3212,10 @@ struct _qemuMigrationSpec { int port; } host; =20 + struct { + const char *path; + } socket; + struct { int qemu; int local; @@ -3418,13 +3430,29 @@ qemuMigrationSrcConnect(virQEMUDriverPtr driver, =20 if (qemuSecuritySetSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; - port =3D g_strdup_printf("%d", spec->dest.host.port); - if (virNetSocketNewConnectTCP(spec->dest.host.name, - port, - AF_UNSPEC, - &sock) =3D=3D 0) { - fd_qemu =3D virNetSocketDupFD(sock, true); - virObjectUnref(sock); + + switch (spec->destType) { + case MIGRATION_DEST_CONNECT_HOST: + port =3D g_strdup_printf("%d", spec->dest.host.port); + if (virNetSocketNewConnectTCP(spec->dest.host.name, + port, + AF_UNSPEC, + &sock) =3D=3D 0) { + fd_qemu =3D virNetSocketDupFD(sock, true); + virObjectUnref(sock); + } + break; + case MIGRATION_DEST_CONNECT_SOCKET: + if (virNetSocketNewConnectUNIX(spec->dest.socket.path, + false, NULL, + &sock) =3D=3D 0) { + fd_qemu =3D virNetSocketDupFD(sock, true); + virObjectUnref(sock); + } + break; + case MIGRATION_DEST_HOST: + case MIGRATION_DEST_FD: + break; } =20 spec->destType =3D MIGRATION_DEST_FD; @@ -3632,6 +3660,14 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, if (migrate_flags & (QEMU_MONITOR_MIGRATE_NON_SHARED_DISK | QEMU_MONITOR_MIGRATE_NON_SHARED_INC)) { if (mig->nbd) { + const char *host =3D ""; + + if (spec->destType =3D=3D MIGRATION_DEST_HOST || + spec->destType =3D=3D MIGRATION_DEST_CONNECT_HOST) { + host =3D spec->dest.host.name; + } + + /* Currently libvirt does not support setting up of the NBD * non-shared storage migration with TLS. As we need to honour= the * VIR_MIGRATE_TLS flag, we need to reject such migration until @@ -3645,7 +3681,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, =20 /* This will update migrate_flags on success */ if (qemuMigrationSrcNBDStorageCopy(driver, vm, mig, - spec->dest.host.name, + host, migrate_speed, &migrate_flags, nmigrate_disks, @@ -3693,7 +3729,8 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, goto exit_monitor; =20 /* connect to the destination qemu if needed */ - if (spec->destType =3D=3D MIGRATION_DEST_CONNECT_HOST && + if ((spec->destType =3D=3D MIGRATION_DEST_CONNECT_HOST || + spec->destType =3D=3D MIGRATION_DEST_CONNECT_SOCKET) && qemuMigrationSrcConnect(driver, vm, spec) < 0) { goto exit_monitor; } @@ -3716,6 +3753,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, break; =20 case MIGRATION_DEST_CONNECT_HOST: + case MIGRATION_DEST_CONNECT_SOCKET: /* handled above and transformed into MIGRATION_DEST_FD */ break; =20 @@ -3931,16 +3969,34 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driv= er, } } =20 - /* RDMA and multi-fd migration requires QEMU to connect to the destina= tion - * itself. - */ - if (STREQ(uribits->scheme, "rdma") || (flags & VIR_MIGRATE_PARALLEL)) - spec.destType =3D MIGRATION_DEST_HOST; - else - spec.destType =3D MIGRATION_DEST_CONNECT_HOST; - spec.dest.host.protocol =3D uribits->scheme; - spec.dest.host.name =3D uribits->server; - spec.dest.host.port =3D uribits->port; + if (STREQ(uribits->scheme, "unix")) { + if (flags & VIR_MIGRATE_TLS) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Migration over UNIX socket with TLS is not s= upported")); + return -1; + } + if (flags & VIR_MIGRATE_PARALLEL) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("Parallel migration over UNIX socket is not s= upported")); + return -1; + } + + spec.destType =3D MIGRATION_DEST_CONNECT_SOCKET; + spec.dest.socket.path =3D virURIGetParam(uribits, "socket"); + } else { + /* RDMA and multi-fd migration requires QEMU to connect to the des= tination + * itself. + */ + if (STREQ(uribits->scheme, "rdma") || (flags & VIR_MIGRATE_PARALLE= L)) + spec.destType =3D MIGRATION_DEST_HOST; + else + spec.destType =3D MIGRATION_DEST_CONNECT_HOST; + + spec.dest.host.protocol =3D uribits->scheme; + spec.dest.host.name =3D uribits->server; + spec.dest.host.port =3D uribits->port; + } + spec.fwdType =3D MIGRATION_FWD_DIRECT; =20 ret =3D qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookiei= nlen, cookieout, --=20 2.28.0 From nobody Tue May 7 22:00:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1598334571; cv=none; d=zohomail.com; s=zohoarc; b=Def1kU+F0FzDGS1uEyWwXNBlkJK8Ny2MsWiJShnvkOX0kfeAF2F/CBygVuBAG+l9qSldBfgy86NMJNNLj2qvCqBeOhPGfP5tRRSUGf95pY2qmEcMYCFWXK+6lz0rAn9jKf6XStl0nEBON0YJFE7WskL9T9QdNokXAWqMhPFtFVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598334571; 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=cpbI4727I4GQ14zqRpIj3F08xhPA+jRPs7BaczcASNQ=; b=D0Cx0VKsWgqX2H8kBcSGchY/e7V41UtFnKezFgSDB/Ra4QhzZvpdzqwW7TB+Mg55fdGruEEzvD6ZylLtYDpIogrMIEehMwt8LhTAlCJilANCE23/EVTswos9pBbobfTlm0/mGb3PfNjPiZchaQWbicMIuDI5YCnWGVAlEcvrqM0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1598334571034405.3197625428485; Mon, 24 Aug 2020 22:49:31 -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-54-q_ZGPvxaPCaMkAgzWtuStA-1; Tue, 25 Aug 2020 01:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BEF51DDFD; Tue, 25 Aug 2020 05: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 7CF1A808AA; Tue, 25 Aug 2020 05: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 457C7668E1; Tue, 25 Aug 2020 05:49:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07P5lN17008108 for ; Tue, 25 Aug 2020 01:47:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id BCC265D9CA; Tue, 25 Aug 2020 05:47:23 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F03D5D9D5 for ; Tue, 25 Aug 2020 05:47:21 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 80791C200B4 for ; Tue, 25 Aug 2020 07:47:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598334569; 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=cpbI4727I4GQ14zqRpIj3F08xhPA+jRPs7BaczcASNQ=; b=Bj4oqrUDMx6GJ23x54HcE4vt2kH2cTaDwp3/q5h1fRnTS14vNHIF43m1frQ6YrR9nMp8WD U5fBwVFeZ9ATyxcQovZuR2E7nNVhLtIYMiYFbNn4DygxiXoXKUTGBY6aRvoONdsA876SVn gYYUzsmS/R0r5XBzL07NlHBVUrLlcQE= X-MC-Unique: q_ZGPvxaPCaMkAgzWtuStA-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [libvirt PATCH 9/9] news: qemu: Allow migration over UNIX sockets Date: Tue, 25 Aug 2020 07:47:15 +0200 Message-Id: <009731891908556de40dcee9eff06b35bb87f183.1598334400.git.mkletzan@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.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" Signed-off-by: Martin Kletzander Reviewed-by tags for patches 6 and 8. Reviewed-by: Jiri Denemark --- NEWS.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index d92714c29b88..49c476be5d51 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -20,6 +20,12 @@ v6.7.0 (unreleased) Sparse streams (e.g. ``virsh vol-download --sparse`` or ``virsh vol-up= load --sparse``) now handle if one of the stream ends is a block device. =20 + * qemu: Allow migration over UNIX sockets + + QEMU migration can now be performed completely over UNIX sockets. This= is + useful for containerised scenarios and can be used in both peer2peer a= nd + direct migrations. + * **Bug fixes** =20 * virdevmapper: Deal with kernels without DM support --=20 2.28.0