Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
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
Jacklull
k3s
Commits
6a5049f0
Commit
6a5049f0
authored
Sep 10, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13788 from socaa/millicore
Auto commit by PR queue bot
parents
3afa6954
569ebf7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
resource_consumer_handler.go
test/images/resource-consumer/resource_consumer_handler.go
+7
-7
No files found.
test/images/resource-consumer/resource_consumer_handler.go
View file @
6a5049f0
...
@@ -31,7 +31,7 @@ const (
...
@@ -31,7 +31,7 @@ const (
consumeCPUAddress
=
"/ConsumeCPU"
consumeCPUAddress
=
"/ConsumeCPU"
consumeMemAddress
=
"/ConsumeMem"
consumeMemAddress
=
"/ConsumeMem"
getCurrentStatusAddress
=
"/GetCurrentStatus"
getCurrentStatusAddress
=
"/GetCurrentStatus"
mil
icoresQuery
=
"mi
licores"
mil
licoresQuery
=
"mil
licores"
megabytesQuery
=
"megabytes"
megabytesQuery
=
"megabytes"
durationSecQuery
=
"durationSec"
durationSecQuery
=
"durationSec"
)
)
...
@@ -68,21 +68,21 @@ func (handler ResourceConsumerHandler) ServeHTTP(w http.ResponseWriter, req *htt
...
@@ -68,21 +68,21 @@ func (handler ResourceConsumerHandler) ServeHTTP(w http.ResponseWriter, req *htt
func
(
handler
ResourceConsumerHandler
)
handleConsumeCPU
(
w
http
.
ResponseWriter
,
query
url
.
Values
)
{
func
(
handler
ResourceConsumerHandler
)
handleConsumeCPU
(
w
http
.
ResponseWriter
,
query
url
.
Values
)
{
// geting string data for consumeCPU
// geting string data for consumeCPU
durationSecString
:=
query
.
Get
(
durationSecQuery
)
durationSecString
:=
query
.
Get
(
durationSecQuery
)
mil
icoresString
:=
query
.
Get
(
mi
licoresQuery
)
mil
licoresString
:=
query
.
Get
(
mil
licoresQuery
)
if
durationSecString
==
""
||
milicoresString
==
""
{
if
durationSecString
==
""
||
mil
l
icoresString
==
""
{
http
.
Error
(
w
,
notGivenFunctionArgument
,
http
.
StatusBadRequest
)
http
.
Error
(
w
,
notGivenFunctionArgument
,
http
.
StatusBadRequest
)
return
return
}
else
{
}
else
{
// convert data (strings to ints) for consumeCPU
// convert data (strings to ints) for consumeCPU
durationSec
,
durationSecError
:=
strconv
.
Atoi
(
durationSecString
)
durationSec
,
durationSecError
:=
strconv
.
Atoi
(
durationSecString
)
mil
icores
,
milicoresError
:=
strconv
.
Atoi
(
mi
licoresString
)
mil
licores
,
millicoresError
:=
strconv
.
Atoi
(
mil
licoresString
)
if
durationSecError
!=
nil
||
milicoresError
!=
nil
{
if
durationSecError
!=
nil
||
mil
l
icoresError
!=
nil
{
http
.
Error
(
w
,
incorrectFunctionArgument
,
http
.
StatusBadRequest
)
http
.
Error
(
w
,
incorrectFunctionArgument
,
http
.
StatusBadRequest
)
return
return
}
}
go
ConsumeCPU
(
milicores
,
durationSec
)
go
ConsumeCPU
(
mil
l
icores
,
durationSec
)
fmt
.
Fprintln
(
w
,
consumeCPUAddress
[
1
:
])
fmt
.
Fprintln
(
w
,
consumeCPUAddress
[
1
:
])
fmt
.
Fprintln
(
w
,
mil
icores
,
mi
licoresQuery
)
fmt
.
Fprintln
(
w
,
mil
licores
,
mil
licoresQuery
)
fmt
.
Fprintln
(
w
,
durationSec
,
durationSecQuery
)
fmt
.
Fprintln
(
w
,
durationSec
,
durationSecQuery
)
}
}
...
...
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