From 1622dd9095b94cce047db3f5b04aa60f821c2c9a Mon Sep 17 00:00:00 2001 From: crountre Date: Tue, 11 Jun 2019 10:11:23 -0500 Subject: [PATCH 1/4] Jira:WDT-346 fix reported issue and other known problems with dynamic cluster targeting --- KnownIssues.md | 13 ++ .../wlsdeploy/tool/create/domain_creator.py | 4 +- .../wlsdeploy/tool/deploy/topology_updater.py | 4 +- .../wlsdeploy/tool/util/target_helper.py | 119 ++++++++++++------ .../deploy/messages/wlsdeploy_rb.properties | 7 +- 5 files changed, 100 insertions(+), 47 deletions(-) diff --git a/KnownIssues.md b/KnownIssues.md index 29e0dd922b..327cc94269 100644 --- a/KnownIssues.md +++ b/KnownIssues.md @@ -1,5 +1,18 @@ The following list are known issues. The issue may contain a work-around or an associated Issue number. +**ISSUE**: + The createDomain tool does not target non-JRF product resources to dynamic clusters. + WebLogic WLST will not assign resources associated with extension template or custom template user server groups + to dynamic clusters or dynamic servers. The createDomain can target any resources associated to JRF + related user server groups using the FMW WLST extension function applyJRF. + +**ACTION**: + 1. Contact WebLogic support concerning the inability to target non-JRF resources to a dynamic cluster. + 2. Manually target the resources to the dynamic cluster. + 3. Add a configured managed server to your dynamic cluster. The dynamic cluster will become a "mixed" cluster. The + extension template or custom template resources will then be targeted to both the managed server and the + dynamic servers in the mixed cluster. + **ISSUE**: The discoverDomain STDOUT contains many SEVERE messages about cd() and ls() when it is run against a 12.2.1 domain. The discover tool navigates through the domain MBeans using wlst to determine which MBeans are present in a diff --git a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py index a6da16204a..81975737f6 100644 --- a/core/src/main/python/wlsdeploy/tool/create/domain_creator.py +++ b/core/src/main/python/wlsdeploy/tool/create/domain_creator.py @@ -484,13 +484,13 @@ def __create_domain_with_select_template(self, domain_home): server_groups_to_target = self._domain_typedef.get_server_groups_to_target() server_assigns, dynamic_assigns = self.target_helper.target_server_groups_to_servers(server_groups_to_target) - if server_assigns is not None: + if len(server_assigns) > 0: self.target_helper.target_server_groups(server_assigns) self.wlst_helper.write_domain(domain_home) self.wlst_helper.close_template() - if dynamic_assigns is not None: + if len(dynamic_assigns) > 0: self.target_helper.target_server_groups_to_dynamic_clusters(dynamic_assigns) self.logger.exiting(class_name=self.__class_name, method_name=_method_name) diff --git a/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py b/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py index 6c05d03df8..078f5c665b 100644 --- a/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py +++ b/core/src/main/python/wlsdeploy/tool/deploy/topology_updater.py @@ -129,11 +129,11 @@ def update(self): server_groups_to_target = self._domain_typedef.get_server_groups_to_target() server_assigns, dynamic_assigns = \ self.target_helper.target_server_groups_to_servers(server_groups_to_target) - if dynamic_assigns is not None: + if len(dynamic_assigns) > 0: self.wlst_helper.save_and_close(self.model_context) self.target_helper.target_server_groups_to_dynamic_clusters(dynamic_assigns) self.wlst_helper.reopen(self.model_context) - if server_assigns is not None: + if len(server_assigns) > 0: self.target_helper.target_server_groups(server_assigns) elif self._domain_typedef.is_jrf_domain_type(): self.target_helper.target_jrf_groups_to_clusters_servers() diff --git a/core/src/main/python/wlsdeploy/tool/util/target_helper.py b/core/src/main/python/wlsdeploy/tool/util/target_helper.py index 285e3e496a..e1ed3e3bb6 100644 --- a/core/src/main/python/wlsdeploy/tool/util/target_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/target_helper.py @@ -4,7 +4,9 @@ """ import copy -import oracle.weblogic.deploy.util.StringUtils as StringUtils + +import java.lang.Boolean as Boolean + import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict import wlsdeploy.util.dictionary_utils as dictionary_utils @@ -140,32 +142,52 @@ def target_server_groups_to_servers(self, server_groups_to_target): method_name=_method_name) final_assignment_map = dict() - if len(server_names) > 0: + dynamic_cluster_assigns = dict() + # Target servers and dynamic clusters to the server group resources + if len(server_names) > 0 or len(dynamic_cluster_names) > 0: for server, server_groups in server_to_server_groups_map.iteritems(): - if server in server_names and len(server_groups) > 0: - final_assignment_map[server] = server_groups - - elif len(server_names) == 0 and len(dynamic_cluster_names) == 0: - # - # Domain has no managed servers and there were not targeting limits specified to target - # server groups to the admin server so make sure that the server groups are targeted to - # the admin server. - # - # This is really a best effort attempt. It works for JRF domains but it is certainly possible - # that it may cause problems with other custom domain types. Of course, creating a domain with - # no managed servers is not a primary use case of this tool so do it and hope for the best... - # - final_assignment_map[server_names[0]] = server_groups_to_target - - # Target any dynamic clusters to the server group resources - dynamic_cluster_assigns = None - if len(dynamic_cluster_names) > 0: - dynamic_cluster_assigns = dict() - for name in dynamic_cluster_names: - if name in server_to_server_groups_map: - dynamic_cluster_assigns[name] = server_to_server_groups_map[name] - - self.logger.exiting(result=str(dynamic_cluster_assigns), class_name=self.__class_name, method_name=_method_name) + if len(server_groups) > 0: + if server in server_names: + final_assignment_map[server] = server_groups + elif server in dynamic_cluster_names: + dynamic_cluster_assigns[server] = server_groups + + # + # Domain has not targeted the server groups to managed servers (configured), or the + # domain has no managed servers (configured) but has user server groups. The resources for the + # user server groups must be targeted before the write/update domain or the write/update will fail. + # Thus assign the user server groups to the admin server. + # + # Because of the interaction of the working context in the different wlst helpers, the dynamic + # clusters will be applied to the resources separately and after the write/update domain. + # + # (From original blurb) + # This is really a best effort attempt. It works for JRF domains but it is certainly possible + # that it may cause problems with other custom domain types. Of course, creating a domain with + # no managed servers is not a primary use case of this tool so do it and hope for the best... + # + # (New comment) + # As we have added the intricacies of the dynamic clusters, if the targeting is to dynamic + # clusters only, the set server groups with the admin server will get through the write/update domain + # and the applyJRF with the dynamic cluster should theoretically unset the AdminServer on the user server + # groups. It works with JRF type domains. + + if len(server_groups_to_target) > 0: + if len(final_assignment_map) == 0: + # This is a quickie to fix the issue where server groups are not targeted because no configured + # managed servers exist in the domain + final_assignment_map[server_names[0]] = server_groups_to_target + else: + # If a server group or groups is not targeted in the assignments, log it to stdout + no_targets = [server_target for server_target in server_groups_to_target if server_target not in + [server_target for row in final_assignment_map.itervalues() for + server_target in server_groups_to_target if server_target in row]] + if len(no_targets) > 0: + self.logger.info('WLSDPLY-12248', no_targets, + class_name=self.__class_name, method_name=_method_name) + + self.logger.exiting(result=str(dynamic_cluster_assigns), + class_name=self.__class_name, method_name=_method_name) return final_assignment_map, dynamic_cluster_assigns def target_server_groups(self, server_assigns): @@ -200,15 +222,14 @@ def target_server_groups_to_dynamic_clusters(self, dynamic_cluster_assigns): domain_typedef = self.model_context.get_domain_typedef() if len(dynamic_cluster_assigns) > 0: + self.logger.info('WLSDPLY-12247', class_name=self.__class_name, method_name=_method_name) # TBD assign server group resources to cluster. The JRF resources could still be applied separately # using this technique - or remove this technique and replace with the resource targeting if domain_typedef.has_jrf_resources(): self._target_jrf_resources(dynamic_cluster_assigns) else: - ex = exception_helper.create_exception(self.exception_type, 'WLSDPLY-12238', - domain_typedef.get_domain_type()) - self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) - raise ex + self.logger.warning('WLSDPLY-12238', domain_typedef.get_domain_type(), + class_name=self.__class_name, method_name=_method_name) self.logger.exiting(class_name=self.__class_name, method_name=_method_name) return @@ -357,7 +378,7 @@ def _get_server_group_targeting_limits(self, server_group_targeting_limits, clus if DYNAMIC_SERVERS in cluster_members: # This will need special handling to target server group resources cluster_members.remove(DYNAMIC_SERVERS) - cluster_members.add(target_name) + cluster_members.append(target_name) new_list.extend(cluster_members) else: # Assume it is a server name and add it to the new list @@ -385,21 +406,23 @@ def _get_server_to_server_groups_map(self, admin_server_name, server_names, dyna self.logger.entering(admin_server_name, str(server_names), str(server_groups), str(sg_targeting_limits), class_name=self.__class_name, method_name=_method_name) result = OrderedDict() + revised_server_groups = self._revised_list_server_groups(server_groups, sg_targeting_limits) for server_name in server_names: server_groups_for_server = self.__get_server_groups_for_entity(server_name, sg_targeting_limits) - if server_groups_for_server is not None: + if len(server_groups_for_server) > 0: result[server_name] = server_groups_for_server elif server_name != admin_server_name: # By default, we only target managed servers unless explicitly listed in the targeting limits - result[server_name] = list(server_groups) + result[server_name] = list(revised_server_groups) else: result[admin_server_name] = list() for cluster_name in dynamic_cluster_names: - server_groups_for_cluster = self.__get_server_groups_for_entity(cluster_name, sg_targeting_limits) - if server_groups_for_cluster is not None: + server_groups_for_cluster = \ + self.__get_server_groups_for_entity(cluster_name, sg_targeting_limits) + if len(server_groups_for_cluster) > 0: result[cluster_name] = server_groups_for_cluster else: - result[cluster_name] = list(server_groups) + result[cluster_name] = list(revised_server_groups) self.logger.finer('WLSDPLY-12239', result[cluster_name], cluster_name, class_name=self.__class_name, method_name=_method_name) if admin_server_name not in result: @@ -407,6 +430,23 @@ def _get_server_to_server_groups_map(self, admin_server_name, server_names, dyna self.logger.exiting(class_name=self.__class_name, method_name=_method_name, result=result) return result + def _revised_list_server_groups(self, server_groups, sg_targeting_limits): + """ + Remove all server groups that are explicitly targeted to a cluster, server set or stand-alone + managed server. + :param server_groups: list of server groups applied by the extension templates + :param sg_targeting_limits: list of targeting from the domainInfo section + :return: server group list with the specific targeted server groups removed + """ + _method_name = '_revised_list_server_groups' + self.logger.entering(sg_targeting_limits, class_name=self.__class_name, method_name=_method_name) + result = list() + targeted_server_groups = sg_targeting_limits.keys() + for server_group in server_groups: + if server_group not in targeted_server_groups: + result.append(server_group) + return result + def __get_server_groups_for_entity(self, entity_name, sg_targeting_limits): """ Get the servers groups to target for a given server or dynamic cluster name. @@ -416,14 +456,11 @@ def __get_server_groups_for_entity(self, entity_name, sg_targeting_limits): if the entity name does not appear in the targeting limits """ _method_name = '__get_server_groups_for_entity' - - result = None + result = list() for server_group, entity_names_list in sg_targeting_limits.iteritems(): if entity_name in entity_names_list: - if result is None: - result = list() result.append(server_group) - if result is not None: + if len(result) > 0: self.logger.fine('WLSDPLY-12243', entity_name, result, class_name=self.__class_name, method_name=_method_name) return result diff --git a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties index 9a4b899ade..46a22edf6e 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties +++ b/core/src/main/resources/oracle/weblogic/deploy/messages/wlsdeploy_rb.properties @@ -1073,8 +1073,8 @@ WLSDPLY-12234=Unable to copy domain library {0} to directory {1} WLSDPLY-12235=Installing domain library {0} to lib directory of {1} WLSDPLY-12236=Target the JRF resources to the clusters with dynamic servers {0} WLSDPLY-12237=Target the resources for server groups {0} to cluster {1} with dynamic server members -WLSDPLY-12238=Unable to target template server groups for domain type {0} to dynamic clusters. This will \ - be available in a follow-up release of WebLogic Deploy Tooling. +WLSDPLY-12238=Unable to target non-JRF template server groups for domain type {0} to dynamic cluster(s). + WLSDPLY-12239=Found server groups {0} for cluster {1} WLSDPLY-12240=Server group targeting limits {0} found in model WLSDPLY-12242=The assignment of servers to server groups map is {0} @@ -1083,6 +1083,9 @@ WLSDPLY-12244=Targeting JRF resources to a dynamic cluster(s), {0}, for a Restri when updating in online mode WLSDPLY-12245=Selecting custom extension template named {0} WLSDPLY-12246=Adding custom extension template file {0} to domain +WLSDPLY-12247=WebLogic does not support targeting resources to dynamic servers. JRF product related resources \ + will be targeted to the dynamic cluster using the applyJRF function. +WLSDPLY-12248=The server group(s) {0} will not be targeted to the Admin server or a configured manage server # domain_typedef.py WLSDPLY-12300={0} got the domain type {1} but the domain type definition file {2} was not valid: {3} From 39b9d4cccb522ca0c37b26aaebc7b8280acf4b56 Mon Sep 17 00:00:00 2001 From: crountre Date: Tue, 11 Jun 2019 13:52:32 -0500 Subject: [PATCH 2/4] Remove unused import statement and merge master --- core/src/main/python/wlsdeploy/tool/util/target_helper.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/src/main/python/wlsdeploy/tool/util/target_helper.py b/core/src/main/python/wlsdeploy/tool/util/target_helper.py index e1ed3e3bb6..fbc6c58a9f 100644 --- a/core/src/main/python/wlsdeploy/tool/util/target_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/target_helper.py @@ -5,8 +5,6 @@ import copy -import java.lang.Boolean as Boolean - import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict import wlsdeploy.util.dictionary_utils as dictionary_utils @@ -18,7 +16,6 @@ from wlsdeploy.aliases.model_constants import MODEL_LIST_DELIMITER from wlsdeploy.aliases.model_constants import SERVER from wlsdeploy.aliases.model_constants import SERVER_GROUP_TARGETING_LIMITS -from wlsdeploy.exception import exception_helper from wlsdeploy.tool.util.alias_helper import AliasHelper from wlsdeploy.tool.util.wlst_helper import WlstHelper from wlsdeploy.util import string_utils From c9dbea2882a4a91bd5b542e4053389caa5f6f4c5 Mon Sep 17 00:00:00 2001 From: crountre Date: Tue, 11 Jun 2019 17:32:07 -0500 Subject: [PATCH 3/4] Added suggested changes to known issues documentation --- KnownIssues.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/KnownIssues.md b/KnownIssues.md index 327cc94269..e77c38cb3b 100644 --- a/KnownIssues.md +++ b/KnownIssues.md @@ -1,17 +1,29 @@ The following list are known issues. The issue may contain a work-around or an associated Issue number. **ISSUE**: - The createDomain tool does not target non-JRF product resources to dynamic clusters. - WebLogic WLST will not assign resources associated with extension template or custom template user server groups - to dynamic clusters or dynamic servers. The createDomain can target any resources associated to JRF - related user server groups using the FMW WLST extension function applyJRF. + The createDomain and updateDomain tools cannot target non-JRF product resources to dynamic clusters because + WebLogic WLST will not assign resources associated with extension or custom template user server groups + to dynamic clusters. Resources associated to JRF user server groups defined in the domain typedef + (i.e. JRF, RestrictedJRF) will be targeted to the dynamic cluster by the WDT tools using the FMW WLST function + applyJRF. + + If you have only non-JRF user server groups targeted to a dynamic cluster, you will see the following message: + + WLSDPLY-12238: Unable to target non-JRF template server groups for domain type CUSTOM to dynamic cluster(s). + + You will not see this message if you have a mix of non-JRF and JRF user server groups targeted to the dynamic + cluster. WDT cannot detect if a user server group is associated to JRF, and therefore, whether the applyJRF will + target the user group resources to the dynamic cluster. **ACTION**: - 1. Contact WebLogic support concerning the inability to target non-JRF resources to a dynamic cluster. - 2. Manually target the resources to the dynamic cluster. - 3. Add a configured managed server to your dynamic cluster. The dynamic cluster will become a "mixed" cluster. The - extension template or custom template resources will then be targeted to both the managed server and the - dynamic servers in the mixed cluster. + + You must contact WebLogic support to assist you with a solution for this targeting dilemma. You can perform + the following action as a temporary work-around to the described issue. + + 1. Add a configured managed server to your dynamic cluster and re-run the createDomain or updateDomain tool. + The dynamic cluster becomes "mixed" cluster once the managed server is added. When the WDT tool targets the + user server groups to the configured managed server, the resources are automatically targeted to the cluster + by WebLogic, which includes the managed server and the dynamic servers. **ISSUE**: The discoverDomain STDOUT contains many SEVERE messages about cd() and ls() when it is run against a 12.2.1 domain. From 47ae3fd0cb548d179ac353307073a4934fdf8a40 Mon Sep 17 00:00:00 2001 From: Carolyn Rountree Date: Tue, 11 Jun 2019 17:35:55 -0500 Subject: [PATCH 4/4] Update KnownIssues.md --- KnownIssues.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/KnownIssues.md b/KnownIssues.md index e77c38cb3b..a314e46e4f 100644 --- a/KnownIssues.md +++ b/KnownIssues.md @@ -9,7 +9,7 @@ The following list are known issues. The issue may contain a work-around or an a If you have only non-JRF user server groups targeted to a dynamic cluster, you will see the following message: - WLSDPLY-12238: Unable to target non-JRF template server groups for domain type CUSTOM to dynamic cluster(s). + WLSDPLY-12238: Unable to target non-JRF template server groups for domain type to dynamic cluster(s). You will not see this message if you have a mix of non-JRF and JRF user server groups targeted to the dynamic cluster. WDT cannot detect if a user server group is associated to JRF, and therefore, whether the applyJRF will @@ -21,9 +21,9 @@ The following list are known issues. The issue may contain a work-around or an a the following action as a temporary work-around to the described issue. 1. Add a configured managed server to your dynamic cluster and re-run the createDomain or updateDomain tool. - The dynamic cluster becomes "mixed" cluster once the managed server is added. When the WDT tool targets the + The dynamic cluster becomes a "mixed" cluster once the managed server is added. When the WDT tool targets the user server groups to the configured managed server, the resources are automatically targeted to the cluster - by WebLogic, which includes the managed server and the dynamic servers. + by WebLogic, which includes both the managed server and the dynamic servers. **ISSUE**: The discoverDomain STDOUT contains many SEVERE messages about cd() and ls() when it is run against a 12.2.1 domain.