From nobody Fri Dec 19 06:00:49 2025 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=1602708270; cv=none; d=zohomail.com; s=zohoarc; b=BxYpferGZb9V3D9v+V+/0g3tYnlazDeEg6j/qYRjXGZzZ3xCi6q5JCAyLjHPseXvYoAraN0Ckwa67lijGRSz/0z3fgdLIXjL8krq4APmOWkkLeDEcQdcOv37nHYHeP7ttQsnUWzoB4A9LF8442SQlQFJCTOO2FuVtp8GpCfF6+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602708270; 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=EuPKVq4iFTO9HsYLPQFur7p2GEkcXCnP2axol/M74yk=; b=fv4ofIlbW4LYIOxQz98JVhVT2E+atIVA2z1/h0NRpq3ILkkFVuHoub4xy8aVkl25dx8N4vketmy322MkxKzrEOPeS9OQHZOjcVx9h8spSvO3uncOXqLkFd83SRy9nBOEbc4R3DEsqmFZonsyu7amF8Rg8pvvDWw2yQUiMgN+Sec= 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 1602708270275254.83807612685496; Wed, 14 Oct 2020 13:44:30 -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-569-u_kJlJ7BOci_-4rCdyxjNA-1; Wed, 14 Oct 2020 16:44:26 -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 1AA31186DD25; Wed, 14 Oct 2020 20:44:19 +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 EB0CA75135; Wed, 14 Oct 2020 20:44:18 +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 B276B5810F; Wed, 14 Oct 2020 20:44:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09EKhSp4028597 for ; Wed, 14 Oct 2020 16:43:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id C1FBC10921B5; Wed, 14 Oct 2020 20:43:28 +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 BCE3F10921A9 for ; Wed, 14 Oct 2020 20:43:26 +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 92C6380018B for ; Wed, 14 Oct 2020 20:43:26 +0000 (UTC) Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-FDuJXTJSPW6rR61JPjcZ6g-1; Wed, 14 Oct 2020 16:43:24 -0400 Received: by mail-il1-f169.google.com with SMTP id r10so1012934ilm.11 for ; Wed, 14 Oct 2020 13:43:23 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 13:43:22 -0700 (PDT) X-MC-Unique: u_kJlJ7BOci_-4rCdyxjNA-1 X-MC-Unique: FDuJXTJSPW6rR61JPjcZ6g-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=EuPKVq4iFTO9HsYLPQFur7p2GEkcXCnP2axol/M74yk=; b=T3qZvQr4kKVgjUMKOe667rfCLAN0YchAL21Z3+6ZwMBSjrEzTsM+xBG1ZMRJbel+To ICA98t0np7iGVNbqGsOXELa0fo+RM/hUqiV4DhogKqpQNJyYTqOuXP3Fxgbt2j2L2siS 8PmUpukD+RSLyUMVpzLfQjMO/B5kzx2Zhvgks8M+6mCoLSOipk50i4USJv+/z9/fvnnR f9ugXW1yrq4kQW3ay1dwpGODfkQiFpaNnvz47FQ+0Pfl6hKi3dyZg9FXN4QmU77k+kZL ZwS8vTiwpW6AVBKWaMlRTZ6XQKlPMovUikaufGyb+DzUwXyoMhmwqK2f/CC++BZwFmvV 622w== X-Gm-Message-State: AOAM531mzsaFGp1Ol2IThpWUX9vUKdm516I7+xwVf4oNV4nDWm/Oz9eo weYQjI0aCcEHeIVFE2Z+18A3mJlVZ2M= X-Google-Smtp-Source: ABdhPJwSa88YmV4ZYCKLiFxJGNRte5QRpHLoHo6yWq//HZiSeVuEF3MkfnvPeH7WkKNdRsoDdZD0dQ== X-Received: by 2002:a92:dec2:: with SMTP id k2mr880229ilp.78.1602708203083; Wed, 14 Oct 2020 13:43:23 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v1 01/24] qemu_command.c: move wwn validation to qemu_validate.c Date: Wed, 14 Oct 2020 17:42:44 -0300 Message-Id: <20201014204307.631746-2-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.3 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.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 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 27 --------------------------- src/qemu/qemu_validate.c | 31 +++++++++++++++++++++++++++++-- tests/qemuxml2argvtest.c | 4 +++- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 697a2db62b..5a693e143f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1567,14 +1567,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, return NULL; } =20 - if (disk->wwn && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_DRIVE_WWN)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting wwn for ide disk is not supported " - "by this QEMU")); - return NULL; - } - if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(&opt, "ide-cd"); else @@ -1607,25 +1599,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, } } =20 - if (disk->wwn && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting wwn for scsi disk is not supported " - "by this QEMU")); - return NULL; - } - - /* Properties wwn, vendor and product were introduced in the - * same QEMU release (1.2.0). - */ - if ((disk->vendor || disk->product) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Setting vendor or product for scsi disk is n= ot " - "supported by this QEMU")); - return NULL; - } - controllerModel =3D qemuDomainFindSCSIControllerModel(def, &disk->= info); if (controllerModel < 0) return NULL; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index bc3043bb3f..e747ce2cb0 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2066,13 +2066,40 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDo= mainDiskDef *disk, _("Only ide and scsi disk support wwn")); return -1; } + + if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_IDE && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IDE_DRIVE_WWN)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting wwn for ide disk is not supported " + "by this QEMU")); + return -1; + } + + if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting wwn for scsi disk is not supported " + "by this QEMU")); + return -1; + } } =20 - if ((disk->vendor || disk->product) && - disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI) { + if (disk->vendor || disk->product) { + if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_SCSI) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Only scsi disk supports vendor and product")= ); return -1; + } + + /* Properties wwn, vendor and product were introduced in the + * same QEMU release (1.2.0). + */ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_WWN)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting vendor or product for scsi disk is n= ot " + "supported by this QEMU")); + return -1; + } } =20 if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_LUN) { diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8aa791d9f7..cd15ce5138 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2252,7 +2252,9 @@ mymain(void) DO_TEST_PARSE_ERROR("mach-virt-serial-invalid-machine", NONE); =20 DO_TEST("disk-ide-split", NONE); - DO_TEST("disk-ide-wwn", QEMU_CAPS_IDE_DRIVE_WWN); + DO_TEST("disk-ide-wwn", + QEMU_CAPS_IDE_DRIVE_WWN, + QEMU_CAPS_SCSI_DISK_WWN); =20 DO_TEST("disk-geometry", NONE); DO_TEST("disk-blockio", QEMU_CAPS_BLOCKIO); --=20 2.26.2