From nobody Mon Feb 9 07:26:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1599835197; cv=none; d=zohomail.com; s=zohoarc; b=VZe0XgwYMyJ0gc+bkwLPCpdiJpG0bpnsEwW86Vkk5UcvcCgCIFfJnTu2e2cW/2MT8tleVISJRS1nGTLUVa9L9WMUFZxYZj5jZomd8s7CQqwJDFbsWaxLdehoy4vJHvQeMqnhbeHU71icb+Rej+pRAnEsPGzyu9Ui+W20h2EVt40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835197; 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=TqzUMMj6s1QE5Rb33a3qIImNruBpcSHGNuMGk2jQQS4=; b=TaNuCkRS5zdroKNQFi+S0fmN9fK7LMvaaO357uaR1YoZbmkdHK3uuYHbiwYsMzP+v06XHVG7Td3u0ECaYj1nMXwhizq2wp1oXboRJ3AHSqbfVGsWJgGz0UNW9h2xczLHoaeiJgxlWz3h1vUL/lDGo+xluMz9L6YqrQJjVqSBsfs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1599835197672162.40016658640843; Fri, 11 Sep 2020 07:39:57 -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-283--tGexHVgPS-XufWExcCRpw-1; Fri, 11 Sep 2020 10:39:53 -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 13137109106D; Fri, 11 Sep 2020 14:39:48 +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 E8BEB7EB97; Fri, 11 Sep 2020 14:39:47 +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 B80B5181A872; Fri, 11 Sep 2020 14:39:47 +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 08BEbwUD002446 for ; Fri, 11 Sep 2020 10:37:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 002708FCA3; Fri, 11 Sep 2020 14:37:58 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 733328FCA1 for ; Fri, 11 Sep 2020 14:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835196; 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=TqzUMMj6s1QE5Rb33a3qIImNruBpcSHGNuMGk2jQQS4=; b=fIyeCsjyDhRI+lfP52eIbJjmyG74+9T3fQpa1PdGEv+XE6Z5WPrCj3MeErN+g8lbYCDhUQ JhN6D2ZaFGL2jE8cqGuQuCCKzOsLXeiPucGXWDD9hlz5CrlxGs5/hOzlCI6R8V25u/s9g+ Vq6YoSY8Y6ioVustCRw9nuSyZufNl/M= X-MC-Unique: -tGexHVgPS-XufWExcCRpw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/17] qemuDomainPrepareHostdev: Allocate backend nodenames in the prepare function Date: Fri, 11 Sep 2020 16:37:32 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Allocate the nodename in the setup function rather than in the command line generator. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 7 ++++--- src/qemu/qemu_domain.c | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d92b967419..c5c587b97d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5105,9 +5105,11 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDe= fPtr hostdev, switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: - if (!scsisrc->u.host.src && - !(scsisrc->u.host.src =3D virStorageSourceNew())) + if (!scsisrc->u.host.src) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("SCSI host device data structure was not = initialized")); return NULL; + } if (!(devstr =3D qemuBuildSCSIHostHostdevDrvStr(hostdev))) return NULL; @@ -5130,7 +5132,6 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDef= Ptr hostdev, return NULL; } - src->nodestorage =3D g_strdup_printf("libvirt-%s-backend", hostdev= ->info->alias); ret->storageNodeName =3D src->nodestorage; *backendAlias =3D src->nodestorage; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a751d0c205..d570ba892b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10409,6 +10409,10 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr ho= stdev, switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + virObjectUnref(scsisrc->u.host.src); + if (!(scsisrc->u.host.src =3D virStorageSourceNew())) + return -1; + src =3D scsisrc->u.host.src; break; case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: @@ -10422,6 +10426,10 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr ho= stdev, } if (src) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_= SCSI)) { + src->nodestorage =3D g_strdup_printf("libvirt-%s-backend",= hostdev->info->alias); + } + if (src->auth) { bool iscsiHasPS =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CA= PS_ISCSI_PASSWORD_SECRET); virSecretUsageType usageType =3D VIR_SECRET_USAGE_TYPE_ISC= SI; --=20 2.26.2