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

Commit

Permalink
configureable node disk space buffer considered during gear moves
Browse files Browse the repository at this point in the history
  • Loading branch information
sallyom committed Jul 29, 2016
1 parent c3c1eb9 commit 9425b79
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions broker/conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ DEFAULT_REGION_NAME=""
# Allow region selection when creating applications. Default is true
ALLOW_REGION_SELECTION="true"

# Minimum Node Disk Buffer Percentage
#
# When moving a gear to a new node, ensure that after a move this percentage
# of free disk space will remain on the new node.
MIN_NODE_DISK_BUFFER="5"

# Normalize logins / usernames according to specified method(s) in OpenShift::Username;
# e.g. when set to "lowercase", a user logging in as "JDoe" is the same as "jdoe".
# WARNING: nothing is done automatically to update existing non-normalized logins,
Expand Down
1 change: 1 addition & 0 deletions broker/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
: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."),
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
}

config.auth = {
Expand Down
1 change: 1 addition & 0 deletions broker/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
: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."),
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
}

config.auth = {
Expand Down
1 change: 1 addition & 0 deletions broker/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
: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."),
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
}

config.auth = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2413,11 +2413,13 @@ def rsync_destination_container(gear, destination_container, destination_distric
log_debug "DEBUG: Gear platform is '#{platform}'"
destination_avail_space = destination_container.get_node_disk_free
destination_total_space = destination_container.get_node_total_size
min_node_disk_buffer = Rails.application.config.openshift[:min_node_disk_buffer].to_f

# check here to make sure addition of gear to destination_container
# will not result in > 95% full destination_container
if (destination_avail_space - source_used_blocks.to_f)/destination_total_space < 0.05
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)
if (destination_avail_space - source_used_blocks.to_f)/destination_total_space < (min_node_disk_buffer/100)
max_percentage = sprintf('%.0f', 100 - min_node_disk_buffer)
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)
end

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

0 comments on commit 9425b79

Please sign in to comment.