Add variables for quota configuration
Many configuration values are hard-coded in the Trove devstack plugin, however they would be better served letting the user/developer decide what limits to impose. The following variables were added to facilitate this: TROVE_MAX_ACCEPTED_VOLUME_SIZE TROVE_MAX_INSTANCES_PER_TENANT TROVE_MAX_VOLUMES_PER_TENANT TROVE_AGENT_CALL_LOW_TIMEOUT TROVE_AGENT_CALL_HIGH_TIMEOUT TROVE_RESIZE_TIME_OUT TROVE_USAGE_TIMEOUT TROVE_STATE_CHANGE_WAIT_TIME These values are only inserted if they are set. If not set, the Trove defaults are used instead. Change-Id: I2c568fdfa05064682f372b996a5aebcdd4e93ef3
This commit is contained in:
parent
a3b3fcbd7d
commit
9e3860d54c
@ -79,6 +79,20 @@ function cleanup_trove {
|
||||
}
|
||||
|
||||
|
||||
# iniset_conditional() - Sets the value in the inifile, but only if it's
|
||||
# actually got a value
|
||||
function iniset_conditional {
|
||||
local FILE=$1
|
||||
local SECTION=$2
|
||||
local OPTION=$3
|
||||
local VALUE=$4
|
||||
|
||||
if [[ -n "$VALUE" ]]; then
|
||||
iniset ${FILE} ${SECTION} ${OPTION} ${VALUE}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# configure_trove() - Set config files, create data dirs, etc
|
||||
function configure_trove {
|
||||
setup_develop $TROVE_DIR
|
||||
@ -94,6 +108,13 @@ function configure_trove {
|
||||
rm -f $TROVE_TASKMANAGER_CONF
|
||||
rm -f $TROVE_CONDUCTOR_CONF
|
||||
|
||||
# (Re)create trove api conf file if needed
|
||||
if is_service_enabled tr-api; then
|
||||
# Set common configuration values (but only if they're defined)
|
||||
iniset_conditional $TROVE_CONF DEFAULT max_accepted_volume_size $TROVE_MAX_ACCEPTED_VOLUME_SIZE
|
||||
iniset_conditional $TROVE_CONF DEFAULT max_instances_per_tenant $TROVE_MAX_INSTANCES_PER_TENANT
|
||||
iniset_conditional $TROVE_CONF DEFAULT max_volumes_per_tenant $TROVE_MAX_VOLUMES_PER_TENANT
|
||||
|
||||
iniset $TROVE_CONF DEFAULT rabbit_userid $RABBIT_USERID
|
||||
iniset $TROVE_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
|
||||
iniset $TROVE_CONF database connection `database_connection_url trove`
|
||||
@ -101,17 +122,20 @@ function configure_trove {
|
||||
setup_trove_logging $TROVE_CONF
|
||||
iniset $TROVE_CONF DEFAULT trove_api_workers "$API_WORKERS"
|
||||
|
||||
# Increase default quota.
|
||||
iniset $TROVE_CONF DEFAULT max_accepted_volume_size 10
|
||||
iniset $TROVE_CONF DEFAULT max_instances_per_user 10
|
||||
iniset $TROVE_CONF DEFAULT max_volumes_per_user 10
|
||||
|
||||
configure_auth_token_middleware $TROVE_CONF trove $TROVE_AUTH_CACHE_DIR
|
||||
fi
|
||||
|
||||
# (Re)create trove taskmanager conf file if needed
|
||||
if is_service_enabled tr-tmgr; then
|
||||
TROVE_AUTH_ENDPOINT=$KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION
|
||||
|
||||
# Use these values only if they're set
|
||||
iniset_conditional $TROVE_TASKMANAGER_CONF DEFAULT agent_call_low_timeout $TROVE_AGENT_CALL_LOW_TIMEOUT
|
||||
iniset_conditional $TROVE_TASKMANAGER_CONF DEFAULT agent_call_high_timeout $TROVE_AGENT_CALL_HIGH_TIMEOUT
|
||||
iniset_conditional $TROVE_TASKMANAGER_CONF DEFAULT resize_time_out $TROVE_RESIZE_TIME_OUT
|
||||
iniset_conditional $TROVE_TASKMANAGER_CONF DEFAULT usage_timeout $TROVE_USAGE_TIMEOUT
|
||||
iniset_conditional $TROVE_TASKMANAGER_CONF DEFAULT state_change_wait_time $TROVE_STATE_CHANGE_WAIT_TIME
|
||||
|
||||
iniset $TROVE_TASKMANAGER_CONF DEFAULT rabbit_userid $RABBIT_USERID
|
||||
iniset $TROVE_TASKMANAGER_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
|
||||
iniset $TROVE_TASKMANAGER_CONF database connection `database_connection_url trove`
|
||||
@ -121,11 +145,6 @@ function configure_trove {
|
||||
iniset $TROVE_TASKMANAGER_CONF DEFAULT nova_proxy_admin_pass $RADMIN_USER_PASS
|
||||
iniset $TROVE_TASKMANAGER_CONF DEFAULT trove_auth_url $TROVE_AUTH_ENDPOINT
|
||||
setup_trove_logging $TROVE_TASKMANAGER_CONF
|
||||
|
||||
# Increase default timeouts (required by the tests).
|
||||
iniset $TROVE_TASKMANAGER_CONF DEFAULT agent_call_low_timeout 15
|
||||
iniset $TROVE_TASKMANAGER_CONF DEFAULT agent_call_high_timeout 300
|
||||
iniset $TROVE_TASKMANAGER_CONF DEFAULT usage_timeout 1200
|
||||
fi
|
||||
|
||||
# (Re)create trove conductor conf file if needed
|
||||
|
@ -23,6 +23,16 @@ TROVE_DATASTORE_TYPE=${TROVE_DATASTORE_TYPE:-"mysql"}
|
||||
TROVE_DATASTORE_VERSION=${TROVE_DATASTORE_VERSION:-"5.6"}
|
||||
TROVE_DATASTORE_PACKAGE=${TROVE_DATASTORE_PACKAGE:-"mysql-server-5.6"}
|
||||
|
||||
# Configuration values listed here for reference
|
||||
TROVE_MAX_ACCEPTED_VOLUME_SIZE=${TROVE_MAX_ACCEPTED_VOLUME_SIZE}
|
||||
TROVE_MAX_INSTANCES_PER_TENANT=${TROVE_MAX_INSTANCES_PER_TENANT}
|
||||
TROVE_MAX_VOLUMES_PER_TENANT=${TROVE_MAX_VOLUMES_PER_TENANT}
|
||||
TROVE_AGENT_CALL_LOW_TIMEOUT=${TROVE_AGENT_CALL_LOW_TIMEOUT}
|
||||
TROVE_AGENT_CALL_HIGH_TIMEOUT=${TROVE_AGENT_CALL_HIGH_TIMEOUT}
|
||||
TROVE_RESIZE_TIME_OUT=${TROVE_RESIZE_TIME_OUT}
|
||||
TROVE_USAGE_TIMEOUT=${TROVE_USAGE_TIMEOUT}
|
||||
TROVE_STATE_CHANGE_WAIT_TIME=${TROVE_STATE_CHANGE_WAIT_TIME}
|
||||
|
||||
# Set up the host gateway
|
||||
if is_service_enabled neutron; then
|
||||
TROVE_HOST_GATEWAY=${PUBLIC_NETWORK_GATEWAY:-172.24.4.1}
|
||||
|
@ -134,11 +134,11 @@ common_opts = [
|
||||
help='Page size for listing configurations.'),
|
||||
cfg.IntOpt('modules_page_size', default=20,
|
||||
help='Page size for listing modules.'),
|
||||
cfg.IntOpt('agent_call_low_timeout', default=5,
|
||||
cfg.IntOpt('agent_call_low_timeout', default=15,
|
||||
help="Maximum time (in seconds) to wait for Guest Agent 'quick'"
|
||||
"requests (such as retrieving a list of users or "
|
||||
"databases)."),
|
||||
cfg.IntOpt('agent_call_high_timeout', default=60,
|
||||
cfg.IntOpt('agent_call_high_timeout', default=60 * 5,
|
||||
help="Maximum time (in seconds) to wait for Guest Agent 'slow' "
|
||||
"requests (such as restarting the database)."),
|
||||
cfg.IntOpt('agent_replication_snapshot_timeout', default=36000,
|
||||
@ -146,7 +146,7 @@ common_opts = [
|
||||
'Agent replication snapshot.'),
|
||||
# The guest_id opt definition must match the one in cmd/guest.py
|
||||
cfg.StrOpt('guest_id', default=None, help="ID of the Guest Instance."),
|
||||
cfg.IntOpt('state_change_wait_time', default=3 * 60,
|
||||
cfg.IntOpt('state_change_wait_time', default=60 * 10,
|
||||
help='Maximum time (in seconds) to wait for a state change.'),
|
||||
cfg.IntOpt('state_change_poll_time', default=3,
|
||||
help='Interval between state change poll requests (seconds).'),
|
||||
@ -169,12 +169,12 @@ common_opts = [
|
||||
cfg.StrOpt('mount_options', default='defaults,noatime',
|
||||
help='Options to use when mounting a volume.'),
|
||||
cfg.IntOpt('max_instances_per_tenant',
|
||||
default=5,
|
||||
default=10,
|
||||
help='Default maximum number of instances per tenant.',
|
||||
deprecated_name='max_instances_per_user'),
|
||||
cfg.IntOpt('max_accepted_volume_size', default=5,
|
||||
cfg.IntOpt('max_accepted_volume_size', default=10,
|
||||
help='Default maximum volume size (in GB) for an instance.'),
|
||||
cfg.IntOpt('max_volumes_per_tenant', default=20,
|
||||
cfg.IntOpt('max_volumes_per_tenant', default=40,
|
||||
help='Default maximum volume capacity (in GB) spanning across '
|
||||
'all Trove volumes per tenant.',
|
||||
deprecated_name='max_volumes_per_user'),
|
||||
@ -220,7 +220,7 @@ common_opts = [
|
||||
help='Maximum time (in seconds) to wait for a server reboot.'),
|
||||
cfg.IntOpt('dns_time_out', default=60 * 2,
|
||||
help='Maximum time (in seconds) to wait for a DNS entry add.'),
|
||||
cfg.IntOpt('resize_time_out', default=60 * 10,
|
||||
cfg.IntOpt('resize_time_out', default=60 * 15,
|
||||
help='Maximum time (in seconds) to wait for a server resize.'),
|
||||
cfg.IntOpt('revert_time_out', default=60 * 10,
|
||||
help='Maximum time (in seconds) to wait for a server resize '
|
||||
@ -390,7 +390,7 @@ common_opts = [
|
||||
help="Describes the actual network manager used for "
|
||||
"the management of network attributes "
|
||||
"(security groups, floating IPs, etc.)."),
|
||||
cfg.IntOpt('usage_timeout', default=900,
|
||||
cfg.IntOpt('usage_timeout', default=60 * 30,
|
||||
help='Maximum time (in seconds) to wait for a Guest to become '
|
||||
'active.'),
|
||||
cfg.IntOpt('restore_usage_timeout', default=36000,
|
||||
|
@ -461,7 +461,8 @@ class DbQuotaDriverTest(trove_testtools.TestCase):
|
||||
self.mock_quota_result.all = Mock(return_value=[])
|
||||
self.mock_usage_result.all = Mock(return_value=FAKE_QUOTAS)
|
||||
|
||||
delta = {'instances': 5, 'volumes': 3}
|
||||
max_inst = CONF.max_instances_per_tenant
|
||||
delta = {'instances': max_inst, 'volumes': 3}
|
||||
self.assertRaises(exception.QuotaExceeded,
|
||||
self.driver.reserve,
|
||||
FAKE_TENANT1,
|
||||
@ -484,7 +485,8 @@ class DbQuotaDriverTest(trove_testtools.TestCase):
|
||||
self.mock_quota_result.all = Mock(return_value=[])
|
||||
self.mock_usage_result.all = Mock(return_value=FAKE_QUOTAS)
|
||||
|
||||
delta = {'instances': 4, 'volumes': 2}
|
||||
max_inst = CONF.max_instances_per_tenant
|
||||
delta = {'instances': max_inst - 1, 'volumes': 2}
|
||||
self.assertRaises(exception.QuotaExceeded,
|
||||
self.driver.reserve,
|
||||
FAKE_TENANT1,
|
||||
|
Loading…
Reference in New Issue
Block a user