From nobody Sun May 19 03:54:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1674466326; cv=none; d=zohomail.com; s=zohoarc; b=boQ2R8J5Op2IWvnLKE7XFEwaE+40wTf5PqjvOCFcxuxtjdxV6R6xey659H3zxPo9gWUwOwb6xkD6z0ifV+JbFSIGmgnW9JnCKhEx927migHI8JnDukZZN6yaEFn/W+6d2/88mxflsUn0UrPnKg+dsXUIAjEkaHRzLuc2LNr7hSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466326; 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=C0ktpnlsU7JrXL7tPueZcvk4oMl4x/LPwWpozyuPFNk=; b=oHdAa+ICW7qsF1MTh8c826dDBEq457WbwEf+ZtiOHDGuhjgXRKN/cO0ExXGaZ3366zFZuk3vuL+o+P2PxzO7crdDJNVWv1rSo49WGxWFd9xJNhZk3noHWNqbVNmQotYkM+Ao4Ir31jXJkvnDm/4aLMsErqEFypqa6h0TaW5hrNc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 167446632661264.65022384463532; Mon, 23 Jan 2023 01:32:06 -0800 (PST) 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-471-0a9kiqJJP1CzGmlRfJfU5g-1; Mon, 23 Jan 2023 04:32:00 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2ADB882822; Mon, 23 Jan 2023 09:31:57 +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 A03212026FFF; Mon, 23 Jan 2023 09:31:57 +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 7E187194658D; Mon, 23 Jan 2023 09:31:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 656461946589 for ; Mon, 23 Jan 2023 09:31:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 594BA40C2005; Mon, 23 Jan 2023 09:31:55 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0137240C2004 for ; Mon, 23 Jan 2023 09:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466325; 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=C0ktpnlsU7JrXL7tPueZcvk4oMl4x/LPwWpozyuPFNk=; b=hTut2ucys4nnQ3oon2ZSkTdkbIrABmYLpxaeTNOc/bIQ/JWAau4PMuGp6smmhVvQjC4qBL Vw5gRfxM5ei+ONshl70XfXFCJPQfBjB2OOHilSc32Tzm8KI5IuKAS3wFraOZXhYr/8F3P/ 6rU9IkpD05RLV04mAxF4RscNFL6r9Jg= X-MC-Unique: 0a9kiqJJP1CzGmlRfJfU5g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] vbox: Fix memleak in _virtualboxCreateMachine() Date: Mon, 23 Jan 2023 10:31:52 +0100 Message-Id: <499253d3e7c8d2bb882e87b63a47d34e64e1c938.1674466269.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466328079100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The _virtualboxCreateMachine() function allocates @createFlagsUtf16 but never frees it. =3D=3D12481=3D=3D 236 bytes in 2 blocks are definitely lost in loss record = 2,060 of 2,216 =3D=3D12481=3D=3D at 0x48407E5: malloc (vg_replace_malloc.c:393) =3D=3D12481=3D=3D by 0xB6C6D1B: RTStrToUtf16Tag (utf-8.cpp:1033) =3D=3D12481=3D=3D by 0xB4DB500: _virtualboxCreateMachine (vbox_tmpl.c:63= 4) =3D=3D12481=3D=3D by 0xB4E68A3: vboxDomainDefineXMLFlags (vbox_common.c:= 1976) =3D=3D12481=3D=3D by 0x4C7DF83: virDomainDefineXMLFlags (libvirt-domain.= c:6666) =3D=3D12481=3D=3D by 0x13C2DA: remoteDispatchDomainDefineXMLFlags (remot= e_daemon_dispatch_stubs.h:5271) =3D=3D12481=3D=3D by 0x13C265: remoteDispatchDomainDefineXMLFlagsHelper = (remote_daemon_dispatch_stubs.h:5252) =3D=3D12481=3D=3D by 0x4AD9DF7: virNetServerProgramDispatchCall (virnets= erverprogram.c:428) =3D=3D12481=3D=3D by 0x4AD9931: virNetServerProgramDispatch (virnetserve= rprogram.c:302) =3D=3D12481=3D=3D by 0x4AE28AC: virNetServerProcessMsg (virnetserver.c:1= 35) =3D=3D12481=3D=3D by 0x4AE2972: virNetServerHandleJob (virnetserver.c:15= 5) =3D=3D12481=3D=3D by 0x49BC275: virThreadPoolWorker (virthreadpool.c:164) Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/vbox/vbox_tmpl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 52b1c93b6d..91609741e3 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -626,6 +626,7 @@ _virtualboxCreateMachine(struct _vboxDriver *data, virD= omainDef *def, IMachine * machine); VIR_FREE(createFlags); VBOX_UTF16_FREE(machineNameUtf16); + VBOX_UTF16_FREE(createFlagsUtf16); vboxIIDUnalloc(&iid); return rc; } --=20 2.39.1 From nobody Sun May 19 03:54:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1674466327; cv=none; d=zohomail.com; s=zohoarc; b=lRZTb7A09Uif+LvV2G33cu9uTkrgXclpOahvySqZwNVx5MJpjSd2ec4r4Xsl6wfuiPTcBZ4n6j/wJ5Syr0/Rb4iq38YUC05e6qwEhHA5IhI2L9jgS6zhPHsRGbgMcp6HMEOsJaI2LLEkPBJKOs2s4qQ3s/7l4izso884+jHbxc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674466327; 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=SqzQhUE+KuKC5V6ki1+iFKxGLv3rlTlb48zvqJRyPwo=; b=AFm2YB4e8LAx+gRBTDUB/kK6OLUvJemf7pxeDkmJxJx7KHmEtSo+O365rz5fZg7e0zZSEUMo9j9Ml0lzxljOpbhF8o2PTowwHjzbXesBoMTWn0gmmN/cokJgG83KBGFyOE+4EVy9ocDdJBYdSIr2GOLYrRB75/GVAMaBTqXTfzg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674466327831668.083724667591; Mon, 23 Jan 2023 01:32:07 -0800 (PST) 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-75-vMMgNlXAM_OBQZGYrD9nlQ-1; Mon, 23 Jan 2023 04:32:01 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71788858F09; Mon, 23 Jan 2023 09:31:58 +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 5CB661121330; Mon, 23 Jan 2023 09:31:58 +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 3FDDC194658D; Mon, 23 Jan 2023 09:31:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 046041946589 for ; Mon, 23 Jan 2023 09:31:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E99B640C2005; Mon, 23 Jan 2023 09:31:55 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90E8040C2004 for ; Mon, 23 Jan 2023 09:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674466326; 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=SqzQhUE+KuKC5V6ki1+iFKxGLv3rlTlb48zvqJRyPwo=; b=Dg80eHtSWyOovH7X1br92AVpcCiwjF2saUWSUvfnWWStrqogirnGPHO9kEv+eF+2y+uTcR IxgdRUw+mk3JD58NK7pqRHkNBLsg5Ds5mAOo6vqm6ZiwCrbZFOIYrkrqFxRsmCIMSxBx3R B0D8K+oYC0YTIiNXP+zw2Zd3ANewLdo= X-MC-Unique: vMMgNlXAM_OBQZGYrD9nlQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] vbox: Fix starting domains Date: Mon, 23 Jan 2023 10:31:53 +0100 Message-Id: <3e6b43adc3c2a3ad2af4eb851682330039679758.1674466269.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674466328084100004 Content-Type: text/plain; charset="utf-8"; x-default="true" When starting a VirtualBox domain, we try to guess which frontend to use. While the whole algorithm looks a bit outdated, it may happen that we tell VirtualBox to use "gui" frontend, but not which DISPLAY=3D to use. I haven't found any documentation on the algorithm we use, but if I make us fallback onto DISPLAY=3D:0 when no other configuration is found then I'm able to start my guests just fine. Signed-off-by: Michal Privoznik --- src/vbox/vbox_common.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index bd77641d39..5269f9b23f 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -2121,13 +2121,12 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IM= achine *machine, vboxIID *iid VBOX_UTF8_FREE(valueDisplayUtf8); =20 if (guiPresent) { - if (guiDisplay) { - char *displayutf8; - displayutf8 =3D g_strdup_printf("DISPLAY=3D%s", guiDisplay); - VBOX_UTF8_TO_UTF16(displayutf8, &env); - VIR_FREE(displayutf8); - VIR_FREE(guiDisplay); - } + char *displayutf8; + + displayutf8 =3D g_strdup_printf("DISPLAY=3D%s", guiDisplay ? guiDi= splay : ":0"); + VBOX_UTF8_TO_UTF16(displayutf8, &env); + VIR_FREE(displayutf8); + VIR_FREE(guiDisplay); =20 VBOX_UTF8_TO_UTF16("gui", &sessionType); } --=20 2.39.1 From nobody Sun May 19 03:54:43 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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=1674482481; cv=none; d=zohomail.com; s=zohoarc; b=AxoE66MX+De/gg2ctOp127g3O0UnJQ4+PABlt+v4BfkZolQ6L/po40dym2tfcMF5dhVmasaj6IqDAjspfhzvV+a8zB9IypZ+zhr1Ym+0S8R/iCxcBsKagLBQFa43Tl/zcAN1iPzJihUYylDcMoB6bP2zeCc5TSwlDnmIcQMYex8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674482481; 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=F28s2k3WI5b1KS1lxSujVpuivVULKH1UH7Lq8IJNTLo=; b=iuoUbVLE3ONrVtb0IvLZKZjJQMfn85EtOkPSag6und1rGUSVqpwMAgQsCUK2J+NQjTsZjlUjM7qYSyyzPk8U9xJkckm0zn+Hfez4Ri5TAvIbjTdo7hupWtTzG1BbG3WC9EgHq36W0mrcORZoOXkr5eMJKHTuPHSVu5iBpACP4yk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1674482481030986.9171225677338; Mon, 23 Jan 2023 06:01:21 -0800 (PST) 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-124-gFuT3oOcP8Oiytay3aDDRQ-1; Mon, 23 Jan 2023 09:01:11 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25E671C00431; Mon, 23 Jan 2023 14:01:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 796E740C2004; Mon, 23 Jan 2023 14:01:03 +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 44F43194658C; Mon, 23 Jan 2023 14:01:03 +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 9EBCD1946589 for ; Mon, 23 Jan 2023 14:01:02 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8117B492B03; Mon, 23 Jan 2023 14:01:02 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 282F1492B02 for ; Mon, 23 Jan 2023 14:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674482479; 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=F28s2k3WI5b1KS1lxSujVpuivVULKH1UH7Lq8IJNTLo=; b=RIvA5A1f0KkElfJZ0TagIgaMI+UoVgZoLOO+BQXvcGxAQWD1l5s3I2D8c6szH/QFHWlaPI BC5YpxbxDeLdvo0ttzpF7WO1hcx4HwZousq8N19XdAWjVPtbLo/J0qdL7Np6/p7n+D5LEV /54FS1+geCSICHNx/6jkjMQfCWEXNJs= X-MC-Unique: gFuT3oOcP8Oiytay3aDDRQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2] vbox: Fix starting domains Date: Mon, 23 Jan 2023 14:59:28 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 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 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674482487174100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When starting a VirtualBox domain, we try to guess which frontend to use. While the whole algorithm looks a bit outdated, it may happen that we tell VirtualBox to use "gui" frontend, but not which DISPLAY=3D to use. I haven't found any documentation on the algorithm we use, but if I make us fallback onto DISPLAY=3D:0 when no other configuration is found then I'm able to start my guests just fine. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- I've experimented with introducing an enum for frontend since it can be one of gui, sdl, vrdp. But it turned out to be a huge mess and not worth the fix I'm trying to get in. If anybody else wants to do it, please. src/vbox/vbox_common.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index bd77641d39..30a85ce8b2 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -2120,32 +2120,33 @@ vboxStartMachine(virDomainPtr dom, int maxDomID, IM= achine *machine, vboxIID *iid } VBOX_UTF8_FREE(valueDisplayUtf8); =20 - if (guiPresent) { - if (guiDisplay) { - char *displayutf8; - displayutf8 =3D g_strdup_printf("DISPLAY=3D%s", guiDisplay); - VBOX_UTF8_TO_UTF16(displayutf8, &env); - VIR_FREE(displayutf8); - VIR_FREE(guiDisplay); - } + if (guiPresent || sdlPresent) { + const char *display =3D NULL; + const char *sessType =3D NULL; + char *displayutf8; =20 - VBOX_UTF8_TO_UTF16("gui", &sessionType); - } + if (guiPresent) { + sessType =3D "gui"; + display =3D guiDisplay; + } else { + sessType =3D "sdl"; + display =3D sdlDisplay; + } =20 - if (sdlPresent) { - if (sdlDisplay) { - char *displayutf8; - displayutf8 =3D g_strdup_printf("DISPLAY=3D%s", sdlDisplay); - VBOX_UTF8_TO_UTF16(displayutf8, &env); - VIR_FREE(displayutf8); - VIR_FREE(sdlDisplay); + if (!display) { + /* Provide some sane default */ + display =3D ":0"; } =20 - VBOX_UTF8_TO_UTF16("sdl", &sessionType); - } + displayutf8 =3D g_strdup_printf("DISPLAY=3D%s", display); + VBOX_UTF8_TO_UTF16(displayutf8, &env); + VIR_FREE(displayutf8); + VIR_FREE(guiDisplay); =20 - if (vrdpPresent) + VBOX_UTF8_TO_UTF16(sessType, &sessionType); + } else if (vrdpPresent) { VBOX_UTF8_TO_UTF16("vrdp", &sessionType); + } =20 rc =3D gVBoxAPI.UIMachine.LaunchVMProcess(data, machine, iid, sessionType, env, --=20 2.39.1