On Wed, May 31, 2017 at 09:26:01AM +0100, Daniel P. Berrange wrote:
On Wed, May 31, 2017 at 01:32:47PM +0800, ZhenweiPi wrote:
> ---
>
> domain.go | 13 +++++++++++--
> domain_test.go | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
> 2 files changed, 64 insertions(+), 5 deletions(-)
>
> diff --git a/domain.go b/domain.go
> index 848835a..cbb22e5 100644
> --- a/domain.go
> +++ b/domain.go
> @@ -30,8 +30,10 @@ import (
> )
> type DomainController struct {
> - Type string `xml:"type,attr"`
> - Index string `xml:"index,attr"`
> + Type string `xml:"type,attr"`
> + Index *uint `xml:"index,attr"`
> + Model string `xml:"model,attr,omitempty"`
> + Address *DomainAddress `xml:"address"`
> }
> type DomainDiskSecret struct {
> @@ -77,6 +79,8 @@ type DomainDisk struct {
> Type string `xml:"type,attr"`
> Device string `xml:"device,attr"`
> Snapshot string `xml:"snapshot,attr,omitempty"`
> + Cache string `xml:"cache,attr,omitempty"`
> + Io string `xml:"io,attr,omitempty"`
> Driver *DomainDiskDriver `xml:"driver"`
> Auth *DomainDiskAuth `xml:"auth"`
> Source *DomainDiskSource `xml:"source"`
> @@ -196,8 +200,13 @@ type DomainAlias struct {
> type DomainAddress struct {
> Type string `xml:"type,attr"`
> Controller *uint `xml:"controller,attr"`
> + Domain *uint `xml:"domain,attr"`
> Bus *uint `xml:"bus,attr"`
> Port *uint `xml:"port,attr"`
> + Slot *uint `xml:"slot,attr"`
> + Function *uint `xml:"function,attr"`
> + Target *uint `xml:"target,attr"`
> + Unit *uint `xml:"unit,attr"`
> }
> type DomainChardev struct {
> diff --git a/domain_test.go b/domain_test.go
> index 265cf80..22da947 100644
> --- a/domain_test.go
> +++ b/domain_test.go
> @@ -30,6 +30,16 @@ import (
> "testing"
> )
> +type PciAddress struct {
> + Domain uint
> + Bus uint
> + Slot uint
> + Function uint
> +}
> +
> +var uhciIndex uint = 0
> +var uhciAddr = PciAddress{0, 0, 1, 2}
This struct and variables are rather pointless - just put the values
inline in the one place where they are needed
Oh actually I see they are needed - you can't take the address of a
scalar in go.
I'll apply this patch to git.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|