Skip to content

Configurable connection URI #35

Open
@tn-osimis

Description

@tn-osimis

Sifting through the code I gather the connection URI is not configurable.

const (
        connectionString   = "qemu:///system"
func (d *Driver) getConn() (*libvirt.Connect, error) {
        if d.conn == nil {
                conn, err := libvirt.NewConnect(connectionString)

I need to use a different URI (e.g. qemu:///session). I think a driver parameter would be appropriate here. Alternatively, passing an empty string to libvirt.NewConnect would have libvirt select the default connection and let the user configure it themselves.

func NewConnect(uri string) (*Connect, error) {
        var cUri *C.char
        if uri != "" {
                cUri = C.CString(uri)
                defer C.free(unsafe.Pointer(cUri))
        }
        ptr := C.virConnectOpen(cUri)

virConnectOpen: https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions