Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit 9425b79

Browse files
committed
configureable node disk space buffer considered during gear moves
1 parent c3c1eb9 commit 9425b79

5 files changed

Lines changed: 13 additions & 2 deletions

File tree

broker/conf/broker.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ DEFAULT_REGION_NAME=""
217217
# Allow region selection when creating applications. Default is true
218218
ALLOW_REGION_SELECTION="true"
219219

220+
# Minimum Node Disk Buffer Percentage
221+
#
222+
# When moving a gear to a new node, ensure that after a move this percentage
223+
# of free disk space will remain on the new node.
224+
MIN_NODE_DISK_BUFFER="5"
225+
220226
# Normalize logins / usernames according to specified method(s) in OpenShift::Username;
221227
# e.g. when set to "lowercase", a user logging in as "JDoe" is the same as "jdoe".
222228
# WARNING: nothing is done automatically to update existing non-normalized logins,

broker/config/environments/development.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
124124
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
125125
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
126+
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
126127
}
127128

128129
config.auth = {

broker/config/environments/production.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
113113
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
114114
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
115+
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
115116
}
116117

117118
config.auth = {

broker/config/environments/test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
122122
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
123123
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
124+
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
124125
}
125126

126127
config.auth = {

plugins/msg-broker/mcollective/lib/openshift/mcollective_application_container_proxy.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,11 +2413,13 @@ def rsync_destination_container(gear, destination_container, destination_distric
24132413
log_debug "DEBUG: Gear platform is '#{platform}'"
24142414
destination_avail_space = destination_container.get_node_disk_free
24152415
destination_total_space = destination_container.get_node_total_size
2416+
min_node_disk_buffer = Rails.application.config.openshift[:min_node_disk_buffer].to_f
24162417

24172418
# check here to make sure addition of gear to destination_container
24182419
# will not result in > 95% full destination_container
2419-
if (destination_avail_space - source_used_blocks.to_f)/destination_total_space < 0.05
2420-
raise OpenShift::NodeUnavailableException.new("Gear '#{gear.uuid}' cannot be moved to '#{destination_container.id}'. Not enough disk space, node would be > 95% full after move.", 140)
2420+
if (destination_avail_space - source_used_blocks.to_f)/destination_total_space < (min_node_disk_buffer/100)
2421+
max_percentage = sprintf('%.0f', 100 - min_node_disk_buffer)
2422+
raise OpenShift::NodeUnavailableException.new("Gear '#{gear.uuid}' cannot be moved to '#{destination_container.id}'. Not enough disk space, node would be > #{max_percentage}% full after move.", 140)
24212423
end
24222424

24232425
log_debug "DEBUG: Creating new account for gear '#{gear.uuid}' on #{destination_container.id}"

0 commit comments

Comments
 (0)