From nobody Sun May 5 16:51:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496208805289691.8452471723717; Tue, 30 May 2017 22:33:25 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 7DB9D811AC; Wed, 31 May 2017 05:33:22 +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 6494817D52; Wed, 31 May 2017 05:33:20 +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 0B9D64BB7F; Wed, 31 May 2017 05:33:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4V5XFfa011067 for ; Wed, 31 May 2017 01:33:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 369B45C7B1; Wed, 31 May 2017 05:33:15 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A76A1964B; Wed, 31 May 2017 05:33:12 +0000 (UTC) Received: from out28-27.mail.aliyun.com (out28-27.mail.aliyun.com [115.124.28.27]) by mx1.redhat.com (Postfix) with ESMTP id 0A4D980C07; Wed, 31 May 2017 05:33:08 +0000 (UTC) Received: from 192.168.3.53(mailfrom:zhenwei.pi@youruncloud.com ip:112.95.153.98) by smtp.aliyun-inc.com(10.147.41.178); Wed, 31 May 2017 13:33:05 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7DB9D811AC Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=youruncloud.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7DB9D811AC DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0A4D980C07 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=youruncloud.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=zhenwei.pi@youruncloud.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0A4D980C07 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.07445693|-1; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03309; MF=zhenwei.pi@youruncloud.com; NM=1; PH=DS; RN=2; RT=2; SR=0; TI=SMTPD_---.88iqmsb_1496208767; References: <1495850277-32656-1-git-send-email-zhenwei.pi@youruncloud.com> To: libvir-list@redhat.com, "Daniel P. Berrange" From: ZhenweiPi X-Forwarded-Message-Id: <1495850277-32656-1-git-send-email-zhenwei.pi@youruncloud.com> Message-ID: Date: Wed, 31 May 2017 13:32:47 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1495850277-32656-1-git-send-email-zhenwei.pi@youruncloud.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 31 May 2017 05:33:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 31 May 2017 05:33:11 +0000 (UTC) for IP:'115.124.28.27' DOMAIN:'out28-27.mail.aliyun.com' HELO:'out28-27.mail.aliyun.com' FROM:'zhenwei.pi@youruncloud.com' RCPT:'' X-RedHat-Spam-Score: 0.291 (BAYES_99, DCC_REPUT_00_12, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, UNPARSEABLE_RELAY) 115.124.28.27 out28-27.mail.aliyun.com 115.124.28.27 out28-27.mail.aliyun.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH go-xml] 1, add support for disk cache and io, and add test case. 2, add support for controller model, and add test case. 3, extend DomainAddress struct for PCI address and target&unit, and add test cases. 4, modify DomainController:Index type from string to *uint. 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 31 May 2017 05:33:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8"; format="flowed" --- domain.go | 13 +++++++++++-- domain_test.go | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++= --- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/domain.go b/domain.go index 848835a..cbb22e5 100644 --- a/domain.go +++ b/domain.go @@ -30,8 +30,10 @@ import ( ) =20 type DomainController struct { - Type string `xml:"type,attr"` - Index string `xml:"index,attr"` + Type string `xml:"type,attr"` + Index *uint `xml:"index,attr"` + Model string `xml:"model,attr,omitempty"` + Address *DomainAddress `xml:"address"` } =20 type DomainDiskSecret struct { @@ -77,6 +79,8 @@ type DomainDisk struct { Type string `xml:"type,attr"` Device string `xml:"device,attr"` Snapshot string `xml:"snapshot,attr,omitempty"` + Cache string `xml:"cache,attr,omitempty"` + Io string `xml:"io,attr,omitempty"` Driver *DomainDiskDriver `xml:"driver"` Auth *DomainDiskAuth `xml:"auth"` Source *DomainDiskSource `xml:"source"` @@ -196,8 +200,13 @@ type DomainAlias struct { type DomainAddress struct { Type string `xml:"type,attr"` Controller *uint `xml:"controller,attr"` + Domain *uint `xml:"domain,attr"` Bus *uint `xml:"bus,attr"` Port *uint `xml:"port,attr"` + Slot *uint `xml:"slot,attr"` + Function *uint `xml:"function,attr"` + Target *uint `xml:"target,attr"` + Unit *uint `xml:"unit,attr"` } =20 type DomainChardev struct { diff --git a/domain_test.go b/domain_test.go index 265cf80..22da947 100644 --- a/domain_test.go +++ b/domain_test.go @@ -30,6 +30,16 @@ import ( "testing" ) =20 +type PciAddress struct { + Domain uint + Bus uint + Slot uint + Function uint +} + +var uhciIndex uint =3D 0 +var uhciAddr =3D PciAddress{0, 0, 1, 2} + var domainTestData =3D []struct { Object *Domain Expected []string @@ -130,10 +140,12 @@ var domainTestData =3D []struct { }, }, DomainDisk{ - Type: "volume", + Type: "volume", Device: "cdrom", + Cache: "none", + Io: "native", Source: &DomainDiskSource{ - Pool: "default", + Pool: "default", Volume: "myvolume", }, Target: &DomainDiskTarget{ @@ -174,7 +186,7 @@ var domainTestData =3D []struct { ` `, ` `, ` `, - ` `, + ` `, ` `, ` `, ` `, @@ -820,6 +832,44 @@ var domainTestData =3D []struct { ``, }, }, + { + Object: &Domain{ + Type: "kvm", + Name: "test", + Devices: &DomainDeviceList{ + Controllers: []DomainController{ + DomainController{ + Type: "usb", + Index: &uhciIndex, + Model: "piix3-uhci", + Address: &DomainAddress{ + Type: "pci", + Domain: &uhciAddr.Domain, + Bus: &uhciAddr.Bus, + Slot: &uhciAddr.Slot, + Function: &uhciAddr.Function, + }, + }, + DomainController{ + Type: "usb", + Index: nil, + Model: "ehci", + }, + }, + }, + }, + Expected: []string{ + ``, + ` test`, + ` `, + ` `, + `
`, + `
`, + ` `, + `
`, + `
`, + }, + }, } =20 func TestDomain(t *testing.T) { --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list