[libvirt] [PATCH go-xml] let disk source omitempty for ejecting cdrom/floppy

zhenwei.pi posted 1 patch 6 years, 6 months ago
Failed in applying to current master (apply log)
domain.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt] [PATCH go-xml] let disk source omitempty for ejecting cdrom/floppy
Posted by zhenwei.pi 6 years, 6 months ago
Signed-off-by: zhenwei.pi <zhenwei.pi@youruncloud.com>
---
 domain.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/domain.go b/domain.go
index bacab11..f9d567d 100644
--- a/domain.go
+++ b/domain.go
@@ -117,7 +117,7 @@ type DomainDisk struct {
 	Snapshot  string               `xml:"snapshot,attr,omitempty"`
 	Driver    *DomainDiskDriver    `xml:"driver"`
 	Auth      *DomainDiskAuth      `xml:"auth"`
-	Source    *DomainDiskSource    `xml:"source"`
+	Source    *DomainDiskSource    `xml:"source,omitempty"`
 	Target    *DomainDiskTarget    `xml:"target"`
 	IOTune    *DomainDiskIOTune    `xml:"iotune"`
 	Serial    string               `xml:"serial,omitempty"`
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH go-xml] let disk source omitempty for ejecting cdrom/floppy
Posted by Daniel P. Berrange 6 years, 6 months ago
On Mon, Oct 16, 2017 at 05:36:54PM +0800, zhenwei.pi wrote:
> Signed-off-by: zhenwei.pi <zhenwei.pi@youruncloud.com>
> ---
>  domain.go | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/domain.go b/domain.go
> index bacab11..f9d567d 100644
> --- a/domain.go
> +++ b/domain.go
> @@ -117,7 +117,7 @@ type DomainDisk struct {
>  	Snapshot  string               `xml:"snapshot,attr,omitempty"`
>  	Driver    *DomainDiskDriver    `xml:"driver"`
>  	Auth      *DomainDiskAuth      `xml:"auth"`
> -	Source    *DomainDiskSource    `xml:"source"`
> +	Source    *DomainDiskSource    `xml:"source,omitempty"`
>  	Target    *DomainDiskTarget    `xml:"target"`
>  	IOTune    *DomainDiskIOTune    `xml:"iotune"`
>  	Serial    string               `xml:"serial,omitempty"`

AFAIK, this should not be needed - the Source element is already
a pointer, so if you leave the pointer as nil it should omit
the <source> element entirely


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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list