From nobody Tue Feb 10 01:17:54 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 1649748762632955.754541801338; Tue, 12 Apr 2022 00:32:42 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-340-thMhNwb9PwenQoVDtBWlXw-1; Tue, 12 Apr 2022 03:32:36 -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 4DFAF101AA52; Tue, 12 Apr 2022 07:32:34 +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 32FC34292C8; Tue, 12 Apr 2022 07:32:34 +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 C7E191949762; Tue, 12 Apr 2022 07:32:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9A6B71947BBF for ; Tue, 12 Apr 2022 07:32:32 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8BD4D2024CD0; Tue, 12 Apr 2022 07:32:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 865B12024CBB for ; Tue, 12 Apr 2022 07:32:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 A5658801E67 for ; Tue, 12 Apr 2022 07:32:20 +0000 (UTC) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-133-fqlJOBg8P8qtE_VpbqSMgg-1; Tue, 12 Apr 2022 03:32:18 -0400 Received: by mail-lj1-f177.google.com with SMTP id u19so13368553ljd.11 for ; Tue, 12 Apr 2022 00:32:15 -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:13 -0700 (PDT) X-MC-Unique: thMhNwb9PwenQoVDtBWlXw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: fqlJOBg8P8qtE_VpbqSMgg-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=5/pjHDfjwk7VKBNh0V9yJWdlPB/B4FOvbsTAMxm4+vE=; b=k617v53fddmKxf6f8panAIp69ZfffeL0xJ9El9kief6Tp0zHfsiSa1AMRW/MGyFtyn yEJO6JVnHErQQi/fQ8RgiH/VhUB2KST2StilxQlbOclYcWsB/lyvnx6T3n07OVjbxs4T HpPe8O61UMRUs04vBnVFr5pMx8qrPqXn9qoNR+5zfKmlBQZUu1ZrmCESSauWzd4+yk/S yopKfD1a/Wci9WfP/dG9dsjmrKuWPVi70RM25YgrgXpTBKjP80djH6JYqGxKW6N5CdPd ZsZHdd0HsUmzVXfuYANbN63CoWMw+sb3huTeYIPBpgsI2e+T/XnwJbE9z0DKfTLEC4eo 3Gcg== X-Gm-Message-State: AOAM532XbpglwebkukQEVHQ+Z1FSqkMaGf45yRrFnH+VSaDaNKyuhLbs amGMUVpIpeYk1sC2tL7qw6ED9U+NPTm6/g== X-Google-Smtp-Source: ABdhPJz0ERW4gkqKlh367mG6Wg4mSV1VPiOzdk6TpwMU5dQuM0C7c1c3ZfhKEZswcJ3VK99aXf5yqA== X-Received: by 2002:a05:651c:1a11:b0:24b:54dd:720f with SMTP id by17-20020a05651c1a1100b0024b54dd720fmr11146482ljb.433.1649748733776; Tue, 12 Apr 2022 00:32:13 -0700 (PDT) From: Nikolay Shirokovskiy X-Google-Original-From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 2/4] qemu: fix releasing VNC websocket port domain does not own Date: Tue, 12 Apr 2022 10:31:28 +0300 Message-Id: <20220412073130.149126-3-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.78 on 10.11.54.4 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: 1649748763167100001 Content-Type: text/plain; charset="utf-8" Scenario is with two domains with same VNC websocket port. - start first domain - start second, it will fail as port is occupied As a result port will be released which breaks port reservation logic. Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.h | 1 + src/qemu/qemu_process.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 694491cd63..88a411d00c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1901,6 +1901,7 @@ struct _virDomainGraphicsDef { bool portReserved; int websocket; bool websocketGenerated; + bool websocketReserved; bool autoport; char *keymap; virDomainGraphicsAuthDef auth; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index cae87cdeca..9c7583a10b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4678,9 +4678,11 @@ qemuProcessGraphicsReservePorts(virDomainGraphicsDef= *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: @@ -8270,7 +8272,7 @@ void qemuProcessStop(virQEMUDriver *driver, virPortAllocatorRelease(graphics->data.vnc.websocket); graphics->data.vnc.websocketGenerated =3D false; graphics->data.vnc.websocket =3D -1; - } else if (graphics->data.vnc.websocket) { + } else if (graphics->data.vnc.websocketReserved) { virPortAllocatorRelease(graphics->data.vnc.websocket); } } --=20 2.35.1