From nobody Thu May 15 17:49:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506517952522421.9763078534638; Wed, 27 Sep 2017 06:12:32 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 20BD97E451; Wed, 27 Sep 2017 13:12:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F36977D92D; Wed, 27 Sep 2017 13:12:30 +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 71C6862CEB; Wed, 27 Sep 2017 13:12:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8RCCq7q017002 for ; Wed, 27 Sep 2017 08:12:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id C195F782DD; Wed, 27 Sep 2017 12:12:52 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 457B478A0D for ; Wed, 27 Sep 2017 12:12:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 20BD97E451 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 27 Sep 2017 14:12:43 +0200 Message-Id: <366cf30f548f64852fb527106a53f464bddcffa2.1506514250.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 1/3] qemuDomainDeviceDefValidate: Validate watchdog 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 27 Sep 2017 13:12:31 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Currently we don't do it. Therefore we accept senseless combinations of models and buses they are attached to. Moreover, diag288 watchdog is exclusive to s390(x). Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 51 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0b094a15e..71926bcd8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3340,6 +3340,54 @@ qemuDomainRedirdevDefValidate(const virDomainRedirde= vDef *def) } =20 =20 +static int +qemuDomainWatchdogDefValidate(const virDomainWatchdogDef *dev, + const virDomainDef *def) +{ + switch ((virDomainWatchdogModel) dev->model) { + case VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB: + if (dev->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + dev->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s model of watchog can go only on PCI bus"), + virDomainWatchdogModelTypeToString(dev->model)); + return -1; + } + break; + + case VIR_DOMAIN_WATCHDOG_MODEL_IB700: + if (dev->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + dev->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s model of watchog can go only on ISA bus"), + virDomainWatchdogModelTypeToString(dev->model)); + return -1; + } + break; + + case VIR_DOMAIN_WATCHDOG_MODEL_DIAG288: + if (dev->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s model of watchog is virtual and cannot go= on any bus."), + virDomainWatchdogModelTypeToString(dev->model)); + return -1; + } + if (!(ARCH_IS_S390(def->os.arch))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s model of watchdog is allowed for s390 and= s390x only"), + virDomainWatchdogModelTypeToString(dev->model)); + return -1; + } + break; + + case VIR_DOMAIN_WATCHDOG_MODEL_LAST: + break; + } + + return 0; +} + + static int qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, const virDomainDef *def, @@ -3448,6 +3496,9 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, } else if (dev->type =3D=3D VIR_DOMAIN_DEVICE_REDIRDEV) { if (qemuDomainRedirdevDefValidate(dev->data.redirdev) < 0) goto cleanup; + } else if (dev->type =3D=3D VIR_DOMAIN_DEVICE_WATCHDOG) { + if (qemuDomainWatchdogDefValidate(dev->data.watchdog, def) < 0) + goto cleanup; } =20 /* forbid capabilities mode hostdev in this kind of hypervisor */ --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list