From d7782f41c3b1fc290abca1f85f305258ddd5c726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=A1gr?= Date: Tue, 4 Aug 2015 15:07:37 +0200 Subject: [PATCH] Remove deleted Cinder rows Creates cron job running every 24 hours for "cinder-manage db purge" Partial-bug: rhbz#1249106 Depends-On: I677f2ef3d9ca81fff0f672c8e34b6e4278674a96 Change-Id: I9ec5b570feb0e9a415c432aea12e6d63f6fbf833 --- docs/packstack.rst | 3 +++ packstack/plugins/cinder_250.py | 16 ++++++++++++++++ packstack/puppet/templates/cinder.pp | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/docs/packstack.rst b/docs/packstack.rst index 01f79d154..d8f645421 100644 --- a/docs/packstack.rst +++ b/docs/packstack.rst @@ -465,6 +465,9 @@ Cinder Config parameters **CONFIG_CINDER_DB_PW** Password to use for the Block Storage service (cinder) to access the database. +**CONFIG_CINDER_DB_PURGE_ENABLE** + Enter y if cron job for removing soft deleted DB rows should be created. + **CONFIG_CINDER_KS_PW** Password to use for the Block Storage service to authenticate with the Identity service. diff --git a/packstack/plugins/cinder_250.py b/packstack/plugins/cinder_250.py index d28d1f15d..61e5474ba 100644 --- a/packstack/plugins/cinder_250.py +++ b/packstack/plugins/cinder_250.py @@ -58,6 +58,22 @@ def initConfig(controller): "NEED_CONFIRM": True, "CONDITION": False}, + {"CMD_OPTION": 'cinder-db-purge-enable', + "PROMPT": ( + "Enter y if cron job for removing soft deleted DB rows " + "should be created" + ), + "OPTION_LIST": ['y', 'n'], + "VALIDATORS": [validators.validate_not_empty], + "PROCESSORS": [processors.process_bool], + "DEFAULT_VALUE": 'y', + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": 'CONFIG_CINDER_DB_PURGE_ENABLE', + "USE_DEFAULT": False, + "NEED_CONFIRM": True, + "CONDITION": False}, + {"CMD_OPTION": "cinder-ks-passwd", "PROMPT": "Enter the password for the Cinder Keystone access", "OPTION_LIST": [], diff --git a/packstack/puppet/templates/cinder.pp b/packstack/puppet/templates/cinder.pp index 10872ccb9..9ad524c39 100644 --- a/packstack/puppet/templates/cinder.pp +++ b/packstack/puppet/templates/cinder.pp @@ -37,3 +37,12 @@ Cinder::Type { class { '::cinder::backends': enabled_backends => hiera_array('CONFIG_CINDER_BACKEND'), } + +$db_purge = hiera('CONFIG_CINDER_DB_PURGE_ENABLE') +if $db_purge { + class { '::cinder::cron::db_purge': + hour => '*/24', + destination => '/dev/null', + age => 1 + } +}