hubblo-org / scaphandre

⚡ Energy consumption metrology agent. Let "scaph" dive and bring back the metrics that will help you make your systems and applications more sustainable !
Apache License 2.0
1.54k stars 101 forks source link

OpenStack support #60

Open sylvainOL opened 3 years ago

sylvainOL commented 3 years ago

Problem

it seems quite complicated to use scaphandre in a VM according to https://hubblo-org.github.io/scaphandre/how-to_guides/propagate-metrics-hypervisor-to-vm_qemu-kvm.html. a manual solution is provided but unfortunately not an "automated" one for OpenStack

Solution

Create documentation to explain how to achieve the "automated" creation for OpenStack.

From the documentation, I believe the hardest part is to create the tmpfs with the Domain name and attach it to the VM. I've searched in OpenStack documentation on how to achieve that but didn't find interesting result :(

bpetit commented 3 years ago

Hi. This is a great topic as it's very much needed. Thanks for opening the FR. Any support on this, notably on providing a testing environment (as openstack has some relatively important requirements), would be appreciated.

sylvainOL commented 3 years ago

Hi @bpetit, we do have openstack that we're managing, so we can help in this area. testing / amending started doc is also possible

uggla commented 3 years ago

First a short disclaimer, I used openstack a lot. But it was ~4 years ago. As a lot of FLOSS software it has evolved and I have not followed it. So what I will write here needs to be verified.

  1. Installing scaphandre on the hypervisors is not an issue it coud be done using any automation tool.
  2. @sylvainOL , you set the problem. Mounting the tmpfs on the hypervisor and more over configuring the vm is the tricky part to automate.
  3. The remaining part on the vm could be done in cloud-init it is trivial.

If we zoom on the second topic. Configuring these options are tricky because they are dynamic we need to know the host that will be used and the vm name or id when it will be created, and then do the required configuration on the host (fs) and it's hypervisor (qemu). I don't think we can specify mount points or specific vm configuration items(fs) either at vm creation time or within the vm flavors. I quickly look at the command line options and it looks not possible to do such advanced configurations although more investigations are required.

My feeling here is that if we want to do it properly, it must be done into nova (openstack service managing vm). So it will require to dig into the nova code (python) and hack it to allow such advanced configuration. As this is a FLOSS software it is completely possible to do it, but it will require time and efforts.

@bpetit , regarding Openstack development I used to use devstack project. This is a cool project to install a all in one Openstack dev cluster on your laptop. So it allows to hack on it easilly. It can also be installed on VMs in the cloud allowing nested virtualisation. I used Digital Ocean before to do some labs it and it worked well.

This is an interresting and quite challanging technical objective. I'll be happy to help if there is demand for such feature keeping up motivation because it will require time.

JamesGibo commented 2 years ago

Just to add some extra information regarding this issue, I currently use Openstack and agree with what @uggla said.

Support for virtiofs was added to libvirt in v6.2.0 https://libvirt.org/formatdomain.html#filesystems

For the latest release of Openstack(Wallaby), the minimum supported libvirt version is 6.0.0 https://wiki.openstack.org/wiki/LibvirtDistroSupportMatrix I am not sure if Openstack has been tested with libvirt v6.2.0 yet.

bpetit commented 2 years ago

Thanks for those informations ! Maybe we could think about another way to share power consumption data with VMs than qemu filesystems. I think attaching extra virtual disks to vms is easy in openstack, maybe there could a workaround here for example ?

I don't know what could be the best solution there, but just to mention if adding features to scaphandre to make that possible is necessary, I could work on it at some point or help as much as possible if someone takes the lead.

jrosser commented 2 years ago

There is a lot of dicussion of what it would take to add virtio-fs to nova here (in the context of the openstack manila filesystem-as-a-service) https://www.youtube.com/watch?v=e3kHPjNVQ80

uggla commented 2 years ago

I raised the point to the Openstack PTG for Zed release: https://etherpad.opendev.org/p/nova-zed-ptg (look for Scaphandre)