From nobody Sun Feb 8 18:28:31 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=1575933404; cv=none; d=zohomail.com; s=zohoarc; b=hZGG4hg6yrst7YzpQHQroyr/xODGngyHKW7MOIjFO2FAGW1/jQ7oJSMkiXkijzPDeS9aypfZuS1mA5bJHeG7/MZcDh1oiRedb9LVYQsn/aKEBM9jgmq/JhL/6VHY6se/lK+ZDCq2MWKp1nALBDtOeF4Ab0YLx3Ga5kRMUpBl7SU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575933404; 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=3Gd3RjEx7LkaWbZMNE8E0FyFL69zlcqpGs6Q/po+9BY=; b=beEJHdQG9jhx5bn/hV0aEz3onoGa3yZcQZhEaf9HdgSP28VbYwdi4CtqCDNmWXX97vi+8gXKaFtxOprP+1yX1UKG6ZpvHrQC3ISMRKIIlUzuEtJBmP1xCp1o1d4OyPHHGKLoG0swzXBhMULUskJq+ytpkV0izR+EHZ9h/UnuQMc= 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 1575933404157340.41951290989084; Mon, 9 Dec 2019 15:16:44 -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-91-g2G87RXLNWu7RVlR2oanEw-1; Mon, 09 Dec 2019 18:16:41 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B5A0107ACCA; Mon, 9 Dec 2019 23:16:35 +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 D5ECE5D6D2; Mon, 9 Dec 2019 23:16:34 +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 957CE18033C2; Mon, 9 Dec 2019 23:16:34 +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 xB9NGRQ4008691 for ; Mon, 9 Dec 2019 18:16:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 352001006EAC; Mon, 9 Dec 2019 23:16:27 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 303201006B55 for ; Mon, 9 Dec 2019 23:16:27 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D87510163DC for ; Mon, 9 Dec 2019 23:16:27 +0000 (UTC) Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405-y3g6gvTnMza4uOfrJjawGw-1; Mon, 09 Dec 2019 18:16:23 -0500 Received: by mail-qt1-f196.google.com with SMTP id p5so891153qtq.12; Mon, 09 Dec 2019 15:16:23 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 15:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575933403; 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=3Gd3RjEx7LkaWbZMNE8E0FyFL69zlcqpGs6Q/po+9BY=; b=QL6xVCc6YxqABBTATzvnzfa/IeKpsAe5jzmh+lUupwXFTBOngz8qganEAznXKKTLhRjsuw FLgfg84gxaPV4+h5psNhjOHnSJHtVkD0S3MwcrPGx4GlnH7DNmvXUx1Hgn7ldwz/w4ovd6 bU/0lgNomSQAmrhARoDXLJvB3o/oTek= 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=OBfrph7froGvQ3zNUQGAqzThDYSoto6s+nZF5VS34lk=; b=YvjKJ96AOnPriszo/nvkPbo85+DzZfIYauKlXXkqqUZpi0ZcV7xqdoj2r8r7hVocRH hrtGdeb7iqphdUHbQJsKoRuaSxBs7t1jmECCrzC9gZP6A3ZuR/HfEsmO+dwrOCf9ihji AeHQsMVoBAeJlb5ox8ucD+SX5wJTIFKxfWYNMA/UQRvKoAG33o6AWjgB7dToIYxrUz7U HM8kO9nlNjrswfHEE8qby/KjErKGHE8efkLGPYRi1+PxvQjoF+I6f0F0ySzadrRdN+kt 7E7zWm9AwfBg014cbc6Ic3SKsSDEcDV5JAwHZG/78ct3zZO+fiXUyd1Xnz+CYltifW8q z4/Q== X-Gm-Message-State: APjAAAVplFc/r2v63RkaeR+j2TlDGARbo7PFj/fD8f7zoG/Nrv1v7l/c 39a9zZF1cqGdXOWyif6QPeeHs0ccfAg= X-Google-Smtp-Source: APXvYqx3WweXEfMBuM+GkJKlVffO2+Si92ZVN+/2nz6nC2bsFODCYmkspXrnbM+biiNgsJcUSs77qQ== X-Received: by 2002:ac8:6697:: with SMTP id d23mr225124qtp.349.1575933382798; Mon, 09 Dec 2019 15:16:22 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 9 Dec 2019 20:15:30 -0300 Message-Id: <20191209231531.2423222-26-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: y3g6gvTnMza4uOfrJjawGw-1 X-MC-Unique: g2G87RXLNWu7RVlR2oanEw-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 xB9NGRQ4008691 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v1 25/26] qemu: move qemuBuildConsoleCommandLine 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.15 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Console validation is currently being done by qemuBuildConsoleCommandLine(). This patch moves it to a new qemuDomainDefValidateConsole() function. This new function is then called by qemuDomainDefValidate(), validating the console in domain define time. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 15 -------------- src/qemu/qemu_domain.c | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 116ed45a12..d1befdab90 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8784,12 +8784,6 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logMana= ger, =20 switch (console->targetType) { case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPCONSOLE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("sclpconsole is not supported in this QEM= U binary")); - return -1; - } - if (!(devstr =3D qemuBuildChrChardevStr(logManager, secManager, cmd, cfg, def, console->source, @@ -8805,12 +8799,6 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logMana= ger, break; =20 case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPLMCONSOLE))= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("sclplmconsole is not supported in this Q= EMU binary")); - return -1; - } - if (!(devstr =3D qemuBuildChrChardevStr(logManager, secManager, cmd, cfg, def, console->source, @@ -8844,9 +8832,6 @@ qemuBuildConsoleCommandLine(virLogManagerPtr logManag= er, break; =20 default: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported console target type %s"), - NULLSTR(virDomainChrConsoleTargetTypeToString(c= onsole->targetType))); return -1; } } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e4b70174ab..3dba074c5c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5474,6 +5474,48 @@ qemuDomainDefValidateBoot(const virDomainDef *def, return 0; } =20 +static int +qemuDomainDefValidateConsole(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + size_t i; + + /* Explicit console devices */ + for (i =3D 0; i < def->nconsoles; i++) { + virDomainChrDefPtr console =3D def->consoles[i]; + + switch (console->targetType) { + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLP: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPCONSOLE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("sclpconsole is not supported in this QEM= U binary")); + return -1; + } + break; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SCLPLM: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCLPLMCONSOLE))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("sclplmconsole is not supported in this Q= EMU binary")); + return -1; + } + break; + + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO: + case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL: + break; + + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported console target type %s"), + NULLSTR(virDomainChrConsoleTargetTypeToString(c= onsole->targetType))); + return -1; + } + } + + return 0; +} + =20 static int qemuDomainDefValidate(const virDomainDef *def, @@ -5650,6 +5692,9 @@ qemuDomainDefValidate(const virDomainDef *def, if (qemuDomainDefValidateNuma(def, qemuCaps) < 0) goto cleanup; =20 + if (qemuDomainDefValidateConsole(def, qemuCaps) < 0) + goto cleanup; + if (cfg->vncTLS && cfg->vncTLSx509secretUUID && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_TLS_CREDS_X509)) { for (i =3D 0; i < def->ngraphics; i++) { --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list