Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Melodic
morphemic-preprocessor
Commits
25c5a25c
Commit
25c5a25c
authored
Nov 12, 2021
by
Ali Fahs
Browse files
Adding a new method to get the Byon host name and node source
parent
055a5de6
Pipeline
#17352
passed with stage
in 1 minute and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/PAGateway.java
View file @
25c5a25c
...
...
@@ -1208,6 +1208,34 @@ public class PAGateway {
return
deployNodeTask
;
}
private
String
getBYONHostname
(
String
nsName
)
{
List
<
String
>
nodeHostnames
=
new
LinkedList
<>();
try
{
nodeHostnames
=
resourceManagerGateway
.
getAsyncDeployedNodesInformation
(
nsName
,
"hostname"
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
" resourceManagerGateway threw an exception: "
+
e
);
}
if
(
nodeHostnames
==
null
)
{
LOGGER
.
error
(
"The node Source "
+
nsName
+
" Does not have any nodes"
);
throw
new
IllegalStateException
(
"Node source is empty no hostname can be retrieved"
);
}
else
{
if
(
nodeHostnames
.
size
()
!=
1
)
{
if
(
nodeHostnames
.
size
()
==
0
)
{
LOGGER
.
error
(
"The node Source "
+
nsName
+
" Does not have any nodes"
);
throw
new
IllegalStateException
(
"Node source is empty no hostname can be retrieved"
);
}
else
{
LOGGER
.
error
(
"The node Source "
+
nsName
+
" has more than one node"
);
throw
new
IllegalStateException
(
"Node source has multiple nodes"
);
}
}
}
LOGGER
.
info
(
"The hostname is retrieved successfully: "
+
nodeHostnames
.
get
(
0
));
return
nodeHostnames
.
get
(
0
);
}
private
ScriptTask
createInfraBYONTask
(
Task
task
,
Deployment
deployment
,
String
taskNameSuffix
,
String
nodeToken
)
{
LOGGER
.
debug
(
"Acquiring node BYON script file: "
+
getClass
().
getResource
(
File
.
separator
+
"acquire_node_BYON_script.groovy"
).
toString
());
ScriptTask
deployNodeTask
=
PAFactory
.
createGroovyScriptTaskFromFile
(
"acquireBYONNode_"
+
task
.
getName
()
+
taskNameSuffix
,
...
...
@@ -1216,11 +1244,9 @@ public class PAGateway {
deployNodeTask
.
setPreScript
(
PAFactory
.
createSimpleScriptFromFIle
(
"pre_acquire_node_script.groovy"
,
"groovy"
));
Map
<
String
,
TaskVariable
>
variablesMap
=
new
HashMap
<>();
variablesMap
.
put
(
"NS_name"
,
new
TaskVariable
(
"NS_name"
,
deployment
.
getPaCloud
().
getNodeSourceNamePrefix
()
+
deployment
.
getLocationName
()));
//TODO: To check this. Which ip address is used as host in RM?
variablesMap
.
put
(
"host_name"
,
new
TaskVariable
(
"host_name"
,
deployment
.
getByonNode
().
getIpAddresses
().
get
(
0
).
getValue
()));
String
NsName
=
deployment
.
getPaCloud
().
getNodeSourceNamePrefix
();
variablesMap
.
put
(
"NS_name"
,
new
TaskVariable
(
"NS_name"
,
NsName
));
variablesMap
.
put
(
"host_name"
,
new
TaskVariable
(
"host_name"
,
getBYONHostname
(
NsName
)));
variablesMap
.
put
(
"token"
,
new
TaskVariable
(
"token"
,
nodeToken
));
LOGGER
.
debug
(
"Variables to be added to the task: "
+
variablesMap
.
toString
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment