From nobody Thu May 16 17:29:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530702313282923.393793822816; Wed, 4 Jul 2018 04:05:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2DC03001755; Wed, 4 Jul 2018 11:05: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 A710A308BDBD; Wed, 4 Jul 2018 11:05: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 4C3AC18037F2; Wed, 4 Jul 2018 11:05:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w64B51aM013518 for ; Wed, 4 Jul 2018 07:05:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id A7EEC5D6B5; Wed, 4 Jul 2018 11:05:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EF3E5D76F for ; Wed, 4 Jul 2018 11:04:57 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5ADC30001EF for ; Wed, 4 Jul 2018 11:04:55 +0000 (UTC) Received: from vz-out.virtuozzo.com ([185.231.240.5] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1fafaf-000096-90 for libvir-list@redhat.com; Wed, 04 Jul 2018 14:04:53 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 4 Jul 2018 14:03:37 +0300 Message-Id: <1530702221-451603-2-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] qemu: fix typo in vnc port releasing 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 04 Jul 2018 11:05:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy Reviewed-by: John Ferlan --- src/qemu/qemu_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 40d35cb..da5656d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6977,7 +6977,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, if (graphics->data.vnc.autoport) { virPortAllocatorRelease(graphics->data.vnc.port); } else if (graphics->data.vnc.portReserved) { - virPortAllocatorRelease(graphics->data.spice.port); + virPortAllocatorRelease(graphics->data.vnc.port); graphics->data.vnc.portReserved =3D false; } if (graphics->data.vnc.websocketGenerated) { --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 16 17:29:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530702307551123.1180043098069; Wed, 4 Jul 2018 04:05:07 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 6035E821C7; Wed, 4 Jul 2018 11:05: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 18DEB1001643; Wed, 4 Jul 2018 11:05: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 A3B814A460; Wed, 4 Jul 2018 11:05:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w64B51ER013519 for ; Wed, 4 Jul 2018 07:05:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id A86DC5B682; Wed, 4 Jul 2018 11:05:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9ED335D761 for ; Wed, 4 Jul 2018 11:04:57 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B78F73082A26 for ; Wed, 4 Jul 2018 11:04:55 +0000 (UTC) Received: from vz-out.virtuozzo.com ([185.231.240.5] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1fafaf-000096-EU for libvir-list@redhat.com; Wed, 04 Jul 2018 14:04:53 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 4 Jul 2018 14:03:38 +0300 Message-Id: <1530702221-451603-3-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.45 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] qemu: simplify graphics port releasing 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 04 Jul 2018 11:05:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Originally port allocator have 2 functions to release ports: one for for manually reserved ports and one for autoallocated ports. Thus a bit complicated code of port releasing. Now we have only one releasing function. Let's use *reserved flag whenever we manually/automatically allocate port so that we can use it later for releasing. Actually we set *reserved flag on autoallocation already on reconnection, which lead to uncleared flag on stop. So this step looks natural. qemuProcessGraphicsReservePorts is called on reconnect. As a result portReserved is set not only for manual ports but autoports too. Now due to the way port releasing is written in qemuProcessStop portReserved stays set for autoports after domain stop. Now imagine one redefine Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.h | 1 + src/qemu/qemu_process.c | 48 ++++++++++++++++++++++-----------------------= --- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 41d2748..1da6b8f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1610,6 +1610,7 @@ struct _virDomainGraphicsDef { int port; bool portReserved; int websocket; + bool websocketReserved; bool websocketGenerated; bool autoport; char *keymap; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index da5656d..de2e84b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3628,12 +3628,14 @@ qemuProcessVNCAllocatePorts(virQEMUDriverPtr driver, if (virPortAllocatorAcquire(driver->remotePorts, &port) < 0) return -1; graphics->data.vnc.port =3D port; + graphics->data.vnc.portReserved =3D true; } =20 if (graphics->data.vnc.websocket =3D=3D -1) { if (virPortAllocatorAcquire(driver->webSocketPorts, &port) < 0) return -1; graphics->data.vnc.websocket =3D port; + graphics->data.vnc.websocketReserved =3D true; graphics->data.vnc.websocketGenerated =3D true; } =20 @@ -3705,9 +3707,7 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver, goto cleanup; =20 graphics->data.spice.port =3D port; - - if (!graphics->data.spice.autoport) - graphics->data.spice.portReserved =3D true; + graphics->data.spice.portReserved =3D true; } =20 if (needTLSPort || graphics->data.spice.tlsPort =3D=3D -1) { @@ -3722,9 +3722,7 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver, goto cleanup; =20 graphics->data.spice.tlsPort =3D tlsPort; - - if (!graphics->data.spice.autoport) - graphics->data.spice.tlsPortReserved =3D true; + graphics->data.spice.tlsPortReserved =3D true; } =20 ret =3D 0; @@ -4328,9 +4326,11 @@ qemuProcessGraphicsReservePorts(virDomainGraphicsDef= Ptr graphics, return -1; graphics->data.vnc.portReserved =3D true; } - if (graphics->data.vnc.websocket > 0 && - virPortAllocatorSetUsed(graphics->data.vnc.websocket) < 0) - return -1; + if (graphics->data.vnc.websocket > 0) { + if (virPortAllocatorSetUsed(graphics->data.vnc.websocket) < 0) + return -1; + graphics->data.vnc.websocketReserved =3D true; + } break; =20 case VIR_DOMAIN_GRAPHICS_TYPE_SPICE: @@ -6974,34 +6974,30 @@ void qemuProcessStop(virQEMUDriverPtr driver, for (i =3D 0; i < vm->def->ngraphics; ++i) { virDomainGraphicsDefPtr graphics =3D vm->def->graphics[i]; if (graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC) { - if (graphics->data.vnc.autoport) { - virPortAllocatorRelease(graphics->data.vnc.port); - } else if (graphics->data.vnc.portReserved) { + if (graphics->data.vnc.portReserved) { virPortAllocatorRelease(graphics->data.vnc.port); graphics->data.vnc.portReserved =3D false; } + + if (graphics->data.vnc.websocketReserved) { + virPortAllocatorRelease(graphics->data.vnc.websocket); + graphics->data.vnc.websocketReserved =3D false; + } + if (graphics->data.vnc.websocketGenerated) { - virPortAllocatorRelease(graphics->data.vnc.websocket); graphics->data.vnc.websocketGenerated =3D false; graphics->data.vnc.websocket =3D -1; - } else if (graphics->data.vnc.websocket) { - virPortAllocatorRelease(graphics->data.vnc.websocket); } } if (graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { - if (graphics->data.spice.autoport) { + if (graphics->data.spice.portReserved) { virPortAllocatorRelease(graphics->data.spice.port); + graphics->data.spice.portReserved =3D false; + } + + if (graphics->data.spice.tlsPortReserved) { virPortAllocatorRelease(graphics->data.spice.tlsPort); - } else { - if (graphics->data.spice.portReserved) { - virPortAllocatorRelease(graphics->data.spice.port); - graphics->data.spice.portReserved =3D false; - } - - if (graphics->data.spice.tlsPortReserved) { - virPortAllocatorRelease(graphics->data.spice.tlsPort); - graphics->data.spice.tlsPortReserved =3D false; - } + graphics->data.spice.tlsPortReserved =3D false; } } } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 16 17:29:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530702312699217.20483440283022; Wed, 4 Jul 2018 04:05:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A168E30001EF; Wed, 4 Jul 2018 11:05:11 +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 5962C308BDBB; Wed, 4 Jul 2018 11:05: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 EC7EC4A463; Wed, 4 Jul 2018 11:05:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w64B52Co013531 for ; Wed, 4 Jul 2018 07:05:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 27AD5308BDB7; Wed, 4 Jul 2018 11:05:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F36E308BDB3 for ; Wed, 4 Jul 2018 11:04:57 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BAC6836887 for ; Wed, 4 Jul 2018 11:04:55 +0000 (UTC) Received: from vz-out.virtuozzo.com ([185.231.240.5] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1fafaf-000096-Hi for libvir-list@redhat.com; Wed, 04 Jul 2018 14:04:53 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 4 Jul 2018 14:03:39 +0300 Message-Id: <1530702221-451603-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] qemu: vnc: mark websocket as used on reconnect 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 04 Jul 2018 11:05:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy Reviewed-by: John Ferlan --- src/qemu/qemu_process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index de2e84b..09e0327 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4326,7 +4326,8 @@ qemuProcessGraphicsReservePorts(virDomainGraphicsDefP= tr graphics, return -1; graphics->data.vnc.portReserved =3D true; } - if (graphics->data.vnc.websocket > 0) { + if (graphics->data.vnc.websocket > 0 || + reconnect) { if (virPortAllocatorSetUsed(graphics->data.vnc.websocket) < 0) return -1; graphics->data.vnc.websocketReserved =3D true; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 16 17:29:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530702323422299.56360753459035; Wed, 4 Jul 2018 04:05:23 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 742983081243; Wed, 4 Jul 2018 11:05:16 +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 1651229007; Wed, 4 Jul 2018 11:05:16 +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 102F218037F1; Wed, 4 Jul 2018 11:05:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w64B52Fr013541 for ; Wed, 4 Jul 2018 07:05:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6432E2016A83; Wed, 4 Jul 2018 11:05:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5490A2016A82 for ; Wed, 4 Jul 2018 11:04:57 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B903530832D5 for ; Wed, 4 Jul 2018 11:04:55 +0000 (UTC) Received: from vz-out.virtuozzo.com ([185.231.240.5] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1fafaf-000096-MU for libvir-list@redhat.com; Wed, 04 Jul 2018 14:04:53 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 4 Jul 2018 14:03:40 +0300 Message-Id: <1530702221-451603-5-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] qemu: mark graphics ports as used on migration 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 04 Jul 2018 11:05:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_migration.c | 6 ++++++ src/qemu/qemu_process.c | 2 +- src/qemu/qemu_process.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 435cd17..7e12ff6 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4928,6 +4928,7 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, qemuDomainJobInfoPtr jobInfo =3D NULL; bool inPostCopy =3D false; bool doKill =3D true; + size_t i; =20 VIR_DEBUG("driver=3D%p, dconn=3D%p, vm=3D%p, cookiein=3D%s, cookieinle= n=3D%d, " "cookieout=3D%p, cookieoutlen=3D%p, flags=3D0x%lx, retcode= =3D%d", @@ -5000,6 +5001,11 @@ qemuMigrationDstFinish(virQEMUDriverPtr driver, if (qemuConnectAgent(driver, vm) < 0) goto endjob; =20 + for (i =3D 0; i < vm->def->ngraphics; i++) { + if (qemuProcessGraphicsReservePorts(vm->def->graphics[i], true) < = 0) + goto endjob; + } + if (flags & VIR_MIGRATE_PERSIST_DEST) { if (qemuMigrationDstPersist(driver, vm, mig, !v3proto) < 0) { /* Hmpf. Migration was successful, but making it persistent diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 09e0327..9f41313 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4303,7 +4303,7 @@ qemuProcessStartHook(virQEMUDriverPtr driver, } =20 =20 -static int +int qemuProcessGraphicsReservePorts(virDomainGraphicsDefPtr graphics, bool reconnect) { diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 07ce3a9..5d234f0 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -214,4 +214,7 @@ int qemuProcessStartManagedPRDaemon(virDomainObjPtr vm); =20 void qemuProcessKillManagedPRDaemon(virDomainObjPtr vm); =20 +int qemuProcessGraphicsReservePorts(virDomainGraphicsDefPtr graphics, + bool reconnect); + #endif /* __QEMU_PROCESS_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 16 17:29:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153070230667520.91572529436371; Wed, 4 Jul 2018 04:05:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45FD536887; Wed, 4 Jul 2018 11:05:04 +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 E3D33413E; Wed, 4 Jul 2018 11:05:03 +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 5A1954A460; Wed, 4 Jul 2018 11:05:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w64B50JC013506 for ; Wed, 4 Jul 2018 07:05:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A0866017C; Wed, 4 Jul 2018 11:05:00 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E7DC6017A for ; Wed, 4 Jul 2018 11:04:57 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA5F64E028 for ; Wed, 4 Jul 2018 11:04:55 +0000 (UTC) Received: from vz-out.virtuozzo.com ([185.231.240.5] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1fafaf-000096-PC for libvir-list@redhat.com; Wed, 04 Jul 2018 14:04:53 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 4 Jul 2018 14:03:41 +0300 Message-Id: <1530702221-451603-6-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1530702221-451603-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 04 Jul 2018 11:04:56 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] qemu: keep websocketGenerated on libvirtd restarts 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 04 Jul 2018 11:05:05 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Otherwise after libvirtd restart we come back to issues fixed by introducing this flag in [1]. [1] 61a0026a : qemu: Fix xml dump of autogenerated websocket Signed-off-by: Nikolay Shirokovskiy Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f4e59f6..e27a125 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13574,6 +13574,7 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDe= fPtr def, { char *port =3D virXMLPropString(node, "port"); char *websocket =3D virXMLPropString(node, "websocket"); + char *websocketGenerated =3D virXMLPropString(node, "websocketGenerate= d"); char *sharePolicy =3D virXMLPropString(node, "sharePolicy"); char *autoport =3D virXMLPropString(node, "autoport"); int ret =3D -1; @@ -13618,6 +13619,9 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDe= fPtr def, } } =20 + if (websocketGenerated && STREQ(websocketGenerated, "yes")) + def->data.vnc.websocketGenerated =3D true; + if (sharePolicy) { int policy =3D virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy); @@ -13643,6 +13647,7 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDe= fPtr def, VIR_FREE(port); VIR_FREE(autoport); VIR_FREE(websocket); + VIR_FREE(websocketGenerated); VIR_FREE(sharePolicy); return ret; } @@ -26245,6 +26250,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf, else if (def->data.vnc.websocket) virBufferAsprintf(buf, " websocket=3D'%d'", def->data.vnc.= websocket); =20 + if (flags & VIR_DOMAIN_DEF_FORMAT_STATUS) + virBufferAsprintf(buf, " websocketGenerated=3D'%s'", + def->data.vnc.websocketGenerated ? "yes"= : "no"); + virDomainGraphicsListenDefFormatAddr(buf, glisten, flags); break; case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE: --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list