Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for modular libvirt daemons #171

Open
folliehiyuki opened this issue Aug 28, 2022 · 4 comments
Open

Support for modular libvirt daemons #171

folliehiyuki opened this issue Aug 28, 2022 · 4 comments

Comments

@folliehiyuki
Copy link

folliehiyuki commented Aug 28, 2022

Currently the socket is defined as a variable here

defaultSocket = "/var/run/libvirt/libvirt-sock"

so it only works with Monolithic daemon mode (libvirtd) and not the Modular daemons mode (virtqemud, virtstoraged,...).

Ref: https://libvirt.org/daemons.html

@connorkuehl
Copy link

Are you able to connect to the modular sockets with the dialers package? Something like this:

dialer := dialers.NewLocal(dialers.WithSocket("/var/run/libvirt/virtqemud"))
lv := libvirt.NewWithDialer(dialer)
err := lv.Connect()
defer lv.Disconnect()

@folliehiyuki
Copy link
Author

folliehiyuki commented Aug 29, 2022

Sorry that I'm not familiar with Go. I modified the snippet above a little:

package main

import (
	"github.com/digitalocean/go-libvirt"
	"github.com/digitalocean/go-libvirt/socket/dialers"
	"github.com/sirupsen/logrus"
)

func main() {
	dialer := dialers.NewLocal(dialers.WithSocket("/var/run/libvirt/virtqemud-sock"))
	lv := libvirt.NewWithDialer(dialer)
	if err := lv.Connect(); err != nil {
		logrus.Fatal(err)
	}
	defer lv.Disconnect()
}

Running it with go run main.go doesn't return any errors (and it returns 0) so I guess it connects successfully.

@folliehiyuki
Copy link
Author

What I want to ask here is to support dynamic socket. So instead of relying on 1 defined socket, we can detect which modular socket we need to connect to based on the API call.

On a normal system, 1 modular daemon alone is kind of useless, but also people might not want to enable libvirtd as they don't use all libvirt features.

@connorkuehl
Copy link

Ah, I see. That makes sense. I can't promise this will get done in the near future, but if someone else beats one of us and submits patches, I'm happy to review them.

Thanks for filing this feature request 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants