Skip to content

Commit 1c7aa1e

Browse files
authored
Merge pull request #302 from oracle/WDT-267-Server-Migratable-Target-Attribute-fixes
Wdt 267 server migratable target attribute fixes
2 parents 006d854 + d9a7bad commit 1c7aa1e

File tree

8 files changed

+108
-43
lines changed

8 files changed

+108
-43
lines changed

core/src/main/python/wlsdeploy/tool/create/domain_creator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,8 @@ def __create_clusters_and_servers(self, location):
677677
# Finally, create/update the servers.
678678
#
679679
server_nodes = dictionary_utils.get_dictionary_element(self._topology, SERVER)
680+
# There may be a dependency to other servers when the server is in a cluster
681+
self.topology_helper.create_placeholder_servers_in_cluster(self._topology)
680682
if len(server_nodes) > 0:
681683
self._create_named_mbeans(SERVER, server_nodes, location, log_created=True)
682684

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ def update(self):
9898

9999
self._process_section(self._topology, folder_list, CLUSTER, location)
100100
self._process_section(self._topology, folder_list, SERVER_TEMPLATE, location)
101+
102+
# create placeholders for Servers that are in a cluster as /Server/JTAMigratableTarget
103+
# can reference "other" servers
104+
self._topology_helper.create_placeholder_servers_in_cluster(self._topology)
101105
self._process_section(self._topology, folder_list, SERVER, location)
102106

103107
self._process_section(self._topology, folder_list, MIGRATABLE_TARGET, location)

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,33 @@ def _create_placeholder_coherence_cluster(self, cluster_name):
6767

6868
self.wlst_helper.cd(original_location)
6969

70+
def create_placeholder_servers_in_cluster(self, topology):
71+
"""
72+
Create a placeholder for servers that are in a cluster, as these are migratable entities that
73+
can reference other servers in the cluster.
74+
:param topology: The topology model nodes containing the full set of Servers to add for the create / update
75+
"""
76+
_method_name = 'create_placeholder_servers_in_cluster'
77+
self.logger.entering(class_name=self.__class_name, method_name=_method_name)
78+
original_location = self.wlst_helper.get_pwd()
79+
server_location = LocationContext().append_location(SERVER)
80+
81+
if self.alias_helper.get_wlst_mbean_type(server_location) is not None:
82+
existing_names = deployer_utils.get_existing_object_list(server_location, self.alias_helper)
83+
84+
server_nodes = dictionary_utils.get_dictionary_element(topology, SERVER)
85+
for server_name in server_nodes:
86+
if server_name not in existing_names and self.is_clustered_server(server_name, server_nodes):
87+
self.logger.info('WLSDPLY-19402', server_name, class_name=self.__class_name,
88+
method_name=_method_name)
89+
90+
server_token = self.alias_helper.get_name_token(server_location)
91+
server_location.add_name_token(server_token, server_name)
92+
deployer_utils.create_and_cd(server_location, existing_names, self.alias_helper)
93+
94+
self.wlst_helper.cd(original_location)
95+
self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
96+
7097
def create_placeholder_server_templates(self, topology):
7198
"""
7299
Create a placeholder server template for each name in the topology.
@@ -133,3 +160,14 @@ def qualify_nm_properties(self, type_name, model_nodes, base_location, model_con
133160
value = model_context.get_domain_home() + "/" + keystore_file
134161
attribute_setter.set_attribute(location, CUSTOM_IDENTITY_KEYSTORE_FILE, value)
135162

163+
def is_clustered_server(self, server_name, servers_dictionary):
164+
"""
165+
Return true if the server's Cluster attribute is set.
166+
:param server_name: name of the server in the dictionary
167+
:param servers_dictionary: model topology section of servers
168+
:return: True if a clustered server
169+
"""
170+
server_dictionary = dictionary_utils.get_dictionary_element(servers_dictionary, server_name)
171+
if dictionary_utils.is_empty_dictionary_element(server_dictionary, CLUSTER):
172+
return False
173+
return True

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/MigratableTarget.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{
2-
"copyright": "Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.",
2+
"copyright": "Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.",
33
"license": "The Universal Permissive License (UPL), Version 1.0",
44
"wlst_type": "MigratableTarget${:s}",
55
"version": "[12.1.3,)",
66
"child_folders_type": "multiple",
77
"folders": {},
88
"attributes": {
99
"AdditionalMigrationAttempts": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "AdditionalMigrationAttempts", "wlst_path": "WP001", "value": {"default": 2 }, "wlst_type": "integer" } ],
10-
"AllCandidateServers": [ {"version": "[12.1.3,)", "wlst_mode": "online", "wlst_name": "AllCandidateServers", "wlst_path": "WP001", "value": {"default": [] }, "wlst_type": "jarray", "get_method": "GET", "preferred_model_type": "delimited_string", "set_method": "MBEAN.set_server_mbeans", "set_mbean_type": "weblogic.management.configuration.ServerMBean"} ],
10+
"AllCandidateServers": [ {"version": "[12.1.3,)", "wlst_mode": "online", "wlst_name": "AllCandidateServers", "wlst_path": "WP001", "value": {"default": [] }, "wlst_type": "jarray", "preferred_model_type": "delimited_string", "get_method": "GET", "set_method": "MBEAN.set_server_mbeans", "set_mbean_type": "weblogic.management.configuration.ServerMBean"} ],
1111
"Cluster": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA", "set_method": "MBEAN.set_cluster_mbean", "set_mbean_type": "weblogic.management.configuration.ClusterMBean" } ],
1212
"ConstrainedCandidateServer": [ {"version": "[12.1.3,)", "wlst_mode": "offline", "wlst_name": "ConstrainedCandidateServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "delimited_string", "get_method": "LSA"},
13-
{"version": "[12.1.3,)", "wlst_mode": "online", "wlst_name": "ConstrainedCandidateServers", "wlst_path": "WP002", "value": {"default": "None" }, "wlst_type": "jarray", "preferred_model_type": "delimited_string", "get_method": "GET", "set_method": "MBEAN.set_server_mbeans", "set_mbean_type": "weblogic.management.configuration.ServerMBean" } ],
13+
{"version": "[12.1.3,)", "wlst_mode": "online", "wlst_name": "ConstrainedCandidateServers", "wlst_path": "WP002", "value": {"default": "None" }, "wlst_type": "jarray", "preferred_model_type": "list", "get_method": "GET", "set_method": "MBEAN.set_server_mbeans", "set_mbean_type": "weblogic.management.configuration.ServerMBean" } ],
1414
"Critical": [ {"version": "[12.2.0,)", "wlst_mode": "both", "wlst_name": "Critical", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],
1515
"DestinationServer": [ {"version": "[12.1.3,)", "wlst_mode": "offline", "wlst_name": "DestinationServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA"} ],
16-
"HostingServer": [ {"version": "[12.1.3,)", "wlst_mode": "offline", "wlst_name": "HostingServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA" } ],
16+
"HostingServer": [ {"version": "[12.1.3,)", "wlst_mode": "offline", "wlst_name": "HostingServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "get_method": "LSA" } ,
17+
{"version": "[12.1.3,)", "wlst_mode": "online", "wlst_name": "HostingServer", "wlst_path": "WP001", "value": {"default": "None" }, "wlst_type": "string", "access": "RO", "get_method": "GET", "set_method": "MBEAN.set_server_mbean", "set_mbean_type": "weblogic.management.configuration.ServerMBean" } ],
1718
"MigrationPolicy": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "MigrationPolicy", "wlst_path": "WP001", "value": {"default": "${None:manual}" }, "wlst_type": "string" } ],
1819
"MillisToSleepBetweenAttempts": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "MillisToSleepBetweenAttempts", "wlst_path": "WP001", "value": {"default": 300000 }, "wlst_type": "integer" } ],
1920
"NonLocalPostAllowed": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "NonLocalPostAllowed", "wlst_path": "WP001", "value": {"default": "false" }, "wlst_type": "boolean" } ],

0 commit comments

Comments
 (0)