From nobody Fri May 3 12:48:51 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 1506328532638165.1708571174761; Mon, 25 Sep 2017 01:35:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56B6B6147E; Mon, 25 Sep 2017 08:35:30 +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 839D658824; Mon, 25 Sep 2017 08:35:28 +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 8E820180884A; Mon, 25 Sep 2017 08:35:24 +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 v8P8LPIw022184 for ; Mon, 25 Sep 2017 04:21:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD562619B8; Mon, 25 Sep 2017 08:21:25 +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 1A3C8619A8; Mon, 25 Sep 2017 08:21:23 +0000 (UTC) Received: from out28-2.mail.aliyun.com (out28-2.mail.aliyun.com [115.124.28.2]) (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 5394D85547; Mon, 25 Sep 2017 08:21:19 +0000 (UTC) Received: from localhost.localdomain(mailfrom:zhenwei.pi@youruncloud.com ip:112.95.153.98) by smtp.aliyun-inc.com(10.147.42.135); Mon, 25 Sep 2017 16:21:15 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 56B6B6147E Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=youruncloud.com Authentication-Results: ext-mx10.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 56B6B6147E DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5394D85547 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 5394D85547 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.06807435|-1; FP=0|0|0|0|0|-1|-1|-1; HT=e02c03307; MF=zhenwei.pi@youruncloud.com; NM=1; PH=DS; RN=3; RT=3; SR=0; TI=SMTPD_---.8zuJqbK_1506327675; From: "zhenwei.pi" To: berrange@redhat.com, libvir-list@redhat.com Date: Mon, 25 Sep 2017 16:21:14 +0800 Message-Id: <1506327674-14539-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]); Mon, 25 Sep 2017 08:21:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 25 Sep 2017 08:21:22 +0000 (UTC) for IP:'115.124.28.2' DOMAIN:'out28-2.mail.aliyun.com' HELO:'out28-2.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.2 out28-2.mail.aliyun.com 115.124.28.2 out28-2.mail.aliyun.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: zhenwei.pi@youruncloud.com Subject: [libvirt] [PATCH go-xml] add VCPUs support in Domain 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 25 Sep 2017 08:35:31 +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 | 12 ++++++++++++ domain_test.go | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/domain.go b/domain.go index 3ab54a1..d81ac2a 100644 --- a/domain.go +++ b/domain.go @@ -533,6 +533,17 @@ type DomainVCPU struct { Value int `xml:",chardata"` } =20 +type DomainVCPUsVCPU struct { + Id *uint `xml:"id,attr,omitempty"` + Enabled string `xml:"enabled,attr,omitempty"` + Hotpluggable string `xml:"hotpluggable,attr,omitempty"` + Order *uint `xml:"order,attr,omitempty"` +} + +type DomainVCPUs struct { + VCPU []DomainVCPUsVCPU `xml:"vcpu"` +} + type DomainCPUModel struct { Fallback string `xml:"fallback,attr,omitempty"` Value string `xml:",chardata"` @@ -678,6 +689,7 @@ type Domain struct { 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"` diff --git a/domain_test.go b/domain_test.go index 0ae9594..3ff1dc1 100644 --- a/domain_test.go +++ b/domain_test.go @@ -62,6 +62,10 @@ var tabletPort uint =3D 1 var nicAverage int =3D 1000 var nicBurst int =3D 10000 =20 +var vcpuId0 uint =3D 0 +var vcpuOrder0 uint =3D 1 +var vcpuId1 uint =3D 1 + var domainTestData =3D []struct { Object Document Expected []string @@ -635,6 +639,22 @@ var domainTestData =3D []struct { Current: "1", Value: 2, }, + VCPUs: &DomainVCPUs{ + VCPU: []DomainVCPUsVCPU{ + DomainVCPUsVCPU{ + Id: &vcpuId0, + Enabled: "yes", + Hotpluggable: "no", + Order: &vcpuOrder0, + }, + DomainVCPUsVCPU{ + Id: &vcpuId1, + Enabled: "no", + Hotpluggable: "yes", + Order: nil, + }, + }, + }, Devices: &DomainDeviceList{ Interfaces: []DomainInterface{ DomainInterface{ @@ -656,6 +676,10 @@ var domainTestData =3D []struct { ``, ` test`, ` 2`, + ` `, + ` `, + ` `, + ` `, ` `, ` `, ` `, --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list