-
Notifications
You must be signed in to change notification settings - Fork 4
Add systemd-less mode for Libvirt collector #377
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
Add systemd-less mode for Libvirt collector #377
Conversation
Thanks a lot @wtripp180901 for this PR. Really appreciate your time and effort. I think we are taking both systemd and cgroup drivers into account for k8s and AFAIK SLURM does not really support non-systemd in production. So, I think adding the support to Libvirt should be "complete". Do you have access to any production systems that use non-systemd layout? If so, could you please zip the contents in |
Great, yes I should be able to get that data. Where in the repo would that live? Or shall I get it to you directly somehow? |
Cheers!! That would be super helpful if you can extract some data. Actually that data lives in sys.ttar file. It is my bad that I have not made a |
pkg/collector/cgroup.go
Outdated
|
||
noSystemdMode = CEEMSExporterApp.Flag( | ||
"collector.cgroups.no-systemd-mode", | ||
"Set if running on a non-systemd host", | ||
).Default("false").Bool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using a CLI flag (which users have to configure), we should be able to detect the cgroup layout, right?! This is what we are doing for k8s to detect if we are using cgroupfs or systemd drivers. We can use a similar logic here as well. We can add a field to cgroupManager
something like nonSystemdLayout bool
and set it to true when machine
is found. Something like:
// Discover all cgroup layout
for _, slice := range []string{"machine", "machine.slice"} {
if _, err := os.Stat(filepath.Join(*cgroupfsPath, activeSubsystem, slice)); err == nil {
manager.slices = append(manager.slices, slice)
if slice == "machine" {
manager.nonSystemdLayout = true
}
break // This should be fine as there will atmost one of machine or machine.slice exist at any given time
}
}
Eventually we can use the manager.nonSysytemdLayout
when parsing number of vCPUs. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that sounds sensible
pkg/collector/cgroup.go
Outdated
var ( | ||
libvirtCgroupPathRegex = regexp.MustCompile("^.*/(?:.+?)-qemu-(?:[0-9]+)-(?P<id>instance-[0-9a-f]+)(?:.*$)") | ||
libvirtCgroupPathRegex = regexp.MustCompile("^.*/(?:.+?)-qemu-(?:[0-9]+)-(?P<id>instance-[0-9a-f]+)(?:.*$)") | ||
libvirtCgroupNoSystemdPathRegex = regexp.MustCompile("^.*/(?:.+?)qemu-(?:[0-9]+)-(?P<id>instance-[0-9a-f]+)(?:.*$)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a regex regexp.MustCompile("^.*/(?:.+?)qemu-(?:[0-9]+)-(?P<id>instance-[0-9a-f]+)(?:.*$)")
must work for both cases. So, I think there is no need to define two?!
Hi @mahendrapaipuri , production cgroup info might be hard to get hold of because of concerns over leaking info, but I can provide data from a virtual dev openstack hypervisor. It's nested virt so there could be some data missing, but the layout of the qemu scopes looks similar enough to prod. Let me know if this is good enough |
@wtripp180901 This is great, what you have provided is more than enough!! Thanks a lot! Really appreciate it!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @wtripp180901 for this PR. Appreciate your time and effort.
CEEMS currently only supports the standard systemd cgroup layout, but certain OpenStack configurations don't use systemd. Adds a
collector.cgroups.no-systemd-mode
flag to support this config. Currently only supports libvirt collector but support for other collectors could be added if there is interest in this PR.