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: Add storage balancing function. #55

Merged
merged 1 commit into from
Aug 24, 2024

Conversation

gyptazy
Copy link
Owner

@gyptazy gyptazy commented Aug 20, 2024

Features

  • feature: Add storage balancing function.
  • feature: Add feature to allow the API hosts being provided as a comma separated list.

General

This PR adds the feature to also allow storage balancing and supports VMs and CTs. It also supports multiple disks assigned to VMs and CTs. In the first iteration it can only balance by disk_space. I'm currently still evaluating to implement also an additional balancing method by disk_io.

Tests

Storage Balancing

<6> ProxLB: Info: [storage-balanciness-validation]: Getting most free storage volume by disk size.
<6> ProxLB: Info: [storage-balanciness-validation]: Validating storage: net-nfs01 for balanciness for usage with: disk_space.
<6> ProxLB: Info: [storage-balanciness-validation]: Storage: net-nfs01 with values: {'name': 'net-nfs01', 'total': 314915684352, 'used': 151707975680, 'used_percent': 48.174156835715735, 'used_percent_last_run': 48.174156835715735, 'free': 163207708672, 'free_percent': 51.825843164284265, 'used_fraction': 0.481741568357157, 'type': 'nfs', 'content': 'rootdir,images', 'usage_type': 'all', 'used_percent_match': False}
<6> ProxLB: Info: [storage-balanciness-validation]: Validating storage: net-nfs02 for balanciness for usage with: disk_space.
<6> ProxLB: Info: [storage-balanciness-validation]: Storage: net-nfs02 with values: {'name': 'net-nfs02', 'total': 209231282176, 'used': 35651584000, 'used_percent': 17.039318226808362, 'used_percent_last_run': 17.039318226808362, 'free': 173579698176, 'free_percent': 82.96068177319164, 'used_fraction': 0.170393182268084, 'type': 'nfs', 'content': 'images', 'usage_type': 'vm', 'used_percent_match': False}
<6> ProxLB: Info: [storage-balanciness-validation]: Rebalancing for type "used" of storage is needed. Highest usage: 48% | Lowest usage: 17%.
<6> ProxLB: Info: [get-most-used-disks-resources-vm]: Got most used VM: test02 with storage device: virtio1.
<6> ProxLB: Info: [get-most-free-storage]: Starting to evaluate the most free storage volume.
<6> ProxLB: Info: [get-most-free-storage]: Getting most free storage volume by disk space.
<6> ProxLB: Info: [rebalancing-storage-resource-statistics-update]: Validating VM test02 for potential storage rebalancing.
<6> ProxLB: Info: [rebalancing-storage-resource-statistics-update]: Setting VM test02 from net-nfs01 to net-nfs02 storage.
<6> ProxLB: Info: [rebalancing-storage-resource-statistics-update]: Adding free space of 34G to old storage with 151.9990234375G. [free: 185G | 63.418540457567914%]
<6> ProxLB: Info: [rebalancing-storage-resource-statistics-update]: Adding used space of 34G to new storage with 161.65869140625G. [free: 127G | 65.51241990893988%]
<6> ProxLB: Info: [rebalancing-storage-resource-statistics-update]: Updated VM and storage statistics.
<6> ProxLB: Info: [storage-balanciness-validation]: Getting most free storage volume by disk size..
<6> ProxLB: Info: [storage-balanciness-validation]: Validating storage: net-nfs01 for balanciness for usage with: disk_space.
<6> ProxLB: Info: [storage-balanciness-validation]: Storage: net-nfs01 with values: {'name': 'net-nfs01', 'total': 314915684352, 'used': 115200753664, 'used_percent': 36.581459542432086, 'used_percent_last_run': 36.581459542432086, 'free': 199714930688, 'free_percent': 63.418540457567914, 'used_fraction': 0.481741568357157, 'type': 'nfs', 'content': 'rootdir,images', 'usage_type': 'all', 'used_percent_match': False}
<6> ProxLB: Info: [storage-balanciness-validation]: Validating storage: net-nfs02 for balanciness for usage with: disk_space.
<6> ProxLB: Info: [storage-balanciness-validation]: Storage: net-nfs02 with values: {'name': 'net-nfs02', 'total': 209231282176, 'used': 72158806016, 'used_percent': 34.487580091060124, 'used_percent_last_run': 34.487580091060124, 'free': 137072476160, 'free_percent': 65.51241990893988, 'used_fraction': 0.170393182268084, 'type': 'nfs', 'content': 'images', 'usage_type': 'vm', 'used_percent_match': False}
<6> ProxLB: Info: [storage-balanciness-validation]: Rebalancing for type "used" of storage is not needed. Highest usage: 36% | Lowest usage: 34%.
<6> ProxLB: Info: [storage-rebalancing-calculator]: Balancing calculations done.
<6> ProxLB: Info: [storage-rebalancing-calculator]: Balancing calculations done.

Allow Multiple API Hosts

<6> ProxLB: Info: [logger]: Logger verbosity got updated to: INFO.
<4> ProxLB: Warning: [api-connection]: API connection does not verify SSL certificate.
<6> ProxLB: Info: [api-connect-get-host]: Multiple hosts for API connection are given. Testing hosts for further usage.
<6> ProxLB: Info: [api-connect-get-host]: Testing host 8.8.8.8 on port tcp/8006.
<6> ProxLB: Info: [api-connect-test-host]: Timeout for host 8.8.8.8 is set to 2 seconds.
<2> ProxLB: Error: [api-connect-test-host]: Host 8.8.8.8 is unreachable on port tcp/8006.
<6> ProxLB: Info: [api-connect-get-host]: Testing host 10.10.10.211 on port tcp/8006.
<6> ProxLB: Info: [api-connect-test-host]: Timeout for host 10.10.10.211 is set to 2 seconds.
<6> ProxLB: Info: [api-connect-test-host]: Host 10.10.10.211 is reachable on port tcp/8006.
<6> ProxLB: Info: [api-connection]: API connection succeeded to host: 10.10.10.211.

Misc

Status: WIP
Fixes: #51
Fixes: #60

@gyptazy gyptazy added this to the Release 1.0.3 milestone Aug 20, 2024
@gyptazy gyptazy self-assigned this Aug 20, 2024
@gyptazy gyptazy force-pushed the feature/51-storage-balancing-feature branch 3 times, most recently from bc50663 to 604eeb5 Compare August 22, 2024 16:55
@gyptazy gyptazy mentioned this pull request Aug 22, 2024
proxlb Outdated Show resolved Hide resolved
proxlb Outdated Show resolved Hide resolved
@gyptazy gyptazy force-pushed the feature/51-storage-balancing-feature branch 2 times, most recently from 7fd1897 to b63ff1a Compare August 23, 2024 15:32
feature: Add feature to allow the API hosts being provided as a comma separated list. [#60]

Fixes: #51
Fixes: #60
@gyptazy gyptazy force-pushed the feature/51-storage-balancing-feature branch from b63ff1a to ef8b97e Compare August 23, 2024 16:49
@gyptazy gyptazy merged commit 959c3b5 into main Aug 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple API hosts Feature: Storage Balancing
1 participant