<div dir="ltr"><font face="arial, helvetica, sans-serif">Hi Daniel,</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I have addressed the issues you brought up in the commit titled 'remove superfluous state & omitempty entries' that has been posted to the list.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">--</font></div><div><font face="arial, helvetica, sans-serif">cheers</font></div><div><font face="arial, helvetica, sans-serif">ry</font></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 24, 2017 at 3:47 AM, Daniel P. Berrange <span dir="ltr"><<a href="mailto:berrange@redhat.com" target="_blank">berrange@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Apr 22, 2017 at 02:53:48PM -0700, Ryan Goodfellow wrote:<br>
> This commit adds support for domain features. It does so by introducing<br>
> a new family of types DomainFeature*. The aggregate type<br>
> DomainFeatureList has been added to the Domain type to plumb in the new<br>
> type family. Testing has also been added in domain_test.go<br>
> ---<br>
>  domain.go      | 91 ++++++++++++++++++++++++++++++<wbr>+++++++++++++++++-----------<br>
>  domain_test.go | 55 ++++++++++++++++++++++++++++++<wbr>+++++<br>
>  2 files changed, 130 insertions(+), 16 deletions(-)<br>
><br>
> diff --git a/domain.go b/domain.go<br>
> index cccd9a6..c9ffaef 100644<br>
> --- a/domain.go<br>
> +++ b/domain.go<br>
> @@ -371,23 +371,82 @@ type DomainCPU struct {<br>
>       Features []DomainCPUFeature `xml:"feature"`<br>
>  }<br>
><br>
> +type DomainFeature struct {<br>
> +     State string `xml:"state,attr,omitempty"`<br>
> +}<br>
<br>
</span>There is no 'state' attribute on most top level features - this is just<br>
something used under the hyperv features....<br>
<span class=""><br>
> +<br>
> +type DomainFeatureAPIC struct {<br>
> +     DomainFeature<br>
> +     EOI string `xml:"eio,attr,omitempty"`<br>
> +}<br>
<br>
</span>So this is wrong for example<br>
<span class=""><br>
> +<br>
> +type DomainFeatureVendorId struct {<br>
> +     DomainFeature<br>
> +     Value string `xml:"value,attr,omitempty"`<br>
> +}<br>
> +<br>
> +type DomainFeatureSpinlocks struct {<br>
> +     DomainFeature<br>
> +     Retries uint `xml:"retries,attr,omitempty"`<br>
> +}<br>
<br>
</span>Since these are hyperv featurs, the struct name should have<br>
HyperV in the name too.<br>
<span class=""><br>
> +<br>
> +type DomainFeatureHyperV struct {<br>
> +     DomainFeature<br>
> +     Relaxed   *DomainFeature          `xml:"relaxed,omitempty"`<br>
> +     VAPIC     *DomainFeature          `xml:"vapic,omitempty"`<br>
> +     Spinlocks *DomainFeatureSpinlocks `xml:"spinlocks,omitempty"`<br>
> +     VPIndex   *DomainFeature          `xml:"vpindex,omitempty"`<br>
> +     Runtime   *DomainFeature          `xml:"runtime,omitempty"`<br>
> +     Synic     *DomainFeature          `xml:"synic,omitempty"`<br>
> +     STimer    *DomainFeature          `xml:"stimer,omitempty"`<br>
> +     Reset     *DomainFeature          `xml:"reset,omitempty"`<br>
> +     VendorId  *DomainFeatureVendorId  `xml:"vendor_id,omitempty"`<br>
<br>
</span>There's no need to use 'omitempty' when the type is a struct<br>
pointer - its only needed for scalar types.<br>
<div><div class="h5"><br>
> +}<br>
> +<br>
> +type DomainFeatureKVM struct {<br>
> +     DomainFeature<br>
> +     Hidden *DomainFeature `xml:"hidden,omitempty"`<br>
> +}<br>
> +<br>
> +type DomainFeatureGIC struct {<br>
> +     DomainFeature<br>
> +     Version string `xml:"version,attr,omitempty"`<br>
> +}<br>
> +<br>
> +type DomainFeatureList struct {<br>
> +     PAE        *DomainFeature       `xml:"pae,omitempty"`<br>
> +     ACPI       *DomainFeature       `xml:"acpi,omitempty"`<br>
> +     APIC       *DomainFeatureAPIC   `xml:"apic,omitempty"`<br>
> +     HAP        *DomainFeature       `xml:"hap,omitempty"`<br>
> +     Viridian   *DomainFeature       `xml:"viridian,omitempty"`<br>
> +     PrivNet    *DomainFeature       `xml:"privnet,omitempty"`<br>
> +     HyperV     *DomainFeatureHyperV `xml:"hyperv,omitempty"`<br>
> +     KVM        *DomainFeatureKVM    `xml:"kvm,omitempty"`<br>
> +     PVSpinlock *DomainFeature       `xml:"pvspinlock,omitempty"`<br>
> +     PMU        *DomainFeature       `xml:"pmu,omitempty"`<br>
> +     VMPort     *DomainFeature       `xml:"vmport,omitempty"`<br>
> +     GIC        *DomainFeatureGIC    `xml:"gic,omitempty"`<br>
> +     SMM        *DomainFeature       `xml:"smm,omitempty"`<br>
> +}<br>
<br>
</div></div>None of these should use 'DomainFeature', since they do not<br>
want a 'state' attribute. Also same note about omitempty not<br>
being needed.<br>
<div><div class="h5"><br>
> +<br>
>  type Domain struct {<br>
> -     XMLName       xml.Name          `xml:"domain"`<br>
> -     Type          string            `xml:"type,attr,omitempty"`<br>
> -     Name          string            `xml:"name"`<br>
> -     UUID          string            `xml:"uuid,omitempty"`<br>
> -     Memory        *DomainMemory     `xml:"memory"`<br>
> -     CurrentMemory *DomainMemory     `xml:"currentMemory"`<br>
> -     MaximumMemory *DomainMaxMemory  `xml:"maxMemory"`<br>
> -     VCPU          *DomainVCPU       `xml:"vcpu"`<br>
> -     CPU           *DomainCPU        `xml:"cpu"`<br>
> -     Resource      *DomainResource   `xml:"resource"`<br>
> -     Devices       *DomainDeviceList `xml:"devices"`<br>
> -     OS            *DomainOS         `xml:"os"`<br>
> -     SysInfo       *DomainSysInfo    `xml:"sysinfo"`<br>
> -     OnPoweroff    string            `xml:"on_poweroff,omitempty"`<br>
> -     OnReboot      string            `xml:"on_reboot,omitempty"`<br>
> -     OnCrash       string            `xml:"on_crash,omitempty"`<br>
> +     XMLName       xml.Name           `xml:"domain"`<br>
> +     Type          string             `xml:"type,attr,omitempty"`<br>
> +     Name          string             `xml:"name"`<br>
> +     UUID          string             `xml:"uuid,omitempty"`<br>
> +     Memory        *DomainMemory      `xml:"memory"`<br>
> +     CurrentMemory *DomainMemory      `xml:"currentMemory"`<br>
> +     MaximumMemory *DomainMaxMemory   `xml:"maxMemory"`<br>
> +     VCPU          *DomainVCPU        `xml:"vcpu"`<br>
> +     CPU           *DomainCPU         `xml:"cpu"`<br>
> +     Resource      *DomainResource    `xml:"resource"`<br>
> +     Devices       *DomainDeviceList  `xml:"devices"`<br>
> +     OS            *DomainOS          `xml:"os"`<br>
> +     SysInfo       *DomainSysInfo     `xml:"sysinfo"`<br>
> +     OnPoweroff    string             `xml:"on_poweroff,omitempty"`<br>
> +     OnReboot      string             `xml:"on_reboot,omitempty"`<br>
> +     OnCrash       string             `xml:"on_crash,omitempty"`<br>
> +     Features      *DomainFeatureList `xml:"features,omitempty"`<br>
>  }<br>
<br>
</div></div>Regards,<br>
Daniel<br>
<span class="HOEnZb"><font color="#888888">--<br>
|: <a href="https://berrange.com" rel="noreferrer" target="_blank">https://berrange.com</a>      -o-    <a href="https://www.flickr.com/photos/dberrange" rel="noreferrer" target="_blank">https://www.flickr.com/photos/<wbr>dberrange</a> :|<br>
|: <a href="https://libvirt.org" rel="noreferrer" target="_blank">https://libvirt.org</a>         -o-            <a href="https://fstop138.berrange.com" rel="noreferrer" target="_blank">https://fstop138.berrange.com</a> :|<br>
|: <a href="https://entangle-photo.org" rel="noreferrer" target="_blank">https://entangle-photo.org</a>    -o-    <a href="https://www.instagram.com/dberrange" rel="noreferrer" target="_blank">https://www.instagram.com/<wbr>dberrange</a> :|</font></span></blockquote></div>
</div></div>