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
97fcf58a
Commit
97fcf58a
authored
Jul 14, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implementing vm scaling. We hit null pointer exception at EGISEngine line 654
parent
a3d328f3
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
32 deletions
+103
-32
DeployService.java
.../main/java/nl/uva/sne/drip/api/service/DeployService.java
+5
-5
ProvisionService.java
...in/java/nl/uva/sne/drip/api/service/ProvisionService.java
+83
-24
DeployController.java
...in/java/nl/uva/sne/drip/api/v1/rest/DeployController.java
+1
-3
ProvisionController.java
...java/nl/uva/sne/drip/api/v1/rest/ProvisionController.java
+14
-0
No files found.
drip-api/src/main/java/nl/uva/sne/drip/api/service/DeployService.java
View file @
97fcf58a
...
...
@@ -53,7 +53,7 @@ import nl.uva.sne.drip.api.exception.KeyException;
import
nl.uva.sne.drip.commons.utils.Converter
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ConfigurationRepresentation
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.KeyPair
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.Scale
Deploymet
Request
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ScaleRequest
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ansible.AnsibleOutput
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ansible.AnsibleResult
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ansible.BenchmarkResult
;
...
...
@@ -274,19 +274,19 @@ public class DeployService {
return
scaleParameter
;
}
public
DeployResponse
scale
(
Scale
Deploymet
Request
scaleReq
)
throws
IOException
,
TimeoutException
,
InterruptedException
,
JSONException
,
Exception
{
public
DeployResponse
scale
(
ScaleRequest
scaleReq
)
throws
IOException
,
TimeoutException
,
InterruptedException
,
JSONException
,
Exception
{
//Deployer needs configurationID -> name_of_deployment
String
deployId
=
scaleReq
.
get
Deploy
ID
();
String
deployId
=
scaleReq
.
get
ScaleTarget
ID
();
DeployResponse
deployment
=
this
.
findOne
(
deployId
);
String
confID
=
deployment
.
getConfigurationID
();
ConfigurationRepresentation
configuration
=
configurationService
.
findOne
(
confID
);
Map
<
String
,
Object
>
map
=
configuration
.
getKeyValue
();
Map
<
String
,
Object
>
services
=
(
Map
<
String
,
Object
>)
map
.
get
(
"services"
);
if
(!
services
.
containsKey
(
scaleReq
.
getS
ervice
Name
()))
{
if
(!
services
.
containsKey
(
scaleReq
.
getS
caleTarget
Name
()))
{
throw
new
BadRequestException
(
"Service name does not exist in this deployment"
);
}
Message
message
=
buildDeployerMessage
(
deployment
.
getProvisionID
(),
"scale"
,
confID
,
scaleReq
.
getS
ervice
Name
(),
scaleReq
.
getNumOfInstances
());
Message
message
=
buildDeployerMessage
(
deployment
.
getProvisionID
(),
"scale"
,
confID
,
scaleReq
.
getS
caleTarget
Name
(),
scaleReq
.
getNumOfInstances
());
try
(
DRIPCaller
deployer
=
new
DeployerCaller
(
messageBrokerHost
);)
{
Message
response
=
(
deployer
.
call
(
message
));
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/service/ProvisionService.java
View file @
97fcf58a
This diff is collapsed.
Click to expand it.
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/DeployController.java
View file @
97fcf58a
...
...
@@ -35,7 +35,6 @@ import nl.uva.sne.drip.api.service.DeployService;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.DeployRequest
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.DeployResponse
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ScaleDeploymetRequest
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ScaleRequest
;
import
org.json.JSONException
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -91,9 +90,8 @@ public class DeployController {
@RequestMapping
(
value
=
"/scale"
,
method
=
RequestMethod
.
POST
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
scaleDeployment
(
@RequestBody
Scale
Deploymet
Request
scaleRequest
)
{
String
scaleDeployment
(
@RequestBody
ScaleRequest
scaleRequest
)
{
try
{
return
deployService
.
scale
(
scaleRequest
).
getId
();
...
...
drip-api/src/main/java/nl/uva/sne/drip/api/v1/rest/ProvisionController.java
View file @
97fcf58a
...
...
@@ -37,6 +37,7 @@ import nl.uva.sne.drip.api.exception.NotFoundException;
import
nl.uva.sne.drip.api.service.ProvisionService
;
import
nl.uva.sne.drip.api.service.UserService
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ProvisionResponse
;
import
nl.uva.sne.drip.drip.commons.data.v1.external.ScaleRequest
;
import
org.json.JSONException
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -188,6 +189,19 @@ public class ProvisionController {
return
resp
.
getId
();
}
@RequestMapping
(
value
=
"/scale"
,
method
=
RequestMethod
.
POST
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
public
@ResponseBody
String
scaleDeployment
(
@RequestBody
ScaleRequest
scaleRequest
)
{
try
{
return
provisionService
.
scale
(
scaleRequest
).
getId
();
}
catch
(
IOException
|
TimeoutException
|
JSONException
ex
)
{
Logger
.
getLogger
(
ProvisionController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
Exception
ex
)
{
Logger
.
getLogger
(
ProvisionController
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
return
null
;
}
@RequestMapping
(
value
=
"/sample"
,
method
=
RequestMethod
.
GET
)
@RolesAllowed
({
UserService
.
USER
,
UserService
.
ADMIN
})
...
...
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