From patchwork Tue Feb 16 17:44:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 62069 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1807604lbl; Tue, 16 Feb 2016 09:47:39 -0800 (PST) X-Received: by 10.140.178.195 with SMTP id y186mr30506382qhy.100.1455644859861; Tue, 16 Feb 2016 09:47:39 -0800 (PST) Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com. [209.132.183.37]) by mx.google.com with ESMTPS id x145si41624608qka.105.2016.02.16.09.47.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Feb 2016 09:47:39 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1GHj5Mp061889; Tue, 16 Feb 2016 12:45:05 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u1GHiaY3015510 for ; Tue, 16 Feb 2016 12:44:36 -0500 Received: from colepc.redhat.com (ovpn-113-23.phx2.redhat.com [10.3.113.23]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1GHiX44011999; Tue, 16 Feb 2016 12:44:35 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 16 Feb 2016 12:44:30 -0500 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] tests: qemuargv2xml: hardcode disk auth usage 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com If a qemuargv has iscsi or ceph secrets on the command line, we will convert that to XML like: This is not valid XML, as either a UUID or usage must be specified in the secret block. It's not clear though how the argv2xml code can do anything correct here, since XML like this requires a libvirt secret object to have already been defined. The current test suite handles this by blanking out any block in the XML. This avoids domainschematest failures. Instead of blanking, let's hardcode a usage= name. This lets us test the other bits of generated XML, and is a step towards wiring up VIR_TEST_REGENERATE_OUTPUT --- .../qemuargv2xml-disk-drive-network-iscsi-auth.xml | 2 +- .../qemuargv2xml-disk-drive-network-rbd-auth.xml | 2 +- tests/qemuargv2xmltest.c | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml index 5ac4abf..35b3abc 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-iscsi-auth.xml @@ -17,7 +17,7 @@ - + diff --git a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml index ac2e942..4db031b 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-disk-drive-network-rbd-auth.xml @@ -23,7 +23,7 @@ - + diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 6650cf0..8e0e711 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -24,7 +24,6 @@ static virQEMUDriver driver; static int blankProblemElements(char *data) { if (virtTestClearLineRegex("[[:digit:]]+", data) < 0 || - virtTestClearLineRegex("", data) < 0 || virtTestClearLineRegex("[[:digit:]]+", data) < 0) return -1; @@ -33,12 +32,26 @@ static int blankProblemElements(char *data) static int testSanitizeDef(virDomainDefPtr vmdef) { + size_t i = 0; int ret = -1; /* Remove UUID randomness */ if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", vmdef->uuid) < 0) goto fail; + /* qemuargv2xml doesn't know what to set for a secret usage/uuid, + * so hardcode usage='qemuargv2xml_usage' to appead the schema checker */ + for (i = 0; i < vmdef->ndisks; i++) { + virDomainDiskDefPtr disk = vmdef->disks[i]; + + if (disk->src->auth) { + disk->src->auth->secretType = VIR_STORAGE_SECRET_TYPE_USAGE; + if (VIR_STRDUP(disk->src->auth->secret.usage, + "qemuargv2xml_usage") < 0) + goto fail; + } + } + ret = 0; fail: return ret;