From nobody Thu Apr 25 23:54:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1631021028; cv=none; d=zohomail.com; s=zohoarc; b=BiqnGc8z2J+Ifop9qnxUJFpsATqfQnstfSr5PYhLfFGNie22QlvBVStaf0j8+Prr9ZZr38oqg+WJyRF3aRuNHuU/n4qAhd4G33AgKtiqXdlzdeDjgTpoBXtKiTbbrmAuJ5cjkbw0Eex51aYIEBzTEaiXVf/2WXcrnl4GijMahIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631021028; 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=XNTco2movuHRpQuAlNeWyL2qG+fmitv2BAMkUJN70Cs=; b=ReLh7mAEAIOydBpHaBx6ulniSiIA8dD7Kin8z/sWLnp2SpPgCSmzXMp2ihuukYTVml+ayPsv6cA6QxwqJuufFlMvGgIIKXeZvtGfwzCJtD67jiWqRaUqnpYNZSp7BdfDEwNX/ulHIEGAOEBzjKbBDOYJ557D/qlzbuMx7vEnfZ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1631021028816885.5710232421777; Tue, 7 Sep 2021 06:23:48 -0700 (PDT) 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-324-yMl7dFTpM5GUH9Y4vgfyFQ-1; Tue, 07 Sep 2021 09:23:45 -0400 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 A32201034AF2; Tue, 7 Sep 2021 13:23:40 +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 85ADB18649; Tue, 7 Sep 2021 13:23:40 +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 47E8544A5D; Tue, 7 Sep 2021 13:23:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 187DNMAZ013610 for ; Tue, 7 Sep 2021 09:23:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C8B96789A; Tue, 7 Sep 2021 13:23:22 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A34A5C3DF for ; Tue, 7 Sep 2021 13:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631021027; 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=XNTco2movuHRpQuAlNeWyL2qG+fmitv2BAMkUJN70Cs=; b=UlBUZNJwUKf6Aqfd2M/29qbNdRPevHWLj4hxe6QHjtR7lNvKvnde6f1ODYifnkUgaUSTLL +LYBQSXSjoJXrLHldOX3ZztLckS2e2F/vVwjJAAkUqkmBC+51AiMKTAZHVq6Gzh7pujwGr glJszZCyVopVpzBqLriicKvp1mw4Aws= X-MC-Unique: yMl7dFTpM5GUH9Y4vgfyFQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] qemuDomainDefValidateDiskLunSource: Unbreak error messages Date: Tue, 7 Sep 2021 15:22:57 +0200 Message-Id: <3c2587bc4b0614106d53ec1a7a99f7bd6b7253c1.1631020910.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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 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: 1631021029588100002 Content-Type: text/plain; charset="utf-8" Simplify looking for the error messages. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 25b7f03204..7f7d6dcfcc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9840,15 +9840,13 @@ qemuDomainDefValidateDiskLunSource(const virStorage= Source *src) if (virStorageSourceGetActualType(src) =3D=3D VIR_STORAGE_TYPE_NETWORK= ) { if (src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_ISCSI) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device=3D'lun' is not supported " - "for protocol=3D'%s'"), + _("disk device=3D'lun' is not supported for pro= tocol=3D'%s'"), virStorageNetProtocolTypeToString(src->protocol= )); return -1; } } else if (!virStorageSourceIsBlockLocal(src)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device=3D'lun' is only valid for block " - "type disk source")); + _("disk device=3D'lun' is only valid for block type= disk source")); return -1; } --=20 2.31.1 From nobody Thu Apr 25 23:54:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1631021021; cv=none; d=zohomail.com; s=zohoarc; b=HqDR0nBRQm7ppiaF1F8Z2SiBx5nbWzbDhXbQS4VyM6cyRYZ1tntcuuJdMKHegBDsMl96EePKLdMYNEGOz9yPjZNZ2pTtj1U+p5eGQz7gwwtgTEDcnU0y0Z/HX8cVIq8I1HVJSAkYEyB0FldJkNlrsI7JragvPYUuEp0Tv2158w4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631021021; 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=gxDqpjYuEsAavCmUi5YRm8ilmImAX9qfAT5FmPO3Ghc=; b=lb9DYMeza7BxF6pjYKBPP6JPxd1T3g+2FMEd5JmljV+w3uJyaTRqMma0tncU1wFRzjy23tN+k4/ZeDnMGmfbNcwWLc+pzM3DivImMc0FX4cOMwl+j7yf4PAvF7v/c0tEL9eBQ0+jOMoJ1pS7VAgYDtR1HDQSFO2Nl8SgNw7QsTo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1631021021365317.52110638850434; Tue, 7 Sep 2021 06:23:41 -0700 (PDT) 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-514-g6m8Hqw7MvKO6ep1yGJhOg-1; Tue, 07 Sep 2021 09:23:38 -0400 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 0465B8010F4; Tue, 7 Sep 2021 13:23:33 +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 868DF781EE; Tue, 7 Sep 2021 13:23:32 +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 E3E964EEA1; Tue, 7 Sep 2021 13:23:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 187DNU4G013626 for ; Tue, 7 Sep 2021 09:23:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3EA505C3DF; Tue, 7 Sep 2021 13:23:30 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DAE85C1B4 for ; Tue, 7 Sep 2021 13:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631021020; 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=gxDqpjYuEsAavCmUi5YRm8ilmImAX9qfAT5FmPO3Ghc=; b=gQMeOmTVY8iJaWGt7XlXFmmD4nI4cj8abohGRTYP1rsbL78CWmckyxgn5sO90ItnOQHtyJ EKxSk8OS91S9l0r6j6l4nAWxsq8KcKwSRdl4mU8T8zSeXhbKwNFcLAkWLf32iaA73MUUBB kswHrvs5dgg1PlgXCvVLbWLln8gm2QQ= X-MC-Unique: g6m8Hqw7MvKO6ep1yGJhOg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/6] conf: validate: Move qemu-specific LUN disk validation to global validation Date: Tue, 7 Sep 2021 15:22:58 +0200 Message-Id: <788a831e93529be4cd47e45d37aaeaee507c63cb.1631020910.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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 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: 1631021023344100002 Content-Type: text/plain; charset="utf-8" LUN disks are supported only by VMX and QEMU drivers and the VMX implementation is a subset of qemu's implementation, thus we can move the qemu-specific validator to the global validation code providing that we allow the format to be 'none' (qemu driver always sets 'raw' if it's not set) and allow disk type 'volume' as a source (qemu always translates the source, and VMX doesn't implement 'volume' at all). Moving the code to the global validation allows us to stop calling it from the qemu specific validation and also deduplicates the checks. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/domain_validate.c | 61 ++++++++++++++++++++++++++++++++------ src/conf/domain_validate.h | 2 ++ src/libvirt_private.syms | 1 + src/qemu/qemu_domain.c | 48 ------------------------------ src/qemu/qemu_domain.h | 3 -- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_validate.c | 3 -- 7 files changed, 56 insertions(+), 64 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 60f7ccdddd..dbabb953af 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -540,6 +540,57 @@ virDomainDiskDefValidateSource(const virStorageSource = *src) #define VENDOR_LEN 8 #define PRODUCT_LEN 16 + +/** + * virDomainDiskDefSourceLUNValidate: + * @src: disk source struct + * + * Validate whether the disk source is valid for disk device=3D'lun'. + * + * Returns 0 if the configuration is valid -1 and a libvirt error if the s= ource + * is invalid. + */ +int +virDomainDiskDefSourceLUNValidate(const virStorageSource *src) +{ + if (virStorageSourceGetActualType(src) =3D=3D VIR_STORAGE_TYPE_NETWORK= ) { + if (src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_ISCSI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("disk device=3D'lun' is not supported for pro= tocol=3D'%s'"), + virStorageNetProtocolTypeToString(src->protocol= )); + return -1; + } + } else if (!virStorageSourceIsBlockLocal(src) && + src->type !=3D VIR_STORAGE_TYPE_VOLUME) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device=3D'lun' is only valid for block type= disk source")); + return -1; + } + + if (src->format !=3D VIR_STORAGE_FILE_RAW && + src->format !=3D VIR_STORAGE_FILE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device 'lun' must use 'raw' format")); + return -1; + } + + if (src->sliceStorage) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device 'lun' doesn't support storage slice"= )); + return -1; + } + + if (src->encryption && + src->encryption->format !=3D VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device 'lun' doesn't support encryption")); + return -1; + } + + return 0; +} + + static int virDomainDiskDefValidate(const virDomainDef *def, const virDomainDiskDef *disk) @@ -551,16 +602,8 @@ virDomainDiskDefValidate(const virDomainDef *def, /* Validate LUN configuration */ if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { - /* volumes haven't been translated at this point, so accept them */ - if (!(disk->src->type =3D=3D VIR_STORAGE_TYPE_BLOCK || - disk->src->type =3D=3D VIR_STORAGE_TYPE_VOLUME || - (disk->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK && - disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_ISCSI))= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk '%s' improperly configured for a " - "device=3D'lun'"), disk->dst); + if (virDomainDiskDefSourceLUNValidate(disk->src) < 0) return -1; - } } else { if (disk->src->pr) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/src/conf/domain_validate.h b/src/conf/domain_validate.h index 38a1abcc8f..430d61fd3c 100644 --- a/src/conf/domain_validate.h +++ b/src/conf/domain_validate.h @@ -40,3 +40,5 @@ int virDomainDeviceDefValidate(const virDomainDeviceDef *= dev, void *parseOpaque); int virDomainDiskDefValidateSource(const virStorageSource *src); + +int virDomainDiskDefSourceLUNValidate(const virStorageSource *src); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ab8a6c00c3..2778fe7f8f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -767,6 +767,7 @@ virDomainConfVMNWFilterTeardown; virDomainActualNetDefValidate; virDomainDefValidate; virDomainDeviceValidateAliasForHotplug; +virDomainDiskDefSourceLUNValidate; # conf/interface_conf.h diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7f7d6dcfcc..5de7461fb3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9825,54 +9825,6 @@ qemuDomainDiskByName(virDomainDef *def, } -/** - * qemuDomainDefValidateDiskLunSource: - * @src: disk source struct - * - * Validate whether the disk source is valid for disk device=3D'lun'. - * - * Returns 0 if the configuration is valid -1 and a libvirt error if the s= ource - * is invalid. - */ -int -qemuDomainDefValidateDiskLunSource(const virStorageSource *src) -{ - if (virStorageSourceGetActualType(src) =3D=3D VIR_STORAGE_TYPE_NETWORK= ) { - if (src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_ISCSI) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk device=3D'lun' is not supported for pro= tocol=3D'%s'"), - virStorageNetProtocolTypeToString(src->protocol= )); - return -1; - } - } else if (!virStorageSourceIsBlockLocal(src)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device=3D'lun' is only valid for block type= disk source")); - return -1; - } - - if (src->format !=3D VIR_STORAGE_FILE_RAW) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device 'lun' must use 'raw' format")); - return -1; - } - - if (src->sliceStorage) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device 'lun' doesn't support storage slice"= )); - return -1; - } - - if (src->encryption && - src->encryption->format !=3D VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device 'lun' doesn't support encryption")); - return -1; - } - - return 0; -} - - int qemuDomainPrepareChannel(virDomainChrDef *channel, const char *domainChannelTargetDir) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index cb1cd968d5..ae9d76ec4a 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -893,9 +893,6 @@ int qemuDomainSecretPrepare(virQEMUDriver *driver, virDomainObj *vm) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -int qemuDomainDefValidateDiskLunSource(const virStorageSource *src) - ATTRIBUTE_NONNULL(1); - int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk, virQEMUCaps *qemuCaps); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2ea67b941e..302d2b4647 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14861,7 +14861,7 @@ qemuDomainBlockCopyCommon(virDomainObj *vm, goto endjob; if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN && - qemuDomainDefValidateDiskLunSource(mirror) < 0) + virDomainDiskDefSourceLUNValidate(mirror) < 0) goto endjob; if (!(flags & VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB) && diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1a470f1ff5..d8f39b6bdd 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2663,9 +2663,6 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDoma= inDiskDef *disk, return -1; } - if (qemuDomainDefValidateDiskLunSource(disk->src) < 0) - return -1; - if (disk->wwn) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Setting wwn is not supported for lun device"= )); --=20 2.31.1 From nobody Thu Apr 25 23:54:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1631021058; cv=none; d=zohomail.com; s=zohoarc; b=bHYQOgrT3mnI93CNfSXTl/WkzpSdAqqhaLrOegvh75hUd3wkJSU4C6kmndRyrhrfHsCIccg/RWP/aA6+khZB2U3F/hlWHKAmuwqfvwpBz3hVXv4UByd2W5BfVPrfX437LJAlS0CAe697slUFXm30RgZVUk2FJEp69K+VA7jk3VM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631021058; 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=Ro6hXrIr4LSvBWlJ1Wa4OfA5JN3g5q0xcGMpJjiDalc=; b=IxRZvaw8Sp/Dxm98Lw1Ts/Wrb1VjH9FjnPuDcIcIt8fvxRQr1Qm69hQDutG++Hy7ccByq7jdDVbf1Joo7fN+3tvr5KKENDuVUv6/DP3eLAyd/1SCJL0Pnm+1PXGiisfY/Zv5npaRAXCBNraobtYvl6UnjQENqh72RvRBUSxUS5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1631021058230484.9128912474871; Tue, 7 Sep 2021 06:24:18 -0700 (PDT) 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-532-ypJSWvuROCqxHDtIgpxekA-1; Tue, 07 Sep 2021 09:23:49 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 635D3106B2AD; Tue, 7 Sep 2021 13:23:43 +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 41B431007607; Tue, 7 Sep 2021 13:23:43 +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 124E5180B452; Tue, 7 Sep 2021 13:23:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 187DNVoW013631 for ; Tue, 7 Sep 2021 09:23:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3552C5C3DF; Tue, 7 Sep 2021 13:23:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E2535C1B4 for ; Tue, 7 Sep 2021 13:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631021057; 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=Ro6hXrIr4LSvBWlJ1Wa4OfA5JN3g5q0xcGMpJjiDalc=; b=Mzh+r+8oYf5aV6ndB/42LhVSvEG1xFTkxndDZTdN7BIR4KeF/PXMrWuzn+MkS2xZ03H1LT 59bNX85IUWYfOXHvh8T2SuJ2AF6grAeh0JFm7Cr5brWZZFE8Hhm+04UZi5ljwcXd8IBnQs lSHvfne9JDotI/nb4g/SLHmAci01yO0= X-MC-Unique: ypJSWvuROCqxHDtIgpxekA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] conf: validate: Run global device definition validation before callbacks Date: Tue, 7 Sep 2021 15:22:59 +0200 Message-Id: <691476efb33aa65623f63d3053cb230aebc978dd.1631020910.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.22 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: 1631021059892100001 Content-Type: text/plain; charset="utf-8" The validation infrastructure doesn't modify the definition and additionally it makes sense to run the global code first as it's validating certain corner cases. The changed error messages from qemuxml2argvtest show that this is indeed the proper ordering as all changed messages are actually better describing the error. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/domain_validate.c | 6 +++--- .../default-video-type-x86_64-caps-test-0.err | 2 +- tests/qemuxml2argvdata/disk-fdc-incompatible-address.err | 2 +- tests/qemuxml2argvdata/disk-ide-incompatible-address.err | 2 +- tests/qemuxml2argvdata/disk-sata-incompatible-address.err | 2 +- tests/qemuxml2argvdata/disk-scsi-incompatible-address.err | 2 +- tests/qemuxml2argvdata/pseries-default-phb-numa-node.err | 2 +- .../qemuxml2argvdata/pseries-phb-invalid-target-index-1.err | 2 +- .../qemuxml2argvdata/pseries-phb-invalid-target-index-2.err | 2 +- .../qemuxml2argvdata/pseries-phb-invalid-target-index-3.err | 2 +- tests/qemuxml2argvdata/video-invalid-multiple-devices.err | 2 +- ...video-ramfb-display-device-pci-address.x86_64-latest.err | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index dbabb953af..9069b60e37 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2289,11 +2289,11 @@ virDomainDeviceDefValidate(const virDomainDeviceDef= *dev, if (parseFlags & VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE) return 0; - if (xmlopt->config.deviceValidateCallback && - xmlopt->config.deviceValidateCallback(dev, def, xmlopt->config.pri= v, parseOpaque)) + if (virDomainDeviceDefValidateInternal(dev, def) < 0) return -1; - if (virDomainDeviceDefValidateInternal(dev, def) < 0) + if (xmlopt->config.deviceValidateCallback && + xmlopt->config.deviceValidateCallback(dev, def, xmlopt->config.pri= v, parseOpaque)) return -1; return 0; diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.e= rr b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err index f7b6b57926..28ffb0c7a2 100644 --- a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err +++ b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err @@ -1 +1 @@ -unsupported configuration: domain configuration does not support video mod= el 'default' +internal error: missing video model and cannot determine default diff --git a/tests/qemuxml2argvdata/disk-fdc-incompatible-address.err b/tes= ts/qemuxml2argvdata/disk-fdc-incompatible-address.err index 169da75bf0..74075aa80c 100644 --- a/tests/qemuxml2argvdata/disk-fdc-incompatible-address.err +++ b/tests/qemuxml2argvdata/disk-fdc-incompatible-address.err @@ -1 +1 @@ -internal error: unexpected address type for fdc disk +unsupported configuration: Invalid address type 'pci' for the disk 'fda' w= ith the bus type 'fdc' diff --git a/tests/qemuxml2argvdata/disk-ide-incompatible-address.err b/tes= ts/qemuxml2argvdata/disk-ide-incompatible-address.err index 03eea59410..29abf07365 100644 --- a/tests/qemuxml2argvdata/disk-ide-incompatible-address.err +++ b/tests/qemuxml2argvdata/disk-ide-incompatible-address.err @@ -1 +1 @@ -internal error: unexpected address type for ide disk +unsupported configuration: Invalid address type 'pci' for the disk 'hda' w= ith the bus type 'ide' diff --git a/tests/qemuxml2argvdata/disk-sata-incompatible-address.err b/te= sts/qemuxml2argvdata/disk-sata-incompatible-address.err index 09395bcd6b..cdb176b7d6 100644 --- a/tests/qemuxml2argvdata/disk-sata-incompatible-address.err +++ b/tests/qemuxml2argvdata/disk-sata-incompatible-address.err @@ -1 +1 @@ -internal error: unexpected address type for sata disk +unsupported configuration: Invalid address type 'pci' for the disk 'sda' w= ith the bus type 'sata' diff --git a/tests/qemuxml2argvdata/disk-scsi-incompatible-address.err b/te= sts/qemuxml2argvdata/disk-scsi-incompatible-address.err index 13d619a3e2..3458311d44 100644 --- a/tests/qemuxml2argvdata/disk-scsi-incompatible-address.err +++ b/tests/qemuxml2argvdata/disk-scsi-incompatible-address.err @@ -1 +1 @@ -internal error: unexpected address type for scsi disk +unsupported configuration: Invalid address type 'pci' for the disk 'sda' w= ith the bus type 'scsi' diff --git a/tests/qemuxml2argvdata/pseries-default-phb-numa-node.err b/tes= ts/qemuxml2argvdata/pseries-default-phb-numa-node.err index e46b710330..20dade0530 100644 --- a/tests/qemuxml2argvdata/pseries-default-phb-numa-node.err +++ b/tests/qemuxml2argvdata/pseries-default-phb-numa-node.err @@ -1 +1 @@ -unsupported configuration: Option 'numaNode' is not valid for PCI controll= er with index '0', model 'pci-root' and modelName 'spapr-pci-host-bridge' +unsupported configuration: The PCI controller with index=3D0 can't be asso= ciated with a NUMA node diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err = b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err index 9c9eb69ae4..91f67d4876 100644 --- a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err +++ b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err @@ -1 +1 @@ -unsupported configuration: The 'spapr-pci-host-bridge' device is not suppo= rted by this QEMU binary +unsupported configuration: Only the PCI controller with index 0 can have t= arget index 0, and vice versa diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err = b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err index 9c9eb69ae4..91f67d4876 100644 --- a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err +++ b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err @@ -1 +1 @@ -unsupported configuration: The 'spapr-pci-host-bridge' device is not suppo= rted by this QEMU binary +unsupported configuration: Only the PCI controller with index 0 can have t= arget index 0, and vice versa diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err = b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err index 9c9eb69ae4..c008dd5838 100644 --- a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err +++ b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err @@ -1 +1 @@ -unsupported configuration: The 'spapr-pci-host-bridge' device is not suppo= rted by this QEMU binary +unsupported configuration: PCI controller target index '31' out of range -= must be 0-30 diff --git a/tests/qemuxml2argvdata/video-invalid-multiple-devices.err b/te= sts/qemuxml2argvdata/video-invalid-multiple-devices.err index 5c1e557021..69fe45e1a4 100644 --- a/tests/qemuxml2argvdata/video-invalid-multiple-devices.err +++ b/tests/qemuxml2argvdata/video-invalid-multiple-devices.err @@ -1 +1 @@ -unsupported configuration: domain configuration does not support video mod= el 'qxl' +unsupported configuration: a 'none' video type must be the only video devi= ce defined for the domain diff --git a/tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.= x86_64-latest.err b/tests/qemuxml2argvdata/video-ramfb-display-device-pci-a= ddress.x86_64-latest.err index 00e409e1db..04aaabca72 100644 --- a/tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.x86_64-= latest.err +++ b/tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.x86_64-= latest.err @@ -1 +1 @@ -unsupported configuration: 'address' is not supported for 'ramfb' video de= vices +unsupported configuration: address not supported for video type ramfb --=20 2.31.1 From nobody Thu Apr 25 23:54:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1631021035; cv=none; d=zohomail.com; s=zohoarc; b=dAvJiEVSRn4z3YOPHxT3YE1r/HiVo/KL4Ppoq1FMoOOB5L0hHOEXbnhjeUJBm99CEz5wu8U7MGx9WeySrTDxZyYY7ZcQtxRPNrV8femuxPugvVi2P2ihX92rSLLnXo3lOY9oVc/7bSvq0P8LDmalEguI4Dfl9I9oTzFCeRySmDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631021035; 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=vwsBEC9aZuihWoshcks2OvoB/Z/C9pUMdmhsyGGtAjA=; b=HOwM94npIXXirCitcaIobU7O2aMe62Y3F4idGFlpqzoNuqY5T+j2vHszJMLNUj9vbqMvGJv2MVj7Rni9rrpG1mNnFH/Ofe/El7ObttNxRG+7itsQZYKckfZRzeRbmA4UKMI9rPiLscv7/URfF9kuRv7AGlfDctu2EaAuTEGddZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 163102103522788.49866308912704; Tue, 7 Sep 2021 06:23:55 -0700 (PDT) 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-228-uv6jWy57OBGWEUGl_V8KlQ-1; Tue, 07 Sep 2021 09:23:51 -0400 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 4A73D1044AEF; Tue, 7 Sep 2021 13:23:46 +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 2CBEB6ACE0; Tue, 7 Sep 2021 13:23:46 +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 EEE0B1801258; Tue, 7 Sep 2021 13:23:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 187DNWuY013642 for ; Tue, 7 Sep 2021 09:23:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C1586788C; Tue, 7 Sep 2021 13:23:32 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9613B5C1B4 for ; Tue, 7 Sep 2021 13:23:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631021033; 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=vwsBEC9aZuihWoshcks2OvoB/Z/C9pUMdmhsyGGtAjA=; b=YA+AkbiezRG/FW21B1mRM6k0LHWEL0gNkVuDy0SWPlqJtFHmZVDYQaBpI7R9sEaQHBbaxa sf7Gy5yIziHZbSnJXNa6on7YCARhqsKdF2yBNeWhA/ms+5DX2k/ZbVz9wMKqH5aHIqZgbm kSn/zznIiNwKMFEgeHnZSM/wlcRp9G0= X-MC-Unique: uv6jWy57OBGWEUGl_V8KlQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] conf: Don't call 'virDomainDiskDefAssignAddress' when disk->dst is NULL Date: Tue, 7 Sep 2021 15:23:00 +0200 Message-Id: <5f572b4c42cb9115535101fc1406cd27c1da30e3.1631020910.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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 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: 1631021036696100001 Content-Type: text/plain; charset="utf-8" The code rejecting a XML when the disk target is missing was moved to the validation code which goes after post parse. One of the cases in the disk post parse code didn't check whether 'disk->dst' is set which at that point isn't guaranteed. Fixes: 61fd7174c2afbe128ef1896198919429bcaca3d7 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2001627 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index dbefc98ee8..cb9e7218ff 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5413,6 +5413,7 @@ virDomainDiskDefPostParse(virDomainDiskDef *disk, } if (disk->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + disk->dst && virDomainDiskDefAssignAddress(xmlopt, disk, def) < 0) { return -1; } --=20 2.31.1 From nobody Thu Apr 25 23:54:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1631021028; cv=none; d=zohomail.com; s=zohoarc; b=UVWMoLWRiUvgdpyP+Nwg/23xHjYCbFx9KCcE1SsuID3GZjEZN0rHyCuqMF7twHF/N/tksX2ANo3b02J6z1yqPerqatFPAX3HC3085HyfxdqRIXMyettV2baoSWRfr6vl9DRIOB10lVIJ+JVOljbzlmpc7ZtElJq/bnqL5iki5ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631021028; 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=z7AAODcj9DtnHNUoFhze5RzN7v6+ylmj9bmu55zoqf0=; b=PzAc4Z30maVOFpCFveP7OCYKY5dN60LuNfq5FJRnSx5IuN9/9MgOkIQsmmExUm+bxrgHy5MW0XEh31pXM245dzdS0yAhkXR4Z3QQEUBrCmEdvtrgZQ25MhVlxAnpo2j5/jYKnP3ZCba6u6WAqYmwasMEn8IEb7zyzmapIyOQ7k4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1631021028150355.0042528177976; Tue, 7 Sep 2021 06:23:48 -0700 (PDT) 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-310-ZFzF9RZ5Pk6f8mWeHqUk3Q-1; Tue, 07 Sep 2021 09:23:45 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 98E5E801A92; Tue, 7 Sep 2021 13:23:40 +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 790C36788C; Tue, 7 Sep 2021 13:23:40 +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 48C0644A5E; Tue, 7 Sep 2021 13:23:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 187DNXSc013653 for ; Tue, 7 Sep 2021 09:23:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 525B86788C; Tue, 7 Sep 2021 13:23:33 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id A76A75C1B4 for ; Tue, 7 Sep 2021 13:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631021027; 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=z7AAODcj9DtnHNUoFhze5RzN7v6+ylmj9bmu55zoqf0=; b=e1jpEUeU9L/5h5ASSwPeKPBk+RIqqP3XT8gOn3Cv5siqiCrzAb21dkHatz8567xztQHsVx PMjMe1sZgkaaP4RVtWKJQUAUl/d5nPKe8wn8MieyTP4NvZvyTM4e5SMq/RinfhlBhAIJB4 Mrbs04MjorBvElBHIEEg4MQVvKmgxDU= X-MC-Unique: ZFzF9RZ5Pk6f8mWeHqUk3Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/6] virDomainDiskDefValidate: Move validation of disk target Date: Tue, 7 Sep 2021 15:23:01 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.16 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: 1631021029512100001 Content-Type: text/plain; charset="utf-8" The disk target is mandatory and used as a designator in error messages of other validation steps, so we must validate it first. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/conf/domain_validate.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 9069b60e37..1bc62c364d 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -597,6 +597,20 @@ virDomainDiskDefValidate(const virDomainDef *def, { virStorageSource *next; + /* disk target is used widely in other code so it must be validated fi= rst */ + if (!disk->dst) { + if (disk->src->srcpool) { + virReportError(VIR_ERR_NO_TARGET, _("pool =3D '%s', volume =3D= '%s'"), + disk->src->srcpool->pool, + disk->src->srcpool->volume); + } else { + virReportError(VIR_ERR_NO_TARGET, + disk->src->path ? "%s" : NULL, disk->src->path); + } + + return -1; + } + if (virDomainDiskDefValidateSource(disk->src) < 0) return -1; @@ -776,19 +790,6 @@ virDomainDiskDefValidate(const virDomainDef *def, if (disk->wwn && !virValidateWWN(disk->wwn)) return -1; - if (!disk->dst) { - if (disk->src->srcpool) { - virReportError(VIR_ERR_NO_TARGET, _("pool =3D '%s', volume =3D= '%s'"), - disk->src->srcpool->pool, - disk->src->srcpool->volume); - } else { - virReportError(VIR_ERR_NO_TARGET, - disk->src->path ? "%s" : NULL, disk->src->path); - } - - return -1; - } - if ((disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_DISK || disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) && !STRPREFIX(disk->dst, "hd") && --=20 2.31.1 From nobody Thu Apr 25 23:54:02 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1631021031; cv=none; d=zohomail.com; s=zohoarc; b=EgKC/Iz0eZVHpZaB0AZ9zjjiKoymwDZsdOMPVLNptQrvCKz8+AmQfY6a6fH6qnR69gTK0IeOFEWR2UWJTIobWyUcq47Gzy9OXxDGMnhbnPHnBInN3ypYs/8SoJyibc1qEXSbzdVy8ytI0q9MyDH+WoXNKOyRRIOm8Iajxqpsw4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631021031; 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=FGVrpHH/uYymO1AnMWlkEOBWOYg59w6Jl6Mr6U45mcM=; b=aCEw7vSzs053yv6nxRpF7dtJ31xN78PGpTynZRB98M+yb+qFkjcxuqEIITDmbR1/IFUZN9lPXjGGQv1sJZXGk5g49K/Zp0dWJxJfyeuyfE2qzAlb8Y23EGrq+yodIoBEKnqdeKloOjAcKjfNFPg+afhyeG717mBkc1XSNmw+1hU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1631021031163851.709617860753; Tue, 7 Sep 2021 06:23:51 -0700 (PDT) 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-213-8EQij1bUMoKQ62r6bSrOpQ-1; Tue, 07 Sep 2021 09:23:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C5A76D592; Tue, 7 Sep 2021 13:23:43 +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 3ABE419736; Tue, 7 Sep 2021 13:23:43 +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 0A37C180B44F; Tue, 7 Sep 2021 13:23:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 187DNYrp013663 for ; Tue, 7 Sep 2021 09:23:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5FFDE6788C; Tue, 7 Sep 2021 13:23:34 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id C14A75C1B4 for ; Tue, 7 Sep 2021 13:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631021030; 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=FGVrpHH/uYymO1AnMWlkEOBWOYg59w6Jl6Mr6U45mcM=; b=Pe+znFyruzp2fcPEjOtYpyCCb1xo+q3j+Qek/gdt+ES8BVG4IjDsg7nUgCq0+Bm45C/2/g JQQYvivYwDrSzZjabl9dmlRhmpzL+7XOMUPNBhWqDjcdIM0PeUn/VwnZRMNHl296sqWBjo 2fPEJkuAKhR8lXBcTmiFX3QxQqeR2MQ= X-MC-Unique: 8EQij1bUMoKQ62r6bSrOpQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/6] qemuxml2argvtest: Add test case for missing disk '' Date: Tue, 7 Sep 2021 15:23:02 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.23 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: 1631021031921100001 Content-Type: text/plain; charset="utf-8" Cover the case of missing disk target to cover the case fixed by previous commit. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- .../disk-missing-target-invalid.err | 1 + .../disk-missing-target-invalid.xml | 22 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 24 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-missing-target-invalid.err create mode 100644 tests/qemuxml2argvdata/disk-missing-target-invalid.xml diff --git a/tests/qemuxml2argvdata/disk-missing-target-invalid.err b/tests= /qemuxml2argvdata/disk-missing-target-invalid.err new file mode 100644 index 0000000000..6a33f1e8e8 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-missing-target-invalid.err @@ -0,0 +1 @@ +missing target information for device /dev/HostVG/QEMUGuest1 diff --git a/tests/qemuxml2argvdata/disk-missing-target-invalid.xml b/tests= /qemuxml2argvdata/disk-missing-target-invalid.xml new file mode 100644 index 0000000000..49cd73142a --- /dev/null +++ b/tests/qemuxml2argvdata/disk-missing-target-invalid.xml @@ -0,0 +1,22 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 3b331d5fd4..c67214d01e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1455,6 +1455,7 @@ mymain(void) DO_TEST_PARSE_ERROR("disk-same-targets", QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_USB_STORAGE); + DO_TEST_PARSE_ERROR("disk-missing-target-invalid", QEMU_CAPS_SCSI_LSI); DO_TEST_PARSE_ERROR("disk-address-conflict", QEMU_CAPS_ICH9_AHCI); DO_TEST_PARSE_ERROR("disk-hostdev-scsi-address-conflict", --=20 2.31.1