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

Feature: new VM suggestion #8

Closed
daanbosch opened this issue Jul 9, 2024 · 9 comments · Fixed by #54
Closed

Feature: new VM suggestion #8

daanbosch opened this issue Jul 9, 2024 · 9 comments · Fixed by #54
Assignees
Labels
Milestone

Comments

@daanbosch
Copy link
Contributor

General

I would love to know where I should place my next VM on the cluster. Would it be possible to calculate the best fit node as well?

Task

Add an endpoint for requesting the best node based on CPU/Memory/Disk/PCI device requirements

@gyptazy gyptazy added the question Further information is requested label Jul 9, 2024
@gyptazy
Copy link
Owner

gyptazy commented Jul 9, 2024

Hey @daanbosch,

I can see the reason and use it already for my BoxyBSD.com project in a modified way. However, I'm not sure what the best way for this would be and I guess it also depends on the operator's use case - also if you want to recall the executable and just want to get a string returned with the hypervisor/node name or if this should be integrated into the daemon. I think I would prefer having this as a daemon where it also provides an API which can simply be called by external tools like Ansible which then returns a simple json.

Happy to head some more ideas.

Cheers,
gyptazy

@daanbosch
Copy link
Contributor Author

Hi gyptazy,

Yes an API endpoint would be ideal in my opinion. I use Terraform to spin up vm's If we could get an HTTP API that would return the best fit for one or more virtual machines, that would be ideal.

Best,
Daan

@gyptazy gyptazy added this to the Release 1.1.0 milestone Jul 9, 2024
@gyptazy gyptazy added feature and removed question Further information is requested labels Jul 9, 2024
@gyptazy gyptazy self-assigned this Jul 9, 2024
@gyptazy
Copy link
Owner

gyptazy commented Jul 9, 2024

Sounds good and an API interface would be my preferred way. But currently this is not my personal priority right, now.
I also want to keep the dependencies and code small, so I guess it would be only a returned json via http.server without any further user authentication (could probably be done by a reverse proxy).

I think this might be a goal for 1.1 - maybe even earlier.

gyptazy added a commit that referenced this issue Jul 12, 2024
@gyptazy
Copy link
Owner

gyptazy commented Jul 13, 2024

An example usage for this is already given with request #8 in PR #21 which returns the best available node for placing new VMs.

This feature is planned for release 1.1.0 and is currently only a possible approach. I will work on that after releasing 1.0.0.

@baggar11
Copy link

baggar11 commented Jul 21, 2024

Doesn't the "rebalance on start" option effectively make this moot? With the option enabled, you can create a vm on any cluster node. Once the new vm is started, Proxmox will already move it over to another node based on current resources?

@gyptazy
Copy link
Owner

gyptazy commented Jul 21, 2024

Hey @baggar11,

Doesn't the "rebalance on start" option effectively make this moot? With the option enabled, you can create a vm on any cluster node. Once the new vm is started, Proxmox will already move it over to another node based on current resources?

Thanks for mentioning this. Afaik, this option only works when:

  • HA enabled for that VM
  • Proxmox >= 8.0

The option is already present in 7.0 but there's a bug which might be annoying: https://forum.proxmox.com/threads/enabling-ha-rebalance-on-start-reboots-running-vm-after-adding-it-to-ha-manager.125597/

So, I think it's still ok to have it here present.

Cheers,
gyptazy

@daanbosch
Copy link
Contributor Author

daanbosch commented Jul 22, 2024

Doesn't the "rebalance on start" option effectively make this moot? With the option enabled, you can create a vm on any cluster node. Once the new vm is started, Proxmox will already move it over to another node based on current resources?

This function requires you to enable HA, which is not always a possibility. It also balances based on the current load. This tool has advanced features to choose the way you balance (Based on reserved or actual usage).

Best,
Daan

@gyptazy
Copy link
Owner

gyptazy commented Aug 19, 2024

This feature will already be present this evening or tomorrow by pushing the new base for upcoming features. You can then simply call it with ./proxlb -b (-b for best node) which simply returns on the cli the best next node. This way, you can easily and directly safe this into a var and use it with further toolings like Terraform or Ansible.

I’ll provide the updated docs with the feature.

cheers,
gyptazy

@gyptazy
Copy link
Owner

gyptazy commented Aug 19, 2024

Hey everyone!

This feature is now available and can simply be used by running proxlb with the cli arg -b (or --best-node) which returns the best next node for a VM or CT placement based on the defined options on the config.

Example:

devbox04:~# /bin/proxlb -b
virt02

Of course, you can also use different config to get the best next node for specific balancing methods. This could look like:

devbox04:~# /bin/proxlb -b -c /etc/proxlb/cluster01_memory.cfg
virt03

devbox04:~# /bin/proxlb -b -c /etc/proxlb/cluster01_cpu.cfg
virt12

This feature will also be available in the ProxLB API. See also https://github.com/gyptazy/ProxLB?tab=readme-ov-file#parameters.

Hope it helps!

Cheers,
gyptazy

@gyptazy gyptazy modified the milestones: Release 1.2.0, Release 1.0.3 Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants