From nobody Wed May 8 01:51:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1579174914; cv=none; d=zohomail.com; s=zohoarc; b=en1B6rPi6QqONek0KYMfTUUXTp2aK1ZsSO0ijcfCJEnyelV4Nhz1vCsikdxRG3mr2vKVQo6PTRp19GN3Ctsc7uwj8k3dW5z91vJY7ILejZvK0HQ7KBCFLdQv1YJsCDTGv+/MQEtBUxhNZM2apZTqIVT0Zvb3s2z2WBSOv7eZwNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579174914; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=iFJvtLf1Cy2OSej24SHxzMyFvel8/olHchDkQrxwkow=; b=i05wmZmplaXG1YlfWO1R7kbz+oXHw5QvbAxu4hbbqunM7S6btLeBK7nLylMJ+t9EbukBKIGn9XuQSGtAMLYWf5OZXuu62tg+y30i+oWH6RlRHZmoZyeVrn9N61G8Stpafmh3Wfvs9RnOPPn0TV0UM/VnAE8IC+oytMN8xrHtfto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 157917491456171.40883212675351; Thu, 16 Jan 2020 03:41:54 -0800 (PST) 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-284-AnHFhVeINieMgrD934RVGA-1; Thu, 16 Jan 2020 06:41:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EA4D0190B2A0; Thu, 16 Jan 2020 11:41:44 +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 92DDF5E240; Thu, 16 Jan 2020 11:41:44 +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 BF83F18184BC; Thu, 16 Jan 2020 11:41:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00GBfgbF009760 for ; Thu, 16 Jan 2020 06:41:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 01326952F2; Thu, 16 Jan 2020 11:41:42 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C60861073 for ; Thu, 16 Jan 2020 11:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579174913; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iFJvtLf1Cy2OSej24SHxzMyFvel8/olHchDkQrxwkow=; b=ZdPjh8ypVlsUyrrBGNdWJVXt7KKsh9Q4Hh/XxJ6EY7eAMXEqAwxaGv2oIejWV1iMBFxw3o f97UlZ8TOB00hjEYB5jVjlRJfe9hATdtBVSusbkhsEHFcWZupyxCdLFGVa7+QW4RnA1dXB TK075XD6UlpuNGFGFLTrX7nveK//1j0= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 16 Jan 2020 12:41:37 +0100 Message-Id: <775f2b204bd9e318d3153380a7c6addeb1256b6f.1579174897.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] util: storagefile: Properly set transport type when parsing NBD strings 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.14 X-MC-Unique: AnHFhVeINieMgrD934RVGA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When parsing legacy NBD backing file strings such as 'nbd:unix:/tmp/sock:exportname=3D/' we'd fail to set the transport to VIR_STORAGE_NET_HOST_TRANS_UNIX. This started to be a problem once we actually started to generate config of the backing store on the command line with -blockdev as the JSON code would try to format it as TCP and fail with: internal error: argument key 'host' must not have null value Set the type properly and add a test. This bug was found by the libguestfs test suite in: https://bugzilla.redhat.com/show_bug.cgi?id=3D1791614 Signed-off-by: Peter Krempa Reported-by: Ming Xie Reviewed-by: Eric Blake Tested-by: Richard W.M. Jones --- src/util/virstoragefile.c | 2 +- tests/virstoragetest.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 1397f532fd..7a2af0ad94 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2964,7 +2964,7 @@ virStorageSourceParseNBDColonString(const char *nbdst= r, } src->hosts->socket =3D g_strdup(backing[2]); - + src->hosts->transport =3D VIR_STORAGE_NET_HOST_TRANS_UNIX; } else { src->hosts->name =3D g_strdup(backing[1]); diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 2862758752..370e19252b 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -1258,6 +1258,10 @@ mymain(void) "\n" " \n" "\n"); + TEST_BACKING_PARSE("nbd:unix:/tmp/sock:exportname=3D/", + "\n" + " \= n" + "\n"); TEST_BACKING_PARSE("nbd://example.org:1234", "\n" " \n" --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list