[libvirt] [go-xml PATCH 0/2] Fix libvirt-go-xml test CI

Patch 1 is a nearby 'fix' Patch 2 fixes the CI for the new address type='unassigned' Cole Robinson (2): Fix virtio-s390 address lookup Support domain address type='unassigned' domain.go | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) -- 2.23.0

It was comparing against spapr-vio Signed-off-by: Cole Robinson <crobinso@redhat.com> --- All this virtio-s390 stuff is kinda bogus though, because it is never actually output in libvirt XML. domain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain.go b/domain.go index 8c4d7a4..7552c4b 100644 --- a/domain.go +++ b/domain.go @@ -5145,7 +5145,7 @@ func (a *DomainAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) err } else if typ == "ccid" { a.CCID = &DomainAddressCCID{} return d.DecodeElement(a.CCID, &start) - } else if typ == "spapr-vio" { + } else if typ == "virtio-s390" { a.VirtioS390 = &DomainAddressVirtioS390{} return d.DecodeElement(a.VirtioS390, &start) } -- 2.23.0

On Fri, Dec 20, 2019 at 05:22:25PM -0500, Cole Robinson wrote:
It was comparing against spapr-vio
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- All this virtio-s390 stuff is kinda bogus though, because it is never actually output in libvirt XML.
Hmm, I wonder what I was thinking when i added that. I guess we can just delete it all.
domain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/domain.go b/domain.go index 8c4d7a4..7552c4b 100644 --- a/domain.go +++ b/domain.go @@ -5145,7 +5145,7 @@ func (a *DomainAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) err } else if typ == "ccid" { a.CCID = &DomainAddressCCID{} return d.DecodeElement(a.CCID, &start) - } else if typ == "spapr-vio" { + } else if typ == "virtio-s390" { a.VirtioS390 = &DomainAddressVirtioS390{} return d.DecodeElement(a.VirtioS390, &start) } -- 2.23.0
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
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 :|

On 12/23/19 5:02 AM, Daniel P. Berrangé wrote:
On Fri, Dec 20, 2019 at 05:22:25PM -0500, Cole Robinson wrote:
It was comparing against spapr-vio
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- All this virtio-s390 stuff is kinda bogus though, because it is never actually output in libvirt XML.
Hmm, I wonder what I was thinking when i added that. I guess we can just delete it all.
There's an argument for removing virtio-s390 from libvirt entirely (not the XML bit, but the qemu implementation) Unclear if any supported distros even support it anymore, it's been removed from qemu for a few years IIRC (non-ccw virtio machine type) - Cole

Signed-off-by: Cole Robinson <crobinso@redhat.com> --- This should fix the libvirt-go-xml CI domain.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/domain.go b/domain.go index 7552c4b..c290003 100644 --- a/domain.go +++ b/domain.go @@ -887,6 +887,9 @@ type DomainAddressCCID struct { type DomainAddressVirtioS390 struct { } +type DomainAddressUnassigned struct { +} + type DomainAddress struct { PCI *DomainAddressPCI Drive *DomainAddressDrive @@ -899,6 +902,7 @@ type DomainAddress struct { VirtioMMIO *DomainAddressVirtioMMIO ISA *DomainAddressISA DIMM *DomainAddressDIMM + Unassigned *DomainAddressUnassigned } type DomainChardevLog struct { @@ -4801,6 +4805,12 @@ func (a *DomainAddressVirtioS390) MarshalXML(e *xml.Encoder, start xml.StartElem return nil } +func (a *DomainAddressUnassigned) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + e.EncodeToken(start) + e.EncodeToken(start.End()) + return nil +} + func (a *DomainAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error { if a.USB != nil { start.Attr = append(start.Attr, xml.Attr{ @@ -4857,6 +4867,11 @@ func (a *DomainAddress) MarshalXML(e *xml.Encoder, start xml.StartElement) error xml.Name{Local: "type"}, "virtio-s390", }) return e.EncodeElement(a.VirtioS390, start) + } else if a.Unassigned != nil { + start.Attr = append(start.Attr, xml.Attr{ + xml.Name{Local: "type"}, "unassigned", + }) + return e.EncodeElement(a.Unassigned, start) } else { return nil } @@ -5102,6 +5117,11 @@ func (a *DomainAddressVirtioS390) UnmarshalXML(d *xml.Decoder, start xml.StartEl return nil } +func (a *DomainAddressUnassigned) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + d.Skip() + return nil +} + func (a *DomainAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { var typ string for _, attr := range start.Attr { @@ -5148,6 +5168,9 @@ func (a *DomainAddress) UnmarshalXML(d *xml.Decoder, start xml.StartElement) err } else if typ == "virtio-s390" { a.VirtioS390 = &DomainAddressVirtioS390{} return d.DecodeElement(a.VirtioS390, &start) + } else if typ == "unassigned" { + a.Unassigned = &DomainAddressUnassigned{} + return d.DecodeElement(a.Unassigned, &start) } return nil -- 2.23.0

On Fri, Dec 20, 2019 at 05:22:26PM -0500, Cole Robinson wrote:
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- This should fix the libvirt-go-xml CI
domain.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> 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 :|
participants (2)
-
Cole Robinson
-
Daniel P. Berrangé