From nobody Fri May 3 09:48:04 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.zohomail.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 1506474732592403.51581405277; Tue, 26 Sep 2017 18:12:12 -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 D32C8883CA; Wed, 27 Sep 2017 01:12:10 +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 4239B6E8AC; Wed, 27 Sep 2017 01:12:10 +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 92C92410B2; Wed, 27 Sep 2017 01:12:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8R0ubd4020940 for ; Tue, 26 Sep 2017 20:56:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id A4F3F7E49D; Wed, 27 Sep 2017 00:56:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3F877E492; Wed, 27 Sep 2017 00:56:35 +0000 (UTC) Received: from out28-50.mail.aliyun.com (out28-50.mail.aliyun.com [115.124.28.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0DC5C0587C7; Wed, 27 Sep 2017 00:56:30 +0000 (UTC) Received: from 192.168.3.145(mailfrom:zhenwei.pi@youruncloud.com ip:112.95.153.98) by smtp.aliyun-inc.com(10.147.43.95); Wed, 27 Sep 2017 08:56:27 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D32C8883CA 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=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D32C8883CA DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D0DC5C0587C7 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=youruncloud.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=zhenwei.pi@youruncloud.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D0DC5C0587C7 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.0645233|-1; FP=6678412435226547614|1|1|1|0|-1|-1|-1; HT=e02c03299; MF=zhenwei.pi@youruncloud.com; NM=1; PH=DS; RN=2; RT=2; SR=0; TI=SMTPD_---.9-lV4Jp_1506473787; References: <1506391955-26705-1-git-send-email-zhenwei.pi@youruncloud.com> To: "Daniel P. Berrange" From: "Zhenwei.Pi" X-Forwarded-Message-Id: <1506391955-26705-1-git-send-email-zhenwei.pi@youruncloud.com> Message-ID: Date: Wed, 27 Sep 2017 08:54:19 +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: <1506391955-26705-1-git-send-email-zhenwei.pi@youruncloud.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 205 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 27 Sep 2017 00:56:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 27 Sep 2017 00:56:33 +0000 (UTC) for IP:'115.124.28.50' DOMAIN:'out28-50.mail.aliyun.com' HELO:'out28-50.mail.aliyun.com' FROM:'zhenwei.pi@youruncloud.com' RCPT:'' X-RedHat-Spam-Score: -2.809 (RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, UNPARSEABLE_RELAY) 115.124.28.50 out28-50.mail.aliyun.com 115.124.28.50 out28-50.mail.aliyun.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com Subject: [libvirt] [PATCH go-xml] 1, add memoryBacking for domain. 2, add hugepages, nosharepages, locked, source, access and allocation for memoryBacking. 3, add test case for memoryBacking. 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.26]); Wed, 27 Sep 2017 01:12:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8"; format="flowed" Signed-off-by: zhenwei.pi --- domain.go | 76 +++++++++++++++++++++++++++++++++++++++++++----------= ----- domain_test.go | 38 +++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 19 deletions(-) diff --git a/domain.go b/domain.go index d81ac2a..773a83e 100644 --- a/domain.go +++ b/domain.go @@ -459,6 +459,43 @@ type DomainMaxMemory struct { Slots uint `xml:"slots,attr,omitempty"` } =20 +type DomainMemoryHugepage struct { + Size uint `xml:"size,attr"` + Unit string `xml:"unit,attr,omitempty"` + Nodeset string `xml:"nodeset,attr,omitempty"` +} + +type DomainMemoryHugepages struct { + Hugepages []DomainMemoryHugepage `xml:"page"` +} + +type DomainMemoryNosharepages struct { +} + +type DomainMemoryLocked struct { +} + +type DomainMemorySource struct { + Type string `xml:"type,attr,omitempty"` +} + +type DomainMemoryAccess struct { + Mode string `xml:"mode,attr,omitempty"` +} + +type DomainMemoryAllocation struct { + Mode string `xml:"mode,attr,omitempty"` +} + +type DomainMemoryBacking struct { + MemoryHugePages *DomainMemoryHugepages `xml:"hugepages"` + MemoryNosharepages *DomainMemoryNosharepages `xml:"nosharepages"` + MemoryLocked *DomainMemoryLocked `xml:"locked"` + MemorySource *DomainMemorySource `xml:"source"` + MemoryAccess *DomainMemoryAccess `xml:"access"` + MemoryAllocation *DomainMemoryAllocation `xml:"allocation"` +} + type DomainOSType struct { Arch string `xml:"arch,attr,omitempty"` Machine string `xml:"machine,attr,omitempty"` @@ -681,25 +718,26 @@ type DomainQEMUCommandline struct { // matching the order of XML elements that libvirt // will generate when dumping XML. type Domain struct { - XMLName xml.Name `xml:"domain"` - Type string `xml:"type,attr,omitempty"` - Name string `xml:"name"` - UUID string `xml:"uuid,omitempty"` - Memory *DomainMemory `xml:"memory"` - CurrentMemory *DomainMemory `xml:"currentMemory"` - MaximumMemory *DomainMaxMemory `xml:"maxMemory"` - VCPU *DomainVCPU `xml:"vcpu"` - VCPUs *DomainVCPUs `xml:"vcpus"` - Resource *DomainResource `xml:"resource"` - SysInfo *DomainSysInfo `xml:"sysinfo"` - OS *DomainOS `xml:"os"` - Features *DomainFeatureList `xml:"features"` - CPU *DomainCPU `xml:"cpu"` - Clock *DomainClock `xml:"clock,omitempty"` - OnPoweroff string `xml:"on_poweroff,omitempty"` - OnReboot string `xml:"on_reboot,omitempty"` - OnCrash string `xml:"on_crash,omitempty"` - Devices *DomainDeviceList `xml:"devices"` + XMLName xml.Name `xml:"domain"` + Type string `xml:"type,attr,omitempty"` + Name string `xml:"name"` + UUID string `xml:"uuid,omitempty"` + Memory *DomainMemory `xml:"memory"` + CurrentMemory *DomainMemory `xml:"currentMemory"` + MaximumMemory *DomainMaxMemory `xml:"maxMemory"` + MemoryBacking *DomainMemoryBacking `xml:"memoryBacking"` + VCPU *DomainVCPU `xml:"vcpu"` + VCPUs *DomainVCPUs `xml:"vcpus"` + Resource *DomainResource `xml:"resource"` + SysInfo *DomainSysInfo `xml:"sysinfo"` + OS *DomainOS `xml:"os"` + Features *DomainFeatureList `xml:"features"` + CPU *DomainCPU `xml:"cpu"` + Clock *DomainClock `xml:"clock,omitempty"` + OnPoweroff string `xml:"on_poweroff,omitempty"` + OnReboot string `xml:"on_reboot,omitempty"` + OnCrash string `xml:"on_crash,omitempty"` + Devices *DomainDeviceList `xml:"devices"` QEMUCommandline *DomainQEMUCommandline } =20 diff --git a/domain_test.go b/domain_test.go index 3ff1dc1..51d413b 100644 --- a/domain_test.go +++ b/domain_test.go @@ -435,6 +435,33 @@ var domainTestData =3D []struct { Value: 16384, Slots: 2, }, + MemoryBacking: &DomainMemoryBacking{ + MemoryHugePages: &DomainMemoryHugepages{ + Hugepages: []DomainMemoryHugepage{ + { + Size: 1, + Unit: "G", + Nodeset: "0-3,5", + }, + { + Size: 2, + Unit: "M", + Nodeset: "4", + }, + }, + }, + MemoryNosharepages: &DomainMemoryNosharepages{}, + MemoryLocked: &DomainMemoryLocked{}, + MemorySource: &DomainMemorySource{ + Type: "file|anonymous", + }, + MemoryAccess: &DomainMemoryAccess{ + Mode: "shared|private", + }, + MemoryAllocation: &DomainMemoryAllocation{ + Mode: "immediate|ondemand", + }, + }, OS: &DomainOS{ Type: &DomainOSType{ Arch: "x86_64", @@ -532,6 +559,17 @@ var domainTestData =3D []struct { ` 8192`, ` 4096`, ` 16384`, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, ` `, ` `, ` manufacturer`, --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list