Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
460256ee
Commit
460256ee
authored
Mar 14, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added disk size from vms
parent
8de510db
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
37 deletions
+63
-37
lifeWatch_vre1.yaml
TOSCA/lifeWatch_vre1.yaml
+13
-12
nodes.yaml
TOSCA/types/nodes.yaml
+1
-1
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+17
-0
ansible_service.py
deployer/service/ansible_service.py
+3
-0
docker-compose.yml
docker-compose.yml
+13
-13
CredentialApiController.java
...ain/java/nl/uva/sne/drip/api/CredentialApiController.java
+0
-4
requirements.txt
planner/requirements.txt
+1
-1
EC2.yml
provisioner/etc/UD/EC2.yml
+0
-1
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+15
-5
No files found.
TOSCA/lifeWatch_vre1.yaml
View file @
460256ee
...
...
@@ -26,17 +26,18 @@ topology_template:
image
:
type
:
tosca.artifacts.Deployment.Image.Container.Docker
file
:
alogo53/ws-pema-lifewatch
repository
:
docker_hub
repository
:
docker_hub
topology
:
type
:
tosca.nodes.ARTICONF.VM.topology
interfaces
:
CloudsStorm
:
provision
:
inputs
:
code_type
:
SEQ
object_type
:
SubTopology
properties
:
domain
:
UvA (Amsterdam, The Netherlands) XO Rack
provider
:
ExoGENI
#
topology:
#
type: tosca.nodes.ARTICONF.VM.topology
#
interfaces:
#
CloudsStorm:
#
provision:
#
inputs:
#
code_type: SEQ
#
object_type: SubTopology
#
properties:
#
domain: UvA (Amsterdam, The Netherlands) XO Rack
#
provider: ExoGENI
TOSCA/types/nodes.yaml
View file @
460256ee
...
...
@@ -179,7 +179,7 @@ node_types:
disk_size
:
type
:
scalar-unit.size
required
:
true
default
:
5
0000 MB
default
:
2
0000 MB
constraints
:
-
greater_or_equal
:
15000 MB
mem_size
:
...
...
commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
460256ee
...
...
@@ -53,6 +53,7 @@ public class ToscaHelper {
private
static
final
String
VM_TYPE
=
"tosca.nodes.ARTICONF.VM.Compute"
;
private
static
final
String
VM_NUM_OF_CORES
=
"num_cores"
;
private
static
final
String
MEM_SIZE
=
"mem_size"
;
private
static
final
String
DISK_SIZE
=
"disk_size"
;
private
static
final
String
VM_OS
=
"os"
;
private
static
final
String
VM_TOPOLOGY
=
"tosca.nodes.ARTICONF.VM.topology"
;
private
Integer
id
;
...
...
@@ -147,6 +148,21 @@ public class ToscaHelper {
}
public
Double
getVMNDiskSize
(
NodeTemplateMap
vmMap
)
throws
Exception
{
NodeTemplate
vm
=
vmMap
.
getNodeTemplate
();
if
(
vm
.
getType
().
equals
(
VM_TYPE
))
{
String
memScalar
=
(
String
)
vm
.
getProperties
().
get
(
DISK_SIZE
);
String
[]
memScalarArray
=
memScalar
.
split
(
" "
);
String
memSize
=
memScalarArray
[
0
];
String
memUnit
=
memScalarArray
[
1
];
Double
sizeInGB
=
convertToGB
(
Integer
.
valueOf
(
memSize
),
memUnit
);
return
sizeInGB
;
}
else
{
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TYPE
+
" it is of type: "
+
vm
.
getType
());
}
}
public
String
getVMNOS
(
NodeTemplateMap
vmMap
)
throws
Exception
{
NodeTemplate
vm
=
vmMap
.
getNodeTemplate
();
if
(
vm
.
getType
().
equals
(
VM_TYPE
))
{
...
...
@@ -244,4 +260,5 @@ public class ToscaHelper {
}
return
"vm_user"
;
}
}
deployer/service/ansible_service.py
View file @
460256ee
...
...
@@ -34,6 +34,9 @@ def write_inventory_file(tmp_path, vms):
for
vm_name
in
vms
:
attributes
=
vms
[
vm_name
][
'attributes'
]
role
=
attributes
[
'role'
]
if
'public_ip'
not
in
attributes
:
raise
ValueError
(
'VM: '
+
vm_name
+
' has no public_ip attribute'
)
if
role
==
'master'
:
k8_master
=
attributes
[
'public_ip'
]
else
:
...
...
docker-compose.yml
View file @
460256ee
...
...
@@ -100,7 +100,7 @@ services:
#jupyter:
#ports:
#- "30003:8888"
#image: jupyter
/
base-notebook
#image: jupyter
_
base-notebook
manager
:
...
...
@@ -129,22 +129,22 @@ services:
environment
:
RABBITMQ_HOST
:
rabbit
provisioner
:
depends_on
:
-
rabbit
-
sure-tosca
image
:
alogo53/provisioner:3.0.0
environment
:
RABBITMQ_HOST
:
rabbit
SURE_TOSCA_BASE_PATH
:
http://sure-tosca:8081/tosca-sure/1.0.0
#deployer:
#provisioner:
#depends_on:
#- rabbit
#- sure-tosca
#image: alogo53/
deploy
er:3.0.0
#image: alogo53/
provision
er:3.0.0
#environment:
#RABBITMQ_HOST: rabbit
#RABBITMQ_HOST: rabbit
#SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
deployer
:
depends_on
:
-
rabbit
-
sure-tosca
image
:
alogo53/deployer:3.0.0
environment
:
RABBITMQ_HOST
:
rabbit
#volumes:
...
...
manager/src/main/java/nl/uva/sne/drip/api/CredentialApiController.java
View file @
460256ee
...
...
@@ -3,7 +3,6 @@ package nl.uva.sne.drip.api;
import
nl.uva.sne.drip.model.tosca.Credential
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.swagger.annotations.*
;
import
java.io.IOException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -13,11 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import
javax.validation.Valid
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
nl.uva.sne.drip.service.CredentialService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestPart
;
import
org.springframework.web.multipart.MultipartFile
;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-10T17:15:46.465Z"
)
...
...
planner/requirements.txt
View file @
460256ee
...
...
@@ -3,5 +3,5 @@ pika==1.1.0
names==0.3.0
networkx==2.4
pyyaml==5.3
tosca-parser
==1.7.0
tosca-parser==1.7.0
matplotlib==3.1.2
\ No newline at end of file
provisioner/etc/UD/EC2.yml
View file @
460256ee
...
...
@@ -164,7 +164,6 @@ DCMetaInfo:
AMI
:
"
ami-2581aa40"
-
domain
:
"
Frankfurt"
endpoint
:
"
ec2.eu-central-1.amazonaws.com"
country
:
Germany
...
...
provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
460256ee
...
...
@@ -209,14 +209,21 @@ class CloudStormService {
Double
numOfCores
=
helper
.
getVMNumOfCores
(
vmMap
);
Double
memSize
=
helper
.
getVMNMemSize
(
vmMap
);
String
os
=
helper
.
getVMNOS
(
vmMap
);
double
[]
requestedVector
=
convert2ArrayofDoubles
(
numOfCores
,
memSize
);
Double
diskSize
=
helper
.
getVMNDiskSize
(
vmMap
);
double
[]
requestedVector
=
convert2ArrayofDoubles
(
numOfCores
,
memSize
,
diskSize
);
double
min
=
Double
.
MAX_VALUE
;
CloudsStormVM
bestMatchingVM
=
null
;
List
<
CloudsStormVM
>
vmInfos
=
cloudStormDAO
.
findVmMetaInfoByProvider
(
CloudProviderEnum
.
fromValue
(
provider
));
for
(
CloudsStormVM
vmInfo
:
vmInfos
)
{
if
(
os
.
toLowerCase
().
equals
(
vmInfo
.
getOstype
().
toLowerCase
()))
{
double
[]
aveliableVector
=
convert2ArrayofDoubles
(
Double
.
valueOf
(
vmInfo
.
getCPU
()),
Double
.
valueOf
(
vmInfo
.
getMEM
()));
Double
cloudsStormVMdiskSize
=
null
;
if
(
vmInfo
.
getDiskSize
()
==
null
)
{
cloudsStormVMdiskSize
=
Double
.
valueOf
(
7.0
);
}
else
{
cloudsStormVMdiskSize
=
Double
.
valueOf
(
vmInfo
.
getDiskSize
());
}
double
[]
aveliableVector
=
convert2ArrayofDoubles
(
Double
.
valueOf
(
vmInfo
.
getCPU
()),
Double
.
valueOf
(
vmInfo
.
getMEM
()),
cloudsStormVMdiskSize
);
EuclideanDistance
dist
=
new
EuclideanDistance
();
double
res
=
dist
.
compute
(
requestedVector
,
aveliableVector
);
if
(
res
<
min
)
{
...
...
@@ -225,7 +232,10 @@ class CloudStormService {
}
}
}
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Found best matching VM: "
+
bestMatchingVM
);
if
(
bestMatchingVM
!=
null
&&
bestMatchingVM
.
getDiskSize
()
==
null
){
bestMatchingVM
.
setDiskSize
(
diskSize
.
intValue
());
}
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"Found best matching VM: {0}"
,
bestMatchingVM
);
return
bestMatchingVM
;
}
...
...
@@ -383,8 +393,8 @@ class CloudStormService {
return
toscaTemplate
;
}
private
double
[]
convert2ArrayofDoubles
(
Double
numOfCores
,
Double
memSize
)
{
double
[]
vector
=
new
double
[]{
numOfCores
,
memSize
};
private
double
[]
convert2ArrayofDoubles
(
Double
numOfCores
,
Double
memSize
,
Double
diskSize
)
{
double
[]
vector
=
new
double
[]{
numOfCores
,
memSize
,
diskSize
};
return
vector
;
}
...
...
Write
Preview
Markdown
is supported
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