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
2276aa29
Commit
2276aa29
authored
16 years ago
by
Oleksiy Mishchenko
Browse files
Options
Downloads
Patches
Plain Diff
RAPI: Implement an instance reboot
Reviewed-by: imsnah
parent
8049a1d7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/rapi/connector.py
+2
-0
2 additions, 0 deletions
lib/rapi/connector.py
lib/rapi/rlib2.py
+27
-0
27 additions, 0 deletions
lib/rapi/rlib2.py
with
29 additions
and
0 deletions
lib/rapi/connector.py
+
2
−
0
View file @
2276aa29
...
...
@@ -140,5 +140,7 @@ CONNECTOR.update({
"
/2/instances
"
:
rlib2
.
R_2_instances
,
re
.
compile
(
r
'
^/2/instances/([\w\._-]+)$
'
):
rlib1
.
R_instances_name
,
re
.
compile
(
r
'
^/2/instances/([\w\._-]+)/tags$
'
):
rlib2
.
R_2_instances_name_tags
,
re
.
compile
(
r
'
^/2/instances/([\w\._-]+)/reboot$
'
):
rlib2
.
R_2_instances_name_reboot
,
re
.
compile
(
r
'
/2/jobs/(%s)$
'
%
constants
.
JOB_ID_TEMPLATE
):
rlib2
.
R_2_jobs_id
,
})
This diff is collapsed.
Click to expand it.
lib/rapi/rlib2.py
+
27
−
0
View file @
2276aa29
...
...
@@ -245,6 +245,33 @@ class R_2_instances(baserlib.R_Generic):
return
job_id
class
R_2_instances_name_reboot
(
baserlib
.
R_Generic
):
"""
/2/instances/[instance_name]/reboot resource.
Implements an instance reboot.
"""
DOC_URI
=
"
/2/instances/[instance_name]/reboot
"
def
GET
(
self
):
"""
Reboot an instance.
"""
instance_name
=
self
.
items
[
0
]
reboot_type
=
self
.
queryargs
.
get
(
'
reboot_type
'
,
constants
.
INSTANCE_REBOOT_HARD
)
ignore_secondaries
=
self
.
queryargs
.
get
(
'
ignore_secondaries
'
,
False
)
op
=
ganeti
.
opcodes
.
OpRebootInstance
(
instance_name
=
instance_name
,
reboot_type
=
reboot_type
,
ignore_secondaries
=
ignore_secondaries
)
job_id
=
ganeti
.
cli
.
SendJob
([
op
])
return
job_id
class
R_2_instances_name_tags
(
baserlib
.
R_Generic
):
"""
/2/instances/[instance_name]/tags resource.
...
...
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