From nobody Sun Feb 8 14:53:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1575933397; cv=none; d=zohomail.com; s=zohoarc; b=Cx0djEiqcCzEI8ggA0tagMH2p/Vz6ITK4mNiE0TGR4Kb2CQ3YTBdY2ABGq/Me0pUQ9eVgw/MqEWpDKlTfQBO+PMhm0tStBg5TMi0vdKzmdwfm+tVc1d2wSxOwABSPDc/q4apUgWSZweKd4Fwj4lXz+EcpzJq5Q+Ns/V4C3pPgMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575933397; h=Content-Type:Content-Transfer-Encoding:Cc: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=5U4H0cGe+RYEh1mJV0tKff5HUYkYn95tpzvR5J+gbEA=; b=WhgSHUwfzJUt6dKCKmQqHtypfb5zRIUMVQeJbSS/KbZhD4VPGnGMn+CH7VWL156GBaPnPhZ6G5TpZMWk4DCu/VA8ygxeOjFCuSg/CdjbCzT09q5k2EOnQVYidN6bkl6+mcrwGTbE4gdugaA86uP+ZXU15NzurjlsKzAm2Rgyxq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1575933397882318.59769111729577; Mon, 9 Dec 2019 15:16:37 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-uPyVD0roNMG3NtMZpuFmng-1; Mon, 09 Dec 2019 18:16:35 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1C8B1005512; Mon, 9 Dec 2019 23:16:27 +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 A07F26E3FD; Mon, 9 Dec 2019 23:16:27 +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 5BAA818034FC; Mon, 9 Dec 2019 23:16:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB9NGDQY008494 for ; Mon, 9 Dec 2019 18:16:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7EFD71006B55; Mon, 9 Dec 2019 23:16:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79E931006EB8 for ; Mon, 9 Dec 2019 23:16:11 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4EF47900181 for ; Mon, 9 Dec 2019 23:16:11 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-341-TfLhUWtYNTae18zo6ZDE4g-1; Mon, 09 Dec 2019 18:16:08 -0500 Received: by mail-qk1-f193.google.com with SMTP id c17so4846546qkg.7; Mon, 09 Dec 2019 15:16:07 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:fe5:8243:c780:f073:3beb]) by smtp.gmail.com with ESMTPSA id e130sm352436qkb.72.2019.12.09.15.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 15:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575933396; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=5U4H0cGe+RYEh1mJV0tKff5HUYkYn95tpzvR5J+gbEA=; b=MHuaHXxgeaRt83Bsnyv9dGaD7HU1GC2AdcOc2OwZpTTpfNxM4nwacOdthSOPgTwLb5N33i z7v+T+qegxivsT7YM66EcWavrc3ZZR4Rgmqt31p32KuSUV27c2ujkAoWcFwdEWGMQk5p5/ leXrpcouvKCNn6zjV4gSlzM/7iFdV6U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CWPA7GgIwiL9hq7+dwnZgnbaT/md5EJfKGvPoDvftcE=; b=tSD4euMwtPM/7+htablGToGrmzxgm5VWTULygiaZb44+mx9aKKK9HTbMUxNdxd4+mj vl6vYwm1vQjczze9RGhrT/O07DRZe9ESNgj5PJJm5irLlT/4m2fN4C9Jsw6JuAJzFUv5 xtbzz8YGsF1RHm8dutp1mIISIEj+qRKtJbp22E6mezlTBSkRw7ztqRZgcfoTp0j2pOvU bXdGB/s3+jdnGRuTdr4GnrFFIpzhsbGkTyZDI4Qu07iG6ib9TQ92G62i0QFufyHTQL/f wJ/LWKZbo1yM3Ldb/pIw4UELC/4XPv7CfLgJsJKuYcrxZ9ds6nHFhVwxGSxCQI4ByKsJ 2YxA== X-Gm-Message-State: APjAAAXtu3vVGzvbYlNoca9+v6Jn347R6agR/KykXvc+6hAXmcFG0Mqi nUj9INwv7kcNzW3w9xzu16EGNRxfNc4= X-Google-Smtp-Source: APXvYqzwhY5m0QThK9WicP1mzrXa01EohOvYZgvDv4tuFsyYz5p6OqFw+Ikamhs6jxTTQV2ZAAq92Q== X-Received: by 2002:a37:a642:: with SMTP id p63mr30782592qke.85.1575933366824; Mon, 09 Dec 2019 15:16:06 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 9 Dec 2019 20:15:20 -0300 Message-Id: <20191209231531.2423222-16-danielhb413@gmail.com> In-Reply-To: <20191209231531.2423222-1-danielhb413@gmail.com> References: <20191209231531.2423222-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: TfLhUWtYNTae18zo6ZDE4g-1 X-MC-Unique: uPyVD0roNMG3NtMZpuFmng-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xB9NGDQY008494 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v1 15/26] qemu: move qemuBuildSgaCommandLine validation to qemu_domain.c 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move QEMU caps validation of qemuBuildSgaCommandLine() to qemuDomainDefValidate(), allowing validation at domain define time. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 18 +++--------------- src/qemu/qemu_domain.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1bbd69b891..fe5333efdf 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6025,23 +6025,11 @@ qemuBuildVMGenIDCommandLine(virCommandPtr cmd, =20 static int qemuBuildSgaCommandLine(virCommandPtr cmd, - const virDomainDef *def, - virQEMUCapsPtr qemuCaps) + const virDomainDef *def) { /* Serial graphics adapter */ - if (def->os.bios.useserial =3D=3D VIR_TRISTATE_BOOL_YES) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("qemu does not support SGA")); - return -1; - } - if (!def->nserials) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("need at least one serial port to use SGA")); - return -1; - } + if (def->os.bios.useserial =3D=3D VIR_TRISTATE_BOOL_YES) virCommandAddArgList(cmd, "-device", "sga", NULL); - } =20 return 0; } @@ -10039,7 +10027,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, virCommandAddArg(cmd, "-no-user-config"); virCommandAddArg(cmd, "-nodefaults"); =20 - if (qemuBuildSgaCommandLine(cmd, def, qemuCaps) < 0) + if (qemuBuildSgaCommandLine(cmd, def) < 0) return NULL; =20 if (qemuBuildMonitorCommandLine(logManager, secManager, cmd, cfg, def,= priv) < 0) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e3ffa4978b..94bb4e4fca 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5398,6 +5398,20 @@ qemuDomainDefValidate(const virDomainDef *def, goto cleanup; } =20 + /* Serial graphics adapter */ + if (def->os.bios.useserial =3D=3D VIR_TRISTATE_BOOL_YES) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SGA)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("qemu does not support SGA")); + goto cleanup; + } + if (!def->nserials) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("need at least one serial port to use SGA")); + goto cleanup; + } + } + /* QEMU 2.7 (detected via the availability of query-hotpluggable-cpus) * enforces stricter rules than previous versions when it comes to gue= st * CPU topology. Verify known constraints are respected */ --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list