Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-node
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
Mirror
cc-node
Commits
07d58ce9
Commit
07d58ce9
authored
13 years ago
by
Thibault VINCENT
Browse files
Options
Downloads
Patches
Plain Diff
add: handlers to manage drbd
parent
2e8686f0
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
ccnode/handlers.py
+93
-0
93 additions, 0 deletions
ccnode/handlers.py
with
93 additions
and
0 deletions
ccnode/handlers.py
+
93
−
0
View file @
07d58ce9
...
...
@@ -795,6 +795,99 @@ class NodeHandler(RpcHandler):
jid
=
int
(
jid
)
jmgr
=
self
.
_host_handle
.
jobmgr
jmgr
.
cancel
(
jid
)
###
# Live network copy
@pure
def
drbd_setup
(
self
,
pool
,
name
):
'''
'''
if
hasattr
(
self
.
_host_handle
,
'
storage
'
):
# facilities
sto
=
self
.
_host_handle
.
storage
()
lvm
=
self
.
_host_handle
.
lvm
jobmgr
=
self
.
_host_handle
.
jobmgr
drbdpool
=
self
.
_host_handle
.
drbdpool
# get pool and volume handles
vol_pool
=
sto
.
pool_get
(
pool
)
vol
=
vol_pool
.
volume_get
(
name
)
# stop if it's not an LVM volume
if
vol_pool
.
get_source_format
()
!=
'
lvm2
'
:
raise
HostError
(
'
not a LVM2 volume, cannot use DRBD
'
)
# fetch LV/VG info
vg_name
=
vol_pool
.
get_source_name
()
lv_name
=
vol
.
get_name
()
# create job
job
=
DrbdCopyJob
(
jobmgr
,
lvm
,
drbdpool
,
vg_name
,
lv_name
)
job
.
start_now
()
return
{
'
jid
'
:
job
.
get_id
(),
'
port
'
:
job
.
drbd_get_port
(),
}
else
:
raise
NotImplementedError
(
'
host handler has no storage support
'
)
@pure
def
drbd_connect
(
self
,
res
,
remote_res
,
remote_ip
):
'''
Connect the local live copy engine to the designated remote host that
will push or pull data.
'''
# facilities
jobmgr
=
self
.
_host_handle
.
jobmgr
# get the job
job
=
jobmgr
.
get_job
(
res
[
'
jid
'
])
# connect node
job
.
drbd_connect
(
remote_ip
,
remote_res
[
'
port
'
])
@pure
def
drbd_role
(
self
,
res
,
primary
):
'''
'''
# facilities
jobmgr
=
self
.
_host_handle
.
jobmgr
# get the job
job
=
jobmgr
.
get_job
(
res
[
'
jid
'
])
# change role
job
.
drbd_role
(
primary
=
primary
)
@pure
def
drbd_takeover
(
self
,
res
,
state
):
'''
'''
# facilities
jobmgr
=
self
.
_host_handle
.
jobmgr
# get the job
job
=
jobmgr
.
get_job
(
res
[
'
jid
'
])
# hijack the VM disk DM
job
.
drbd_takeover
(
state
)
@pure
def
drbd_sync
(
self
,
res
):
'''
Wait for the live copy engine to complete a pending initial disk
synchronization.
'''
# facilities
jobmgr
=
self
.
_host_handle
.
jobmgr
# get the job
job
=
jobmgr
.
get_job
(
res
[
'
jid
'
])
# wait for sync completion
job
.
drbd_waitsync
()
@pure
def
drbd_shutdown
(
self
,
res
):
'''
Close connection and destroy all ressources allocated for a live copy.
'''
# facilities
jobmgr
=
self
.
_host_handle
.
jobmgr
# get the job
job
=
jobmgr
.
get_job
(
res
[
'
jid
'
])
# FIXME
job
.
drbd_stop
()
...
...
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