From nobody Fri Dec 19 04:15:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1602708286; cv=none; d=zohomail.com; s=zohoarc; b=S2asfxDDyUzb1M+wzWSV/7ir0amBaSSehlR4+QUZ5pE931CfweuQxCjqo+mvBDQrxgaROndT7DnGP8YYVcrrPeszjUaUwxDaiDSGJf4un+OU63wow1fpFbdlQisLPSpXz6LXvOC2UVgmzuBocGBHbttejCtmscqHFteyP0KSDmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602708286; 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=9RXcLaKDq8qbvuQlLI6yAnxv175GJk0nIvfEVWSH3Hg=; b=cni6TdLS0ZKbgn4L81IsLrkztUlqd2hd5DDOn1K1JFGGwsNpSi9p4t7cUvz3EM9LKzNn3fCJYKik8Mz5HcFzeyy2zmNel728FxoZz8PZOx5BG1xDSlmW3hmVmdEMMZjgJ8ffnTObzmBjoC35DmBD6X+B1+xGQ74UWD54DVXfYSc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 160270828621552.27884534445104; Wed, 14 Oct 2020 13:44:46 -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-126-R5uxZS2LMdOuZc4DZVBX8A-1; Wed, 14 Oct 2020 16:44:42 -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 734D31007471; Wed, 14 Oct 2020 20:44:36 +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 5110610027AB; Wed, 14 Oct 2020 20:44:36 +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 E1BFB181A870; Wed, 14 Oct 2020 20:44:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09EKhUqv028632 for ; Wed, 14 Oct 2020 16:43:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id D7B132166BB3; Wed, 14 Oct 2020 20:43:30 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D28C82166B27 for ; Wed, 14 Oct 2020 20:43:30 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 AB6DD8007DF for ; Wed, 14 Oct 2020 20:43:30 +0000 (UTC) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-124-_lyLPSBPP32jq2d2OdTWlg-1; Wed, 14 Oct 2020 16:43:28 -0400 Received: by mail-io1-f42.google.com with SMTP id n6so902967ioc.12 for ; Wed, 14 Oct 2020 13:43:28 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:5a9b:54fc:df2a:8a5e:989b]) by smtp.gmail.com with ESMTPSA id i4sm492202ilc.27.2020.10.14.13.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 13:43:27 -0700 (PDT) X-MC-Unique: R5uxZS2LMdOuZc4DZVBX8A-1 X-MC-Unique: _lyLPSBPP32jq2d2OdTWlg-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=9RXcLaKDq8qbvuQlLI6yAnxv175GJk0nIvfEVWSH3Hg=; b=ft470RJ3sAdO8dC1pW7+LLQptiOAQcuUsNcISBMw7jXsJQYG06XkMNR7TnuBAopxRN 9+B0rzf6kIHoY7k9RzfA/6aoFzC6G+HyuXHMSdechGZc7o8r3QVZ+Eb8HrpH8jko5eUv 4rewN0Yg2iRBnJZZc8NSi59Nqsp7vezjIgrxxFbbCGjStm0TjqvRJiPCKpDk48lQvBCd MxLjQGzEYMrs/ev85NgBCyjzVieSFdNZ33Lndf9RY8szJ3rSmOGmlxs5Q4iBduFM+AXW Mkr6YKBOTVFz5pOKcLCUsYm1PtdU2OhJ/y2fMq5fJ3igro0eTQdS49hqqmf3cjtbuufk EkBw== X-Gm-Message-State: AOAM5309YvK/KyUTCsM3dhKyjKmPrmz0QlS/Ot3ZQQSIvQ5GOjITM2VK 8dq/8j5yD1zokFn3mv/IlgFxN7qJDAg= X-Google-Smtp-Source: ABdhPJz+S+jw52Ohw7e61uiCVWJQgFaPIZWGAsukIrTQLgf2kVan4VdQ9Eqr0qEf0dgOocmR8+AVpA== X-Received: by 2002:a6b:e51a:: with SMTP id y26mr967874ioc.86.1602708207510; Wed, 14 Oct 2020 13:43:27 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 04/24] qemu_command.c: move DISK_BUS_SATA validation to qemu_validate.c Date: Wed, 14 Oct 2020 17:42:47 -0300 Message-Id: <20201014204307.631746-5-danielhb413@gmail.com> In-Reply-To: <20201014204307.631746-1-danielhb413@gmail.com> References: <20201014204307.631746-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.78 on 10.11.54.6 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.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 Content-Type: text/plain; charset="utf-8" A few tweaks were made during the move: - the error messages were changed to mention 'sata controller' instead of 'ide controller'; - a check for address type 'drive' was added like it is done with other bus types. The error message of qemuxml2argdata was updated to reflect that now, instead of erroring it out from the common code in virDomainDiskDefValidate(), we're failing earlier with a different error message. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 11 ----------- src/qemu/qemu_validate.c | 19 +++++++++++++++++++ .../disk-sata-incompatible-address.err | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9ec5ace1c7..b2c6bd43a2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1634,17 +1634,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, break; =20 case VIR_DOMAIN_DISK_BUS_SATA: - if (disk->info.addr.drive.bus !=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("bus must be 0 for ide controller")); - return NULL; - } - if (disk->info.addr.drive.target !=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("target must be 0 for ide controller")); - return NULL; - } - if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(&opt, "ide-cd"); else diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 5ad13d9fd6..289b99eea7 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2245,6 +2245,25 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDom= ainDiskDef *disk, } break; =20 + case VIR_DOMAIN_DISK_BUS_SATA: + if (disk->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("unexpected address type for sata disk")); + return -1; + } + + if (disk->info.addr.drive.bus !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("bus must be 0 for sata controller")); + return -1; + } + if (disk->info.addr.drive.target !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("target must be 0 for sata controller")); + return -1; + } + break; + case VIR_DOMAIN_DISK_BUS_VIRTIO: case VIR_DOMAIN_DISK_BUS_XEN: case VIR_DOMAIN_DISK_BUS_SD: diff --git a/tests/qemuxml2argvdata/disk-sata-incompatible-address.err b/te= sts/qemuxml2argvdata/disk-sata-incompatible-address.err index cdb176b7d6..09395bcd6b 100644 --- a/tests/qemuxml2argvdata/disk-sata-incompatible-address.err +++ b/tests/qemuxml2argvdata/disk-sata-incompatible-address.err @@ -1 +1 @@ -unsupported configuration: Invalid address type 'pci' for the disk 'sda' w= ith the bus type 'sata' +internal error: unexpected address type for sata disk --=20 2.26.2