From nobody Thu May 2 06:21:31 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 1506393316150181.76182261127838; Mon, 25 Sep 2017 19:35:16 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id D7E6CC0587F2; Tue, 26 Sep 2017 02:35:09 +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 04AC06D7E1; Tue, 26 Sep 2017 02:35:09 +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 76F734EE4F; Tue, 26 Sep 2017 02:35:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8Q2CuMW015746 for ; Mon, 25 Sep 2017 22:12:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8CD066A517; Tue, 26 Sep 2017 02:12:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B3B236A568; Tue, 26 Sep 2017 02:12:54 +0000 (UTC) Received: from out28-218.mail.aliyun.com (out28-218.mail.aliyun.com [115.124.28.218]) (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 49ED080468; Tue, 26 Sep 2017 02:12:50 +0000 (UTC) Received: from localhost.localdomain(mailfrom:zhenwei.pi@youruncloud.com ip:112.95.153.98) by smtp.aliyun-inc.com(10.147.40.200); Tue, 26 Sep 2017 10:12:41 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D7E6CC0587F2 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=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D7E6CC0587F2 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 49ED080468 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=youruncloud.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=zhenwei.pi@youruncloud.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 49ED080468 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.0645233|-1; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03310; MF=zhenwei.pi@youruncloud.com; NM=1; PH=DS; RN=3; RT=3; SR=0; TI=SMTPD_---.9-FoSyl_1506391961; From: "zhenwei.pi" To: berrange@redhat.com, libvir-list@redhat.com Date: Tue, 26 Sep 2017 10:12:35 +0800 Message-Id: <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.28]); Tue, 26 Sep 2017 02:12:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 26 Sep 2017 02:12:53 +0000 (UTC) for IP:'115.124.28.218' DOMAIN:'out28-218.mail.aliyun.com' HELO:'out28-218.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.218 out28-218.mail.aliyun.com 115.124.28.218 out28-218.mail.aliyun.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: zhenwei.pi@youruncloud.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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 26 Sep 2017 02:35:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: zhenwei.pi Reviewed-by: Daniel P. Berrange --- 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