Added option to disable sahara db for storing job binaries.
Now it's possible to disable internal-db to upload new job-binaries. All other manipulations (GET, DELETE, PATCH) are still posible not to break existing workloads and ability to run jobs with already created job binary internals. Special configuration option added for that. Change-Id: I53d77d126e949ee0964608062986e82c91ba902f Closes-Bug: #1585889
This commit is contained in:
parent
83dd382bd2
commit
78beeb1c0f
@ -51,7 +51,10 @@ edp_opts = [
|
||||
default=300,
|
||||
help='Timeout for canceling job execution (in seconds). '
|
||||
'Sahara will try to cancel job execution during '
|
||||
'this time.')
|
||||
'this time.'),
|
||||
cfg.BoolOpt('edp_internal_db_enabled',
|
||||
default=True,
|
||||
help='Use Sahara internal db to store job binaries.')
|
||||
]
|
||||
|
||||
db_opts = [
|
||||
|
@ -14,12 +14,16 @@
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
import sahara.exceptions as e
|
||||
from sahara.i18n import _LW
|
||||
import sahara.service.validations.edp.base as b
|
||||
import sahara.service.validations.edp.job_binary_internal as j_b_i
|
||||
from sahara.swift import utils as su
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def check_job_binary(data, **kwargs):
|
||||
@ -28,6 +32,9 @@ def check_job_binary(data, **kwargs):
|
||||
|
||||
if job_binary_url:
|
||||
if job_binary_url.startswith("internal-db"):
|
||||
if not j_b_i.is_internal_db_enabled():
|
||||
LOG.warning(_LW(
|
||||
'Sahara inernal db is disabled for storing job binaries.'))
|
||||
internal_uid = job_binary_url.replace(
|
||||
"internal-db://", '')
|
||||
b.check_job_binary_internal_exists(internal_uid)
|
||||
|
@ -13,12 +13,25 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
import sahara.exceptions as e
|
||||
from sahara.i18n import _
|
||||
from sahara.utils import api_validator as a
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
def is_internal_db_enabled():
|
||||
if not CONF.edp_internal_db_enabled:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def check_job_binary_internal(data, **kwargs):
|
||||
if not is_internal_db_enabled():
|
||||
raise e.BadJobBinaryInternalException(
|
||||
_("Sahara internal db is disabled for storing job binaries."))
|
||||
if not (type(data) is str and len(data) > 0):
|
||||
raise e.BadJobBinaryInternalException()
|
||||
if "name" in kwargs:
|
||||
|
Loading…
Reference in New Issue
Block a user