From nobody Tue Feb 10 02:33:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=openvz.org Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1649748757349686.6568888558817; Tue, 12 Apr 2022 00:32:37 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-cJ4VUQY0MTeFYqKQvFLpCQ-1; Tue, 12 Apr 2022 03:32:25 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22AF21C05B08; Tue, 12 Apr 2022 07:32:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E5F54292C1; Tue, 12 Apr 2022 07:32:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D3C4D1949762; Tue, 12 Apr 2022 07:32:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A547E1949762 for ; Tue, 12 Apr 2022 07:32:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 970CB4292CD; Tue, 12 Apr 2022 07:32:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 924494292C8 for ; Tue, 12 Apr 2022 07:32:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75E2280418E for ; Tue, 12 Apr 2022 07:32:21 +0000 (UTC) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-411-4FTF4PdoNQmpQBbyxluisA-1; Tue, 12 Apr 2022 03:32:18 -0400 Received: by mail-lf1-f53.google.com with SMTP id bu29so30791303lfb.0 for ; Tue, 12 Apr 2022 00:32:16 -0700 (PDT) Received: from vzbook.. (broadband-90-154-71-96.ip.moscow.rt.ru. [90.154.71.96]) by smtp.gmail.com with ESMTPSA id y16-20020a05651c107000b0024b50b2622csm1227816ljm.20.2022.04.12.00.32.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 00:32:14 -0700 (PDT) X-MC-Unique: cJ4VUQY0MTeFYqKQvFLpCQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 4FTF4PdoNQmpQBbyxluisA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uq3A7jzTwwY5rVL3ChxzO9Iqk/dtfnc/ak98Un6p9i8=; b=HsPOLqnuPycE2aSV5g1dv9Nbarl28TLnmnWM4giFyd8mFsuA0bcOghZzYJ8rqrvM1A sCmsr1aXO563VZmaSqke9wMRtJ6aBBmjPzOZc7vcGArv0mzd5Ql9ALMLpa2agKECu4BW fdYqFNZbL3aIiTAa9uA95CpMOnL/ZjW2c9WnT4gd/KjXGJdip/LziOPIjxlGFH9+xs2H OyqmOSAbvImfL98H7fw6UsYj1HSSx+qKQLVicBW5Owcfp5KRARF2ds0naKr5OiWAKkE4 YF9X+sWjhKbglT3poI/IP3IABR3u+aksiLxzAwfDfuFZ5tAEIgVKk4DkVSUH0HAF6bMe 9ZUA== X-Gm-Message-State: AOAM530Q/7SPluTProAGmVJcesAniPBdq0322DuBXJUvYYigE1WnK+Q7 sGhBwIDfHXFRdOEkObyYVY/p3Nint2QDmg== X-Google-Smtp-Source: ABdhPJxPf/HFONSWZnQyDnAOC/DA/Zl1rWcPmnI2azv7ogFTakCk7BBuEMCORyX16nOaCcab7P7Y1g== X-Received: by 2002:ac2:5604:0:b0:46b:b72f:c048 with SMTP id v4-20020ac25604000000b0046bb72fc048mr2154709lfd.591.1649748734613; Tue, 12 Apr 2022 00:32:14 -0700 (PDT) From: Nikolay Shirokovskiy X-Google-Original-From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 3/4] qemu: cleanup code to release VNC websocket port Date: Tue, 12 Apr 2022 10:31:29 +0300 Message-Id: <20220412073130.149126-4-nshirokovskiy@openvz.org> In-Reply-To: <20220412073130.149126-1-nshirokovskiy@openvz.org> References: <20220412073130.149126-1-nshirokovskiy@openvz.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1649748759202100001 Content-Type: text/plain; charset="utf-8" VNC websocket port cleanup looks a bit repetetive. Let's set websocketReser= ved flag whenever we reserve port (auto or not). Also websocketReserved flag is not cleared on stop in case of reconnect with auto port (flags is set on reconnect in qemuProcessGraphicsReservePorts call). Yeah config is freed in the end of stopping domain but still. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_process.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9c7583a10b..6db8bbc421 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4002,6 +4002,7 @@ qemuProcessVNCAllocatePorts(virQEMUDriver *driver, return -1; graphics->data.vnc.websocket =3D port; graphics->data.vnc.websocketGenerated =3D true; + graphics->data.vnc.websocketReserved =3D true; } =20 return 0; @@ -8268,12 +8269,13 @@ void qemuProcessStop(virQEMUDriver *driver, virPortAllocatorRelease(graphics->data.vnc.port); graphics->data.vnc.portReserved =3D false; } - if (graphics->data.vnc.websocketGenerated) { + if (graphics->data.vnc.websocketReserved) { virPortAllocatorRelease(graphics->data.vnc.websocket); + graphics->data.vnc.websocketReserved =3D false; + } + if (graphics->data.vnc.websocketGenerated) { graphics->data.vnc.websocketGenerated =3D false; graphics->data.vnc.websocket =3D -1; - } else if (graphics->data.vnc.websocketReserved) { - virPortAllocatorRelease(graphics->data.vnc.websocket); } } if (graphics->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { --=20 2.35.1