func (c *VirConnection) GetURI() (string, error) { cStr := C.virConnectGetURI(c.ptr) if cStr == nil { return "", GetLastError() } uri := C.GoString(cStr) C.free(unsafe.Pointer(cStr)) return uri, nil }
func (h *Hypervisor) GetConnectionUri() (string, error) { result := C.virConnectGetURI(h.cptr) if result == nil { return "", GetLastError() } uri := C.GoString(result) defer C.free(unsafe.Pointer(result)) return uri, nil }
// URI returns the URI (name) of the hypervisor connection. Normally this is // the same as or similar to the string passed to the Open/OpenReadOnly call, // but the driver may make the URI canonical. If uri == "" was passed to Open, // then the driver will return a non-NULL URI which can be used to connect tos // the same hypervisor later. func (conn Connection) URI() (string, error) { conn.log.Println("reading connection URI...") cURI := C.virConnectGetURI(conn.virConnect) if cURI == nil { err := LastError() conn.log.Printf("an error occurred: %v\n", err) return "", err } defer C.free(unsafe.Pointer(cURI)) uri := C.GoString(cURI) conn.log.Printf("connection URI: %v\n", uri) return uri, nil }