Skip to content

JIRA WDT-9 Create JDBC placeholders for use in cluster create and update #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions core/src/main/python/wlsdeploy/tool/create/domain_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,28 +557,18 @@ def __create_clusters_and_servers(self, location):
_method_name = '__create_clusters_and_servers'

self.logger.entering(str(location), class_name=self.__class_name, method_name=_method_name)

#
# In order for source domain provisioning to work with dynamic clusters, we have to provision
# the ServerTemplates. There is a cyclical dependency between Server Template and Clusters so we
# need for the ServerTemplates to exist before create clusters. Once the clusters are provisioned,
# then we can fully populate the ServerTemplates.
#
server_template_nodes = dictionary_utils.get_dictionary_element(self._topology, SERVER_TEMPLATE)
if len(server_template_nodes) > 0 and self._is_type_valid(location, SERVER_TEMPLATE):
st_location = LocationContext(location).append_location(SERVER_TEMPLATE)
st_mbean_type = self.alias_helper.get_wlst_mbean_type(st_location)
st_create_path = self.alias_helper.get_wlst_create_path(st_location)
self.wlst_helper.cd(st_create_path)

st_token_name = self.alias_helper.get_name_token(st_location)
for server_template_name in server_template_nodes:
st_name = self.wlst_helper.get_quoted_name_for_wlst(server_template_name)
if st_token_name is not None:
st_location.add_name_token(st_token_name, st_name)

st_mbean_name = self.alias_helper.get_wlst_mbean_name(st_location)
self.logger.info('WLSDPLY-12220', SERVER_TEMPLATE, st_mbean_name)
self.wlst_helper.create(st_mbean_name, st_mbean_type)
self.topology_helper.create_placeholder_server_templates(self._topology)

# create placeholders for JDBC resources that may be referenced in cluster definition.
resources_dict = self.model.get_model_resources()
self.topology_helper.create_placeholder_jdbc_resources(resources_dict)

cluster_nodes = dictionary_utils.get_dictionary_element(self._topology, CLUSTER)
if len(cluster_nodes) > 0:
Expand All @@ -587,6 +577,7 @@ def __create_clusters_and_servers(self, location):
#
# Now, fully populate the ServerTemplates, if any.
#
server_template_nodes = dictionary_utils.get_dictionary_element(self._topology, SERVER_TEMPLATE)
if len(server_template_nodes) > 0:
self._create_named_mbeans(SERVER_TEMPLATE, server_template_nodes, location, log_created=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def update(self):
# avoid circular references between clusters and server templates
self._topology_helper.create_placeholder_server_templates(self._topology)

# create placeholders for JDBC resources that may be referenced in cluster definition.
self._topology_helper.create_placeholder_jdbc_resources(self._resources)

self._process_section(self._topology, folder_list, CLUSTER, location)
self._process_section(self._topology, folder_list, SERVER_TEMPLATE, location)
self._process_section(self._topology, folder_list, SERVER, location)
Expand Down
26 changes: 26 additions & 0 deletions core/src/main/python/wlsdeploy/tool/util/topology_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from wlsdeploy.aliases.location_context import LocationContext
from wlsdeploy.aliases.model_constants import CLUSTER
from wlsdeploy.aliases.model_constants import COHERENCE_CLUSTER_SYSTEM_RESOURCE
from wlsdeploy.aliases.model_constants import JDBC_SYSTEM_RESOURCE
from wlsdeploy.aliases.model_constants import SERVER
from wlsdeploy.aliases.model_constants import SERVER_TEMPLATE
from wlsdeploy.tool.util.alias_helper import AliasHelper
Expand Down Expand Up @@ -87,3 +88,28 @@ def create_placeholder_server_templates(self, topology):
deployer_utils.create_and_cd(template_location, existing_names, self.alias_helper)

self.wlst_helper.cd(original_location)

def create_placeholder_jdbc_resources(self, resources):
"""
Create a placeholder JDBC resource for each name in the resources section.
This is necessary because cluster attributes may reference JDBC resources.
:param resources: the resource model nodes
"""
_method_name = 'create_placeholder_jdbc_resources'
original_location = self.wlst_helper.get_pwd()
resource_location = LocationContext().append_location(JDBC_SYSTEM_RESOURCE)

if self.alias_helper.get_wlst_mbean_type(resource_location) is not None:
existing_names = deployer_utils.get_existing_object_list(resource_location, self.alias_helper)

jdbc_nodes = dictionary_utils.get_dictionary_element(resources, JDBC_SYSTEM_RESOURCE)
for jdbc_name in jdbc_nodes:
if jdbc_name not in existing_names:
self.logger.info('WLSDPLY-19401', jdbc_name, class_name=self.__class_name,
method_name=_method_name)

jdbc_token = self.alias_helper.get_name_token(resource_location)
resource_location.add_name_token(jdbc_token, jdbc_name)
deployer_utils.create_and_cd(resource_location, existing_names, self.alias_helper)

self.wlst_helper.cd(original_location)
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"ClusterType": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ClusterType", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "restart_required": "true" } ],
"CoherenceClusterSystemResource": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "CoherenceClusterSystemResource", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_coherence_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.CoherenceClusterSystemResourceMBean}", "restart_required": "true" } ],
"ConcurrentSingletonActivationEnabled": [ {"version": "[12.2.1.3,)", "wlst_mode": "both", "wlst_name": "ConcurrentSingletonActivationEnabled", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean", "restart_required": "true" } ],
"ConsensusParticipants": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ConsensusParticipants", "wlst_path": "WP001", "value": {"default": 0 }, "wlst_type": "integer", "get_method": "${LSA:GET}", "get_mbean_type": "${:JDBCSystemResourceMBean}", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}", "restart_required": true } ],
"ConsensusParticipants": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "ConsensusParticipants", "wlst_path": "WP001", "value": {"default": 0 }, "wlst_type": "integer" } ],
"DataSourceForAutomaticMigration": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DataSourceForAutomaticMigration", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}", "restart_required": "true" } ],
"DataSourceForJobScheduler": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DataSourceForJobScheduler", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}" } ],
"DataSourceForSessionPersistence": [ {"version": "[10,)", "wlst_mode": "both", "wlst_name": "DataSourceForSessionPersistence", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "set_method": "${:MBEAN.set_data_source_mbean}", "set_mbean_type": "${:weblogic.management.configuration.JDBCSystemResourceMBean}", "restart_required": "true" } ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ WLSDPLY-19307=Unable to extract classpath libraries from archive file {0} to dom

# wlsdeploy/tool/util/topology_helper.py
WLSDPLY-19400=Creating placeholder for server template {0}
WLSDPLY-19401=Creating placeholder for JDBC resource {0}

# wlsdeploy/tool/util/variable_injector.py
WLSDPLY-19500=Model variable injector values loaded from location {0}
Expand Down