Skip to content
GitLab
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
febd17a1
Commit
febd17a1
authored
Oct 18, 2021
by
Ali Fahs
Browse files
Merge branch 'OpenStack-nc' into 'proactive-dev'
OpenStack retrieve Linux NC See merge request
!169
parents
fc7b5d0a
0a0a695d
Pipeline
#16751
passed with stages
in 2 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
febd17a1
...
...
@@ -53,6 +53,7 @@ build:amq-message-java-library:
only
:
-
master
-
morphemic-rc1.5
-
openstack-nc
script
:
-
$AMQ_MESSAGE_JAVA_LIBRARY_CLI clean install
artifacts
:
...
...
@@ -138,6 +139,7 @@ deploy:scheduling-abstraction-layer:
-
master
-
morphemic-rc1.5
-
proactive-dev
-
OpenStack-nc
dependencies
:
-
build:scheduling-abstraction-layer
script
:
...
...
scheduling-abstraction-layer/src/main/java/org/activeeon/morphemic/service/NodeCandidateUtils.java
View file @
febd17a1
...
...
@@ -10,10 +10,8 @@ import org.json.JSONObject;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Slf4j
...
...
@@ -257,26 +255,47 @@ public class NodeCandidateUtils {
//TODO: (Optimization) An images per region map structure <region,[image1,image2]> could be the best here.
// It can reduce the getNodeCandidates calls to PA.
List
<
String
>
entries
=
new
LinkedList
<>();
List
<
String
>
openstackOsList
=
Arrays
.
asList
(
"Ubuntu"
,
"Fedora"
,
"Centos"
,
"Debian"
);
consolidatedImages
.
forEach
(
image
->
{
String
region
=
image
.
optString
(
"location"
);
String
imageReq
;
String
os
=
(
String
)
((
JSONObject
)
image
.
get
(
"operatingSystem"
)).
get
(
"family"
);
os
=
os
.
substring
(
0
,
1
).
toUpperCase
()
+
os
.
substring
(
1
);
String
pair
=
os
+
":"
+
region
;
switch
(
paCloud
.
getCloudProviderName
())
{
case
"aws-ec2"
:
imageReq
=
"Linux"
;
break
;
case
"openstack"
:
imageReq
=
"linux"
;
imageReq
=
os
;
break
;
default
:
throw
new
IllegalArgumentException
(
"The infrastructure "
+
paCloud
.
getCloudProviderName
()
+
" is not handled yet."
);
}
JSONArray
nodeCandidates
=
connectorIaasGateway
.
getNodeCandidates
(
paCloud
.
getDummyInfrastructureName
(),
region
,
imageReq
);
nodeCandidates
.
forEach
(
nc
->
{
JSONObject
nodeCandidate
=
(
JSONObject
)
nc
;
EntityManagerHelper
.
persist
(
createLocation
(
nodeCandidate
,
paCloud
));
EntityManagerHelper
.
persist
(
createNodeCandidate
(
nodeCandidate
,
image
,
paCloud
));
});
if
(
paCloud
.
getCloudProviderName
().
equals
(
"openstack"
)){
if
((!
entries
.
contains
(
pair
))
&&
openstackOsList
.
contains
(
os
))
{
entries
.
add
(
pair
);
JSONArray
nodeCandidates
=
connectorIaasGateway
.
getNodeCandidates
(
paCloud
.
getDummyInfrastructureName
(),
region
,
imageReq
);
nodeCandidates
.
forEach
(
nc
->
{
JSONObject
nodeCandidate
=
(
JSONObject
)
nc
;
EntityManagerHelper
.
persist
(
createLocation
(
nodeCandidate
,
paCloud
));
EntityManagerHelper
.
persist
(
createNodeCandidate
(
nodeCandidate
,
image
,
paCloud
));
});
}
}
else
{
JSONArray
nodeCandidates
=
connectorIaasGateway
.
getNodeCandidates
(
paCloud
.
getDummyInfrastructureName
(),
region
,
imageReq
);
nodeCandidates
.
forEach
(
nc
->
{
JSONObject
nodeCandidate
=
(
JSONObject
)
nc
;
EntityManagerHelper
.
persist
(
createLocation
(
nodeCandidate
,
paCloud
));
EntityManagerHelper
.
persist
(
createNodeCandidate
(
nodeCandidate
,
image
,
paCloud
));
});
}
});
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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