From nobody Thu May 9 12:37:56 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=1653571393; cv=none; d=zohomail.com; s=zohoarc; b=T0EX5+pjK+OoJPMWmehVnrf+qiNuoSzOSTwqnbwqiIcYoXjVJnClJrmJ05RCZfXHyAPl3KJNwQ5XnVOPRn8KVSVW6JzxjRZ9pnbk9HVurUZ9ypwaDkbXZV85LxlBSr30DnAv7XoGAr9CdW1KHxIT4z5YZRT79vK813sz9wspMog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653571393; 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=8r7moWpcnj8Uwpj40HqqaoDdS2CfPF1d4cgCkQCG8MA=; b=ZeKND/EypSYChrnTco/eibOurPmFkDsno9NcUmnGsbRvQLbNsqfVMyg6jgb4lAOAs6ABqmQldZWvm8pB49qxIP+yuojin6f/xRh1Dc9C9kGXfWCLYAtRXQEwrD6nvrUHGX3oQ6dQHttSVqVtqhGD5ROHOQMojNQV68f8UfdEx+0= 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 165357139379646.15711632567252; Thu, 26 May 2022 06:23:13 -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-377-yEehE8xpMnyGCCZRtAOx5w-1; Thu, 26 May 2022 09:23:09 -0400 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 A160410726B5; Thu, 26 May 2022 13:23:02 +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 3A130112131B; Thu, 26 May 2022 13:23:02 +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 0BEE5193212B; Thu, 26 May 2022 13:23:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D272B194EB8B for ; Thu, 26 May 2022 13:23:00 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B7001112131B; Thu, 26 May 2022 13:23:00 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E2531121315 for ; Thu, 26 May 2022 13:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653571392; 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=8r7moWpcnj8Uwpj40HqqaoDdS2CfPF1d4cgCkQCG8MA=; b=BhK3UBIVygX1Qg7sL/tWBkBrzggDbPwBhoj5YINvcStJoPY9g5ZBxpQ2aUVLN/Gj5jjgTr 4QtNwkDsOA0UWuuf69l0MznJ743XRX2A9jFzJIHCw/GND1l7gM/oakNjMMqYMflEYu1qaG 6LDFPbrNWwUSWJvcPf88VTA6Oq/5FTk= X-MC-Unique: yEehE8xpMnyGCCZRtAOx5w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] virDomainInputDefValidate: Reformat Date: Thu, 26 May 2022 15:22:57 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.78 on 10.11.54.3 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1653571395409100001 Content-Type: text/plain; charset="utf-8"; x-default="true" There are some formatting problems with virDomainInputDefValidate(). Reformat it to our standards. Use this opportunity to move error messages onto a single line. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/conf/domain_validate.c | 65 ++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 627c366fe9..1feb7a8f9c 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2254,8 +2254,7 @@ virDomainInputDefValidate(const virDomainInputDef *in= put, def->virtType =3D=3D VIR_DOMAIN_VIRT_PARALLELS) { if (input->bus !=3D VIR_DOMAIN_INPUT_BUS_PARALLELS) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("parallels containers don't support " - "input bus %s"), + _("parallels containers don't support input= bus %s"), virDomainInputBusTypeToString(input->bus)); return -1; } @@ -2263,52 +2262,48 @@ virDomainInputDefValidate(const virDomainInputDef *= input, if (input->type !=3D VIR_DOMAIN_INPUT_TYPE_MOUSE && input->type !=3D VIR_DOMAIN_INPUT_TYPE_KBD) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("parallels bus does not support " - "%s input device"), + _("parallels bus does not support %s input = device"), virDomainInputTypeToString(input->type)); return -1; } } else { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Input devices are not supported by this " - "virtualization driver.")); + _("Input devices are not supported by this virt= ualization driver.")); return -1; } } =20 switch ((virDomainInputType) input->type) { - case VIR_DOMAIN_INPUT_TYPE_MOUSE: - case VIR_DOMAIN_INPUT_TYPE_TABLET: - case VIR_DOMAIN_INPUT_TYPE_KBD: - if (input->source.evdev) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("setting source evdev path only supporte= d for " - "passthrough input devices")); - return -1; - } - break; - - case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: - if (input->bus !=3D VIR_DOMAIN_INPUT_BUS_VIRTIO) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("only bus 'virtio' is supported for 'pass= through' " - "input devices")); - return -1; - } - break; + case VIR_DOMAIN_INPUT_TYPE_MOUSE: + case VIR_DOMAIN_INPUT_TYPE_TABLET: + case VIR_DOMAIN_INPUT_TYPE_KBD: + if (input->source.evdev) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("setting source evdev path only supported for= passthrough input devices")); + return -1; + } + break; =20 - case VIR_DOMAIN_INPUT_TYPE_EVDEV: - if (input->bus !=3D VIR_DOMAIN_INPUT_BUS_NONE) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("input evdev doesn't support bus element"= )); - return -1; - } - break; + case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: + if (input->bus !=3D VIR_DOMAIN_INPUT_BUS_VIRTIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("only bus 'virtio' is supported for 'passthro= ugh' input devices")); + return -1; + } + break; =20 - case VIR_DOMAIN_INPUT_TYPE_LAST: - default: - virReportEnumRangeError(virDomainInputType, input->type); + case VIR_DOMAIN_INPUT_TYPE_EVDEV: + if (input->bus !=3D VIR_DOMAIN_INPUT_BUS_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("input evdev doesn't support bus element")); return -1; + } + break; + + case VIR_DOMAIN_INPUT_TYPE_LAST: + default: + virReportEnumRangeError(virDomainInputType, input->type); + return -1; } =20 return 0; --=20 2.35.1 From nobody Thu May 9 12:37:56 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=1653571395; cv=none; d=zohomail.com; s=zohoarc; b=ZJs/yMw8OGhoF94ootN0YVLowqVkfyqiq7Db+QoL3+DqIGW9hcnPy5xDK1DmvEC9iJmut69QRCs+uN/JF4s77VgvD+9EdfeleBdPhus2ireMS/m/7PqUmWdieKCmh7poDZIZT0azwG3V/rYwgvEg0ZkuMLRmjokBsIkIeGRK4RE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653571395; 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=r8gxUWYFdNm3n2SykhTnQO4DH9LZ3tWecm82Ycon5Cg=; b=juVrGGzRqHMP80zGflM2TxpVi3B3O2XAp9cVJZeaQPfV7bDHqHmZs11cL3/YkMW5nBSkFs8UCcJ1opRGSP3K8UxQd7kDmxCSL0VroOgom+DuiBrcszj9BdqTFEPpxrzMqSE59He+MC2AmJkWNdgDbiTtseJ7AK9/gF8xgEtHHXQ= 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 165357139584493.62159265551213; Thu, 26 May 2022 06:23:15 -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-465-D4ZCtxH7MCWvz46_l7Ixtg-1; Thu, 26 May 2022 09:23:12 -0400 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 241C4100BABF; Thu, 26 May 2022 13:23:07 +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 C77FA2026D07; Thu, 26 May 2022 13:23:06 +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 98FAF193212B; Thu, 26 May 2022 13:23:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6D2681932102 for ; Thu, 26 May 2022 13:23:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 53C461121315; Thu, 26 May 2022 13:23:01 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id EFF8F112131B for ; Thu, 26 May 2022 13:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653571394; 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=r8gxUWYFdNm3n2SykhTnQO4DH9LZ3tWecm82Ycon5Cg=; b=D2JlXRGbH1Iyva1X3XLRVXaruubcNHAQI1MSp4FIiJM6Xx275XvjzKuxkhdjTizPUdfgTO nWJVhq/gxyM2BJQUF9WnTDgGk/g2RP4Bae0sFavn5IDa6J+kJ2ciT8Cx/G2YEoDC7Sux2T p4kGWzJUEXl6v87N6VlyRWGeEMfup28= X-MC-Unique: D4ZCtxH7MCWvz46_l7Ixtg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] virDomainInputDefValidate: Validate model Date: Thu, 26 May 2022 15:22:58 +0200 Message-Id: <814ae91c777e9ba6d2d9db3c95baf99eab944e05.1653571362.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.78 on 10.11.54.4 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1653571397213100003 Content-Type: text/plain; charset="utf-8"; x-default="true" If input device has one of virtio* models set then it has to go onto virtio bus. Introduce such check into the validator. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2081981 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/conf/domain_validate.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 1feb7a8f9c..f3910f08a4 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2306,6 +2306,27 @@ virDomainInputDefValidate(const virDomainInputDef *i= nput, return -1; } =20 + switch ((virDomainInputModel)input->model) { + case VIR_DOMAIN_INPUT_MODEL_VIRTIO: + case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL: + case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL: + if (input->bus !=3D VIR_DOMAIN_INPUT_BUS_VIRTIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("only bus 'virtio' is supported for input mod= el '%s'"), + virDomainInputModelTypeToString(input->model)); + return -1; + } + break; + + case VIR_DOMAIN_INPUT_MODEL_DEFAULT: + break; + + case VIR_DOMAIN_INPUT_MODEL_LAST: + default: + virReportEnumRangeError(virDomainInputModel, input->model); + return -1; + } + return 0; } =20 --=20 2.35.1