From nobody Sat Apr 27 11:44:26 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; dkim=fail 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 1492936005862347.88825689060036; Sun, 23 Apr 2017 01:26:45 -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 078F47AEA4; Sun, 23 Apr 2017 08:26:44 +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 D5D42183C3; Sun, 23 Apr 2017 08:26:43 +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 F15071853D1F; Sun, 23 Apr 2017 08:26:28 +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 v3MLsW8T026940 for ; Sat, 22 Apr 2017 17:54:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 631A37EBDE; Sat, 22 Apr 2017 21:54:32 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B07E7EBDA for ; Sat, 22 Apr 2017 21:54:30 +0000 (UTC) Received: from mail-io0-f193.google.com (mail-io0-f193.google.com [209.85.223.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C591746D096 for ; Sat, 22 Apr 2017 21:54:28 +0000 (UTC) Received: by mail-io0-f193.google.com with SMTP id k87so38593828ioi.0 for ; Sat, 22 Apr 2017 14:54:28 -0700 (PDT) Received: from abby.goodwu.net ([2602:306:c5a7:aed9:178:e451:3aa8:847c]) by smtp.gmail.com with ESMTPSA id 21sm22935831pfl.129.2017.04.22.14.54.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Apr 2017 14:54:27 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 078F47AEA4 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=isi.edu Authentication-Results: ext-mx01.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 078F47AEA4 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=isi-edu.20150623.gappssmtp.com header.i=@isi-edu.20150623.gappssmtp.com header.b="pUG/Pc89" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C591746D096 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=isi.edu Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=rgoodfel@isi.edu DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C591746D096 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isi-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=xw4N6iotJS4obegcPZ2GzbfDD8RV84NNWv5DDUs/2J0=; b=pUG/Pc89aMClBd+wSM2e18LemV/NHCeJLkwz6xCPvvz0LBP3qHxhuN6lVD6JuNLoq5 5Jo3KzN+jQ053CjX2mnZeLyMpPRP0HEPQ9ay4bxTxPMcMiHOYR1nsaeq4p9168ZpNCKS 89/+TivhPMCoodllc2/cXFNKQj830AG62w0AYQNGP273pr1uVp3WsbuP3WnEJB4GHQrc uDaXuUIXhOOiPY3SrBiBofkS9iXYMATncqkQo1PgR+b3zd4bzwGI4WqR4osm1Yc7ouk/ d9QFxDSEZttZdCdG97cwrhoFcP2PNVAehwMtaLQ87hc47kexNGHyGtdODPQpolxmcmdK OK7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xw4N6iotJS4obegcPZ2GzbfDD8RV84NNWv5DDUs/2J0=; b=myw4eJ3g8ueuDM+iILmyyZJPIXyOIMAVYZ1K9Y3VUzBOePp/g9bQyVrKYkoegPlJBy 1oD7oH63+QT4wEJYG52/SyQvAUiBbasiacIiyBrx3eEohhoHigUQVHMxhd6yPvEljXvB 2eu2c2dLOqnH5KcTzKUdXE4EHn2iUe6+x4JqIX1712uWzLoTpjAeTA3uMN5SDD7Z98v3 VkPeyO86y7TRMBDuOy6Z0BxuFRDTE1L8gzgh8PNDliYyATB9KgA4uk/OXc4G1ynN+hcb RV5VACvZCK1RaXxI0Grh2GxTCisGJA/Sh0yG8/cKoQMQ79N0F2DIkpFHGuiv5bdnn9Xz D/AQ== X-Gm-Message-State: AN3rC/45/oduZ/5CeTvzLVCvNgc/AnUmy45CSV/0tSPdNj4jcP1eaa8p ZKj4gl8VLUziJn2qX+I= X-Received: by 10.98.109.67 with SMTP id i64mr18236323pfc.58.1492898067913; Sat, 22 Apr 2017 14:54:27 -0700 (PDT) From: Ryan Goodfellow To: libvir-list@redhat.com Date: Sat, 22 Apr 2017 14:53:48 -0700 Message-Id: <20170422215348.12903-1-rgoodfel@isi.edu> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 22 Apr 2017 21:54:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 22 Apr 2017 21:54:29 +0000 (UTC) for IP:'209.85.223.193' DOMAIN:'mail-io0-f193.google.com' HELO:'mail-io0-f193.google.com' FROM:'rgoodfel@isi.edu' RCPT:'' X-RedHat-Spam-Score: -1.51 (BAYES_50, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM) 209.85.223.193 mail-io0-f193.google.com 209.85.223.193 mail-io0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Ryan Goodfellow Subject: [libvirt] [PATCH go-xml] add support for domain features 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Sun, 23 Apr 2017 08:26:44 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit adds support for domain features. It does so by introducing a new family of types DomainFeature*. The aggregate type DomainFeatureList has been added to the Domain type to plumb in the new type family. Testing has also been added in domain_test.go --- domain.go | 91 +++++++++++++++++++++++++++++++++++++++++++++++-------= ---- domain_test.go | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 16 deletions(-) diff --git a/domain.go b/domain.go index cccd9a6..c9ffaef 100644 --- a/domain.go +++ b/domain.go @@ -371,23 +371,82 @@ type DomainCPU struct { Features []DomainCPUFeature `xml:"feature"` } =20 +type DomainFeature struct { + State string `xml:"state,attr,omitempty"` +} + +type DomainFeatureAPIC struct { + DomainFeature + EOI string `xml:"eio,attr,omitempty"` +} + +type DomainFeatureVendorId struct { + DomainFeature + Value string `xml:"value,attr,omitempty"` +} + +type DomainFeatureSpinlocks struct { + DomainFeature + Retries uint `xml:"retries,attr,omitempty"` +} + +type DomainFeatureHyperV struct { + DomainFeature + Relaxed *DomainFeature `xml:"relaxed,omitempty"` + VAPIC *DomainFeature `xml:"vapic,omitempty"` + Spinlocks *DomainFeatureSpinlocks `xml:"spinlocks,omitempty"` + VPIndex *DomainFeature `xml:"vpindex,omitempty"` + Runtime *DomainFeature `xml:"runtime,omitempty"` + Synic *DomainFeature `xml:"synic,omitempty"` + STimer *DomainFeature `xml:"stimer,omitempty"` + Reset *DomainFeature `xml:"reset,omitempty"` + VendorId *DomainFeatureVendorId `xml:"vendor_id,omitempty"` +} + +type DomainFeatureKVM struct { + DomainFeature + Hidden *DomainFeature `xml:"hidden,omitempty"` +} + +type DomainFeatureGIC struct { + DomainFeature + Version string `xml:"version,attr,omitempty"` +} + +type DomainFeatureList struct { + PAE *DomainFeature `xml:"pae,omitempty"` + ACPI *DomainFeature `xml:"acpi,omitempty"` + APIC *DomainFeatureAPIC `xml:"apic,omitempty"` + HAP *DomainFeature `xml:"hap,omitempty"` + Viridian *DomainFeature `xml:"viridian,omitempty"` + PrivNet *DomainFeature `xml:"privnet,omitempty"` + HyperV *DomainFeatureHyperV `xml:"hyperv,omitempty"` + KVM *DomainFeatureKVM `xml:"kvm,omitempty"` + PVSpinlock *DomainFeature `xml:"pvspinlock,omitempty"` + PMU *DomainFeature `xml:"pmu,omitempty"` + VMPort *DomainFeature `xml:"vmport,omitempty"` + GIC *DomainFeatureGIC `xml:"gic,omitempty"` + SMM *DomainFeature `xml:"smm,omitempty"` +} + 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"` - CPU *DomainCPU `xml:"cpu"` - Resource *DomainResource `xml:"resource"` - Devices *DomainDeviceList `xml:"devices"` - OS *DomainOS `xml:"os"` - SysInfo *DomainSysInfo `xml:"sysinfo"` - OnPoweroff string `xml:"on_poweroff,omitempty"` - OnReboot string `xml:"on_reboot,omitempty"` - OnCrash string `xml:"on_crash,omitempty"` + 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"` + CPU *DomainCPU `xml:"cpu"` + Resource *DomainResource `xml:"resource"` + Devices *DomainDeviceList `xml:"devices"` + OS *DomainOS `xml:"os"` + SysInfo *DomainSysInfo `xml:"sysinfo"` + OnPoweroff string `xml:"on_poweroff,omitempty"` + OnReboot string `xml:"on_reboot,omitempty"` + OnCrash string `xml:"on_crash,omitempty"` + Features *DomainFeatureList `xml:"features,omitempty"` } =20 func (d *Domain) Unmarshal(doc string) error { diff --git a/domain_test.go b/domain_test.go index 06d585c..e25007e 100644 --- a/domain_test.go +++ b/domain_test.go @@ -745,6 +745,61 @@ var domainTestData =3D []struct { ``, }, }, + { + Object: &Domain{ + Type: "kvm", + Name: "test", + Features: &DomainFeatureList{ + PAE: &DomainFeature{}, + ACPI: &DomainFeature{}, + APIC: &DomainFeatureAPIC{}, + HAP: &DomainFeature{}, + PrivNet: &DomainFeature{}, + HyperV: &DomainFeatureHyperV{ + Relaxed: &DomainFeature{State: "on"}, + VAPIC: &DomainFeature{State: "on"}, + Spinlocks: &DomainFeatureSpinlocks{DomainFeature{State: "on"}, 4096}, + VPIndex: &DomainFeature{State: "on"}, + Runtime: &DomainFeature{State: "on"}, + Synic: &DomainFeature{State: "on"}, + Reset: &DomainFeature{State: "on"}, + VendorId: &DomainFeatureVendorId{DomainFeature{State: "on"}, "KVM Hv= "}, + }, + KVM: &DomainFeatureKVM{ + Hidden: &DomainFeature{State: "on"}, + }, + PVSpinlock: &DomainFeature{State: "on"}, + GIC: &DomainFeatureGIC{Version: "2"}, + }, + }, + Expected: []string{ + ``, + ` test`, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ``, + }, + }, } =20 func TestDomain(t *testing.T) { --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list