fix get 'force' parameter from parameters

When we use parameter.get('force',False), if 'force' in parameters,
we will get a string 'True' or 'False', which type is not boolean.

Change-Id: Iaab3aee377857dc1d431531dc150520365a93482
This commit is contained in:
fudunwei 2020-12-09 15:24:52 +08:00
parent fcca3935af
commit 2a7720a85c
3 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,7 @@ from karbor.services.protection import protection_plugin
from karbor.services.protection.protection_plugins.share \
import share_snapshot_plugin_schemas as share_schemas
from karbor.services.protection.protection_plugins import utils
from karbor.utils import get_bool_param
from manilaclient import exceptions as manila_exc
from oslo_config import cfg
from oslo_log import log as logging
@ -137,7 +138,7 @@ class ProtectOperation(protection_plugin.Operation):
}
snapshot_name = parameters.get('snapshot_name', None)
description = parameters.get('description', None)
force = parameters.get('force', False)
force = get_bool_param('force', parameters)
try:
snapshot_id = self._create_snapshot(manila_client, share_id,
snapshot_name,

View File

@ -24,7 +24,7 @@ from karbor.services.protection import protection_plugin
from karbor.services.protection.protection_plugins import utils
from karbor.services.protection.protection_plugins.volume \
import volume_plugin_cinder_schemas as cinder_schemas
from karbor.utils import get_bool_param
LOG = logging.getLogger(__name__)
@ -202,7 +202,7 @@ class ProtectOperation(protection_plugin.Operation):
description = parameters.get('description', None)
backup_mode = parameters.get('backup_mode', "full")
container = parameters.get('container', None)
force = parameters.get('force', False)
force = get_bool_param('force', parameters)
incremental = False
if backup_mode == "incremental":
incremental = True

View File

@ -24,6 +24,7 @@ from karbor.services.protection import protection_plugin
from karbor.services.protection.protection_plugins import utils
from karbor.services.protection.protection_plugins.volume \
import volume_snapshot_plugin_schemas as volume_schemas
from karbor.utils import get_bool_param
LOG = logging.getLogger(__name__)
@ -136,7 +137,7 @@ class ProtectOperation(protection_plugin.Operation):
}
snapshot_name = parameters.get('snapshot_name', None)
description = parameters.get('description', None)
force = parameters.get('force', False)
force = get_bool_param('force', parameters)
try:
snapshot_id = self._create_snapshot(cinder_client, volume_id,
snapshot_name,