[libvirt] [PATCH console-proxy 0/6] libvirt-go-xml and libvirt-console-proxy ?
Philipp Hahn
hahn at univention.de
Fri Nov 15 13:05:11 UTC 2019
Hello Daniel,
I regularly visit your blog and stumbled over
<https://www.berrange.com/posts/2017/01/05/announce-new-libvirt-project-go-xml-parser-model/>,
which seems to contains some small errors - I'm a "go"-newby, so I had
to spend some time to understand your example and to make it go:
> import (
> libvirt "github.com/libvirt/libvirt-go"
> libvirtxml "github.com/libvirt/libvirt-go-xml"
> "encoding/xml"
> "fmt"
> )
>
> conn, err := libvirt.NewConnect("qemu:///system")
> dom := conn.LookupDomainByName("demo")
This also returns a tuple (dom, err), so should look like:
dom, err := conn.LookupDomainByName("demo")
> xmldoc, err := dom.GetXMLDesc(0)
>
> domcfg := &libvirtxml.Domain{}
> err := xml.Unmarshal([]byte(xmldocC), domcfg)
This fails as "err" is already defined. Should be '=' instead of ':=':
err = xml.Unmarshal([]byte(xmldocC), domcfg)
>
> fmt.Printf("Virt type %s", domcfg.Type)
Maybe add an "\n" at the end?
And maybe also add the wrapper
> package main
...
> func main() {
...
> }
to make the example complete?
Second is
<https://www.berrange.com/posts/2017/01/26/announce-new-libvirt-console-proxy-project/>:
Do you (or someone else) still work on libvirt-console-proxy? It no
longer compiles after several API changed in libvirt-go-xml and uuid.
I have attached several patches, which at least allow compiling again,
I only tested is briefly.
Philipp
Philipp Hahn (6):
Adapt to API change for dom.Devices.Graphics
Adapt to uuid API change
Adapt to API change for dom.Devices.{Serials,Console}
virtconsoleresolveradm: Require sub-command
virtconsoleresolveradm: Simplify argument parsing
virtconsoleresolveradm: Fix -c handling
cmd/virtconsoleresolveradm/cmd/disable.go | 6 +-----
cmd/virtconsoleresolveradm/cmd/enable.go | 20 ++++++-----------
cmd/virtconsoleresolveradm/cmd/root.go | 3 ++-
pkg/resolver/server.go | 26 ++++++++++++++++-------
4 files changed, 28 insertions(+), 27 deletions(-)
--
2.20.1
More information about the libvir-list
mailing list