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
8075ce7e
Commit
8075ce7e
authored
16 years ago
by
Oleksiy Mishchenko
Browse files
Options
Downloads
Patches
Plain Diff
Breath life in to RAPI for trunk
Reviewed-by: imsnah
parent
761ce945
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
daemons/ganeti-master
+16
-0
16 additions, 0 deletions
daemons/ganeti-master
lib/rapi/resources.py
+2
-35
2 additions, 35 deletions
lib/rapi/resources.py
with
18 additions
and
35 deletions
daemons/ganeti-master
+
16
−
0
View file @
8075ce7e
...
...
@@ -126,6 +126,14 @@ def StartMaster(master_netdev, master_ip, debug):
result
=
utils
.
RunCmd
([
"
arping
"
,
"
-q
"
,
"
-U
"
,
"
-c 3
"
,
"
-I
"
,
master_netdev
,
"
-s
"
,
master_ip
,
master_ip
])
# we'll ignore the exit code of arping
if
constants
.
RAPI_ENABLE
:
# Start remote API
result
=
utils
.
RunCmd
([
"
ganeti-rapi
"
,
"
--port=%s
"
%
constants
.
RAPI_PORT
])
if
debug
and
result
.
failed
:
sys
.
stderr
.
write
(
"
Failed to start ganeti-rapi, error: %s
\n
"
%
result
.
output
)
return
EXIT_OK
...
...
@@ -133,6 +141,14 @@ def StopMaster(master_netdev, master_ip, debug):
"""
Stops the master.
"""
if
constants
.
RAPI_ENABLE
:
# Stop remote API
result
=
utils
.
RunCmd
([
"
fuser
"
,
"
-k
"
,
"
-TERM
"
,
"
-n
"
,
"
tcp
"
,
str
(
constants
.
RAPI_PORT
)])
if
debug
and
result
.
failed
:
sys
.
stderr
.
write
(
"
Failed to stop ganeti-rapi, error: %s
\n
"
%
result
.
output
)
result
=
utils
.
RunCmd
([
"
ip
"
,
"
address
"
,
"
del
"
,
"
%s/32
"
%
master_ip
,
"
dev
"
,
master_netdev
])
if
result
.
failed
:
...
...
This diff is collapsed.
Click to expand it.
lib/rapi/resources.py
+
2
−
35
View file @
8075ce7e
...
...
@@ -85,34 +85,6 @@ def MapFields(names, data):
return
dict
([(
names
[
i
],
data
[
i
])
for
i
in
range
(
len
(
names
))])
def
RequireLock
(
name
=
'
cmd
'
):
"""
Function decorator to automatically acquire locks.
PEP-318 style function decorator.
"""
def
wrapper
(
fn
):
def
new_f
(
*
args
,
**
kwargs
):
try
:
utils
.
Lock
(
name
,
max_retries
=
15
)
try
:
# Call real function
return
fn
(
*
args
,
**
kwargs
)
finally
:
utils
.
Unlock
(
name
)
utils
.
LockCleanup
()
except
ganeti
.
errors
.
LockError
,
err
:
raise
httperror
.
HTTPServiceUnavailable
(
message
=
str
(
err
))
# Override function metadata
new_f
.
func_name
=
fn
.
func_name
new_f
.
func_doc
=
fn
.
func_doc
return
new_f
return
wrapper
def
_Tags_GET
(
kind
,
name
=
None
):
"""
Helper function to retrieve tags.
...
...
@@ -293,7 +265,6 @@ class R_nodes(R_Generic):
"""
DOC_URI
=
"
/nodes
"
@RequireLock
()
def
_GetDetails
(
self
,
nodeslist
):
"""
Returns detailed instance data for bulk output.
...
...
@@ -336,7 +307,7 @@ class R_nodes(R_Generic):
If the optional
'
bulk
'
argument is provided and set to
'
true
'
value (i.e
'
?bulk=1
'
), the output contains detailed
information about nodes as a list.
Note: Lock required.
information about nodes as a list.
Example: [
{
...
...
@@ -369,7 +340,6 @@ class R_nodes_name(R_Generic):
"""
DOC_URI
=
"
/nodes/[node_name]
"
@RequireLock
()
def
GET
(
self
):
"""
Send information about a node.
...
...
@@ -409,7 +379,6 @@ class R_instances(R_Generic):
"""
DOC_URI
=
"
/instances
"
@RequireLock
()
def
_GetDetails
(
self
,
instanceslist
):
"""
Returns detailed instance data for bulk output.
...
...
@@ -454,7 +423,7 @@ class R_instances(R_Generic):
If the optional
'
bulk
'
argument is provided and set to
'
true
'
value (i.e
'
?bulk=1
'
), the output contains detailed
information about instances as a list.
Note: Lock required.
information about instances as a list.
Example: [
{
...
...
@@ -495,7 +464,6 @@ class R_instances_name(R_Generic):
"""
DOC_URI
=
"
/instances/[instance_name]
"
@RequireLock
()
def
GET
(
self
):
"""
Send information about an instance.
...
...
@@ -537,7 +505,6 @@ class R_os(R_Generic):
"""
DOC_URI
=
"
/os
"
@RequireLock
()
def
GET
(
self
):
"""
Return a list of all OSes.
...
...
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