Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-ganeti
Commits
83a91400
Commit
83a91400
authored
15 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Add setting of node limits in hspace
parent
18b6444b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hspace.hs
+15
-1
15 additions, 1 deletion
hspace.hs
with
15 additions
and
1 deletion
hspace.hs
+
15
−
1
View file @
83a91400
...
...
@@ -58,6 +58,8 @@ data Options = Options
,
optIDsk
::
Int
-- ^ Instance disk
,
optIVCPUs
::
Int
-- ^ Instance VCPUs
,
optINodes
::
Int
-- ^ Nodes required for an instance
,
optMcpu
::
Double
-- ^ Max cpu ratio for nodes
,
optMdsk
::
Double
-- ^ Max disk usage ratio for nodes
,
optShowVer
::
Bool
-- ^ Just show the program version
,
optShowHelp
::
Bool
-- ^ Just show the help
}
deriving
Show
...
...
@@ -89,6 +91,8 @@ defaultOptions = Options
,
optIDsk
=
102400
,
optIVCPUs
=
1
,
optINodes
=
2
,
optMcpu
=
-
1
,
optMdsk
=
-
1
,
optShowVer
=
False
,
optShowHelp
=
False
}
...
...
@@ -129,6 +133,12 @@ options =
,
Option
[]
[
"req-nodes"
]
(
ReqArg
(
\
n
opts
->
opts
{
optINodes
=
read
n
})
"NODES"
)
"number of nodes for the new instances (1=plain, 2=mirrored)"
,
Option
[]
[
"max-cpu"
]
(
ReqArg
(
\
n
opts
->
opts
{
optMcpu
=
read
n
})
"RATIO"
)
"maximum virtual-to-physical cpu ratio for nodes"
,
Option
[]
[
"max-disk"
]
(
ReqArg
(
\
n
opts
->
opts
{
optMdsk
=
read
n
})
"RATIO"
)
"minimum free disk space for nodes (between 0 and 1)"
,
Option
[
'V'
]
[
"version"
]
(
NoArg
(
\
opts
->
opts
{
optShowVer
=
True
}))
"show the version of the program"
...
...
@@ -201,6 +211,8 @@ main = do
filter
(
\
n
->
elem
(
Node
.
name
n
)
offline_names
)
all_nodes
req_nodes
=
optINodes
opts
m_cpu
=
optMcpu
opts
m_dsk
=
optMdsk
opts
when
(
length
offline_wrong
>
0
)
$
do
printf
"Error: Wrong node name(s) set as offline: %s
\n
"
...
...
@@ -211,9 +223,11 @@ main = do
printf
"Error: Invalid required nodes (%d)
\n
"
req_nodes
exitWith
$
ExitFailure
1
let
n
l
=
Container
.
map
(
\
n
->
if
elem
(
Node
.
idx
n
)
offline_indices
let
n
m
=
Container
.
map
(
\
n
->
if
elem
(
Node
.
idx
n
)
offline_indices
then
Node
.
setOffline
n
True
else
n
)
fixed_nl
nl
=
Container
.
map
(
flip
Node
.
setMdsk
m_dsk
.
flip
Node
.
setMcpu
m_cpu
)
nm
when
(
length
csf
>
0
&&
verbose
>
1
)
$
do
printf
"Note: Stripping common suffix of '%s' from names
\n
"
csf
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment