From nobody Sat Feb 7 10:50:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1607710289; cv=none; d=zohomail.com; s=zohoarc; b=OGBYDcrhuGTqXmp5klwaIYwJdUyEVbho5PDvJH5PL1F0yyeHX+m4MOcYA/kHCGaEPi7s98NFBZbH67houGHtpzTfHs7OwAN0YInlTxgsxU42zsfnwgPOu9MrtWh2zx6hfwa9snEgtb7Hw7VK+H5XxQFgj6G8AtULDafqP3pz4Yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607710289; 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=18T8v7sDJT/2qFD2NZHbghXA7Wbn1m0jRjXt3DImv3g=; b=hVgyy4HUWKdMDCEeSQlupfn7tGzAxaZrV/V96/+IIO6XMzamsy5Igzz3Q0HPJNCIi2IDoq/FwVJYqRrHsI+o7ta1BNQRQfvaOVwRV/zakTRS01gZa86m5Zf3U+SE9hI4dhQh4mRprS0CZY3t/YkLu6ZxAwQKL53oCYSi8+PNi7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607710289566759.6036796434637; Fri, 11 Dec 2020 10:11:29 -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-139-TJTygpl9NEW3a9pbsy78rw-1; Fri, 11 Dec 2020 13:06:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5A641074650; Fri, 11 Dec 2020 18:05:59 +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 A530660C15; Fri, 11 Dec 2020 18:05:59 +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 6E2C31809CAC; Fri, 11 Dec 2020 18:05:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBI5uL7027647 for ; Fri, 11 Dec 2020 13:05:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 131F9B6B5E; Fri, 11 Dec 2020 18:05:56 +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 0BD02EB323 for ; Fri, 11 Dec 2020 18:05:55 +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 51E9985828B for ; Fri, 11 Dec 2020 18:05:55 +0000 (UTC) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-37-wHNXyp5JPFWQWuQNa6526Q-1; Fri, 11 Dec 2020 13:05:53 -0500 Received: by mail-qt1-f179.google.com with SMTP id z20so7084558qtq.3 for ; Fri, 11 Dec 2020 10:05:52 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:9e32:a7fb:6602:e8c2:3c0f]) by smtp.gmail.com with ESMTPSA id y6sm7585703qkj.60.2020.12.11.10.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Dec 2020 10:05:51 -0800 (PST) X-MC-Unique: TJTygpl9NEW3a9pbsy78rw-1 X-MC-Unique: wHNXyp5JPFWQWuQNa6526Q-1 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=18T8v7sDJT/2qFD2NZHbghXA7Wbn1m0jRjXt3DImv3g=; b=h8GDJLroUBHtDJa2cHHrWyPj3i546ARVeaFYvAwB2p/k3jIQ8ybD4NVTAipp1mH0Ii 87EcQignrDvmh4CEO9Og2WVByZbmiOeQheSlb4Jn0XG+L+JvRmEV+5gqSZ/UUUw2Q2iR SWSeWv5sR87P9ZubtHJz8VhRrH+agCBSsstpVmNjB5vMQcNDFaNfJm48z5JwgfL5WfnU WsT1jgsoLVbL1X9w2q3svuRbc5aORYrtNwipxxygXQSiUoTe0xOK5JMGgp+2VB/KIZr2 YiDxTg4u57SpWc+fLHvJagZZbVmbpVBlht7L+oPIwuac1r808FSf4/ViVVcmDEU+3vOF 2L+w== X-Gm-Message-State: AOAM530DvblBLH4XdD8BFxLjmEqdAP79jDtDQqDStYG8QJr24GNfts39 avqX0S/FK2eYWTiwH+97KFU1N3HiSj1Hpw== X-Google-Smtp-Source: ABdhPJyiyHRBZAThvYxD4Cd9L3a2W7BbRM1iVqJTCjBuNI5Y2QjNZQHCidTHZjL1Tyg33JrHWzN/3Q== X-Received: by 2002:ac8:6d05:: with SMTP id o5mr17855155qtt.6.1607709952329; Fri, 11 Dec 2020 10:05:52 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 12/12] domain_validate.c: use VIR_ERR_CONFIG_UNSUPPORTED in validate functions Date: Fri, 11 Dec 2020 15:05:16 -0300 Message-Id: <20201211180516.1952683-13-danielhb413@gmail.com> In-Reply-To: <20201211180516.1952683-1-danielhb413@gmail.com> References: <20201211180516.1952683-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.12 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 Content-Type: text/plain; charset="utf-8" Some functions in domain_validate.c are throwing VIR_ERR_XML_ERROR, when in reality none of these errors are exclusive to XML parsing. Change to VIR_ERR_CONFIG_UNSUPPORTED to be more adequate. Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_validate.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 4cc1d11647..4ae9f1e1b2 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -291,7 +291,7 @@ virDomainDiskDefValidate(const virDomainDef *def, if (disk->src->type =3D=3D VIR_STORAGE_TYPE_NVME) { /* NVMe namespaces start from 1 */ if (disk->src->nvme->namespc =3D=3D 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("NVMe namespace can't be zero")); return -1; } @@ -423,7 +423,7 @@ virDomainChrSourceDefValidate(const virDomainChrSourceD= ef *src_def, =20 case VIR_DOMAIN_CHR_TYPE_SPICEPORT: if (!src_def->data.spiceport.channel) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Missing source channel attribute for char de= vice")); return -1; } @@ -547,7 +547,7 @@ virDomainControllerDefValidate(const virDomainControlle= rDef *controller) if (opts->targetIndex !=3D -1) { =20 if (opts->targetIndex < 0 || opts->targetIndex > 30) { - virReportError(VIR_ERR_XML_ERROR, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller target index '%d' out of " "range - must be 0-30"), opts->targetIndex); @@ -556,7 +556,7 @@ virDomainControllerDefValidate(const virDomainControlle= rDef *controller) =20 if ((controller->idx =3D=3D 0 && opts->targetIndex !=3D 0) || (controller->idx !=3D 0 && opts->targetIndex =3D=3D 0)) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Only the PCI controller with index 0 can= " "have target index 0, and vice versa")); return -1; @@ -797,7 +797,7 @@ virDomainDeviceDefValidateAliasesIterator(virDomainDefP= tr def, } =20 if (virHashLookup(data->aliases, alias)) { - virReportError(VIR_ERR_XML_ERROR, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("non unique alias detected: %s"), alias); return -1; @@ -864,7 +864,7 @@ virDomainDeviceValidateAliasImpl(const virDomainDef *de= f, goto cleanup; =20 if (virHashLookup(aliases, info->alias)) { - virReportError(VIR_ERR_XML_ERROR, + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("non unique alias detected: %s"), info->alias); goto cleanup; @@ -1050,7 +1050,7 @@ virDomainDefIOMMUValidate(const virDomainDef *def) =20 if (def->iommu->intremap =3D=3D VIR_TRISTATE_SWITCH_ON && def->features[VIR_DOMAIN_FEATURE_IOAPIC] !=3D VIR_DOMAIN_IOAPIC_QE= MU) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("IOMMU interrupt remapping requires split I/O API= C " "(ioapic driver=3D'qemu')")); return -1; @@ -1058,7 +1058,7 @@ virDomainDefIOMMUValidate(const virDomainDef *def) =20 if (def->iommu->eim =3D=3D VIR_TRISTATE_SWITCH_ON && def->iommu->intremap !=3D VIR_TRISTATE_SWITCH_ON) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("IOMMU eim requires interrupt remapping to be ena= bled")); return -1; } @@ -1352,7 +1352,7 @@ virDomainHostdevDefValidate(const virDomainHostdevDef= *hostdev) case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: if (hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NO= NE && hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DR= IVE) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("SCSI host device must use 'drive' " "address type")); return -1; @@ -1362,7 +1362,7 @@ virDomainHostdevDefValidate(const virDomainHostdevDef= *hostdev) if (hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NO= NE && hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PC= I && hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CC= W) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("SCSI_host host device must use 'pci' " "or 'ccw' address type")); return -1; @@ -1371,7 +1371,7 @@ virDomainHostdevDefValidate(const virDomainHostdevDef= *hostdev) case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: if (hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NO= NE && hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_US= B) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("USB host device must use 'usb' address t= ype")); return -1; } @@ -1417,7 +1417,7 @@ static int virDomainVsockDefValidate(const virDomainVsockDef *vsock) { if (vsock->guest_cid > 0 && vsock->guest_cid <=3D 2) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("guest CIDs must be >=3D 3")); return -1; } @@ -1434,7 +1434,7 @@ virDomainInputDefValidate(const virDomainInputDef *in= put) case VIR_DOMAIN_INPUT_TYPE_TABLET: case VIR_DOMAIN_INPUT_TYPE_KBD: if (input->source.evdev) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("setting source evdev path only supporte= d for " "passthrough input devices")); return -1; @@ -1443,7 +1443,7 @@ virDomainInputDefValidate(const virDomainInputDef *in= put) =20 case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH: if (input->bus !=3D VIR_DOMAIN_INPUT_BUS_VIRTIO) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("only bus 'virtio' is supported for 'pass= through' " "input devices")); return -1; @@ -1464,19 +1464,19 @@ static int virDomainShmemDefValidate(const virDomainShmemDef *shmem) { if (strchr(shmem->name, '/')) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("shmem name cannot include '/' character")); return -1; } =20 if (STREQ(shmem->name, ".")) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("shmem name cannot be equal to '.'")); return -1; } =20 if (STREQ(shmem->name, "..")) { - virReportError(VIR_ERR_XML_ERROR, "%s", + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("shmem name cannot be equal to '..'")); return -1; } --=20 2.26.2