From nobody Sun May 19 07:16:15 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