Commit 078178a5 authored by Roman Mohr's avatar Roman Mohr Committed by Daniel P. Berrange

Pass NULL to virDomainOpenConsole if dvename is an empty string

In order to let libvirt select the first available serial console, NULL
needs to be passed in. If an empty string is passsed in, libvirt tries
to find a console with that name instead.
parent 8147ec24
......@@ -4074,8 +4074,11 @@ func (d *Domain) OpenChannel(name string, stream *Stream, flags DomainChannelFla
}
func (d *Domain) OpenConsole(devname string, stream *Stream, flags DomainConsoleFlags) error {
cdevname := C.CString(devname)
defer C.free(unsafe.Pointer(cdevname))
var cdevname *C.char
if devname != "" {
cdevname = C.CString(devname)
defer C.free(unsafe.Pointer(cdevname))
}
ret := C.virDomainOpenConsole(d.ptr, cdevname, stream.ptr, C.uint(flags))
if ret == -1 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment