Skip to content

Commit dac1eb7

Browse files
Wdt 516 dynamic cluster size (#789)
* DynamicClusterSize attribute not supported in 12.1.3. Used for testing for dynamic servers * Use the correct dynamic server size based on WebLogic version
1 parent 3bf40be commit dac1eb7

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
MAIL_SESSION = 'MailSession'
176176
MAIL_SESSION_OVERRIDE = 'MailSessionOverride'
177177
MAIL_SESSION_PROPERTIES = 'Properties'
178+
MAX_DYNAMIC_SERVER_COUNT = 'MaximumDynamicServerCount'
178179
MAX_THREADS_CONSTRAINT = 'MaxThreadsConstraint'
179180
MIGRATABLE_TARGET = 'MigratableTarget'
180181
MIN_THREADS_CONSTRAINT = 'MinThreadsConstraint'

core/src/main/python/wlsdeploy/tool/deploy/deployer_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from wlsdeploy.aliases.model_constants import JDBC_DRIVER_PARAMS
2525
from wlsdeploy.aliases.model_constants import JDBC_RESOURCE
2626
from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE
27+
from wlsdeploy.aliases.model_constants import MAX_DYNAMIC_SERVER_COUNT
2728
from wlsdeploy.aliases.model_constants import SERVER
2829
from wlsdeploy.aliases.model_constants import SERVER_NAME_PREFIX
2930
from wlsdeploy.aliases.model_constants import SERVER_NAME_START_IDX
@@ -570,7 +571,11 @@ def check_if_dynamic_cluster(server_name, cluster_name, aliases):
570571
_wlst_helper.cd(attr_path)
571572
except DeployException:
572573
return False
573-
attr_name = aliases.get_wlst_attribute_name(location, DYNAMIC_CLUSTER_SIZE)
574+
present, __ = aliases.is_valid_model_attribute_name(location, DYNAMIC_CLUSTER_SIZE)
575+
if present == ValidationCodes.VALID:
576+
attr_name = aliases.get_wlst_attribute_name(location, DYNAMIC_CLUSTER_SIZE)
577+
else:
578+
attr_name = aliases.get_wlst_attribute_name(location, MAX_DYNAMIC_SERVER_COUNT)
574579
dynamic_size = _wlst_helper.get(attr_name)
575580
attr_name = aliases.get_wlst_attribute_name(location, SERVER_NAME_PREFIX)
576581
prefix = _wlst_helper.get(attr_name)

core/src/main/python/wlsdeploy/tool/discover/topology_discoverer.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,9 +767,16 @@ def _dynamic_server(self, server, location):
767767
if self._wlst_helper.path_exists(wlst_path):
768768
_logger.fine('WLSDPLY-06613', server, class_name=_class_name, method_name=_method_name)
769769
self._wlst_helper.cd(wlst_path)
770-
attr_name = self._aliases.get_wlst_attribute_name(cluster_location,
771-
model_constants.DYNAMIC_CLUSTER_SIZE)
770+
present, __ = self._aliases.is_valid_model_attribute_name(location,
771+
model_constants.DYNAMIC_CLUSTER_SIZE)
772+
if present == ValidationCodes.VALID:
773+
attr_name = self._aliases.get_wlst_attribute_name(cluster_location,
774+
model_constants.DYNAMIC_CLUSTER_SIZE)
775+
else:
776+
attr_name = self._aliases.get_wlst_attribute_name(cluster_location,
777+
model_constants.MAX_DYNAMIC_SERVER_COUNT)
772778
dynamic_size = self._wlst_helper.get(attr_name)
779+
773780
attr_name = self._aliases.get_wlst_attribute_name(cluster_location,
774781
model_constants.SERVER_NAME_PREFIX)
775782
prefix = self._wlst_helper.get(attr_name)

core/src/main/python/wlsdeploy/tool/extract/domain_resource_extractor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ def _update_resource_dictionary(self, resource_dict):
245245
cluster_list = list()
246246
spec_section[CLUSTERS] = cluster_list
247247
for cluster_name, cluster_values in model_clusters.items():
248-
server_count = k8s_helper.get_server_count(cluster_name, cluster_values, self._model.get_model())
248+
server_count = k8s_helper.get_server_count(cluster_name, cluster_values, self._model.get_model(),
249+
self._aliases)
249250
cluster_dict = PyOrderedDict()
250251
cluster_dict[CLUSTER_NAME] = cluster_name
251252
cluster_dict[REPLICAS] = server_count

core/src/main/python/wlsdeploy/tool/util/k8s_helper.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
import re
99

1010
from wlsdeploy.aliases import alias_utils
11+
from wlsdeploy.aliases.location_context import LocationContext
1112
from wlsdeploy.aliases.model_constants import CLUSTER
1213
from wlsdeploy.aliases.model_constants import DYNAMIC_CLUSTER_SIZE
1314
from wlsdeploy.aliases.model_constants import DYNAMIC_SERVERS
15+
from wlsdeploy.aliases.model_constants import MAX_DYNAMIC_SERVER_COUNT
1416
from wlsdeploy.aliases.model_constants import SERVER
1517
from wlsdeploy.aliases.model_constants import TOPOLOGY
18+
from wlsdeploy.aliases.validation_codes import ValidationCodes
1619
from wlsdeploy.util import dictionary_utils
1720

1821

@@ -29,18 +32,28 @@ def get_domain_uid(domain_name):
2932
return result
3033

3134

32-
def get_server_count(cluster_name, cluster_values, model_dictionary):
35+
def get_server_count(cluster_name, cluster_values, model_dictionary, aliases):
3336
"""
3437
Determine the number of servers associated with a cluster.
3538
:param cluster_name: the name of the cluster
3639
:param cluster_values: the value map for the cluster
3740
:param model_dictionary: the model dictionary
41+
:param aliases: aliases instance for validation
3842
:return: the number of servers
3943
"""
4044
if DYNAMIC_SERVERS in cluster_values:
4145
# for dynamic clusters, return the value of DynamicClusterSize
4246
dynamic_servers_dict = cluster_values[DYNAMIC_SERVERS]
43-
cluster_size_value = dictionary_utils.get_element(dynamic_servers_dict, DYNAMIC_CLUSTER_SIZE)
47+
location = LocationContext()
48+
location.append_location(CLUSTER)
49+
location.add_name_token(aliases.get_name_token(location), 'cluster')
50+
location.append_location(DYNAMIC_SERVERS)
51+
location.add_name_token(aliases.get_name_token(location), 'server')
52+
present, __ = aliases.is_valid_model_attribute_name(location, DYNAMIC_CLUSTER_SIZE)
53+
if present == ValidationCodes.VALID:
54+
cluster_size_value = dictionary_utils.get_element(dynamic_servers_dict, DYNAMIC_CLUSTER_SIZE)
55+
else:
56+
cluster_size_value = dictionary_utils.get_element(dynamic_servers_dict, MAX_DYNAMIC_SERVER_COUNT)
4457
if cluster_size_value is not None:
4558
return alias_utils.convert_to_type('integer', cluster_size_value)
4659
else:

core/src/main/python/wlsdeploy/tool/util/targets/additional_output_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _build_template_hash(model, model_context, aliases, credential_injector):
133133
cluster_hash[CLUSTER_NAME] = cluster_name
134134

135135
cluster_values = dictionary_utils.get_dictionary_element(cluster_list, cluster_name)
136-
server_count = k8s_helper.get_server_count(cluster_name, cluster_values, model.get_model())
136+
server_count = k8s_helper.get_server_count(cluster_name, cluster_values, model.get_model(), aliases)
137137
cluster_hash[REPLICAS] = str(server_count)
138138
clusters.append(cluster_hash)
139139

0 commit comments

Comments
 (0)