Skip to content
Snippets Groups Projects
Commit 914dc8ec authored by Thibault VINCENT's avatar Thibault VINCENT
Browse files

fix: cleanup of volume copy handlers

parent 6a54e8e0
No related branches found
No related tags found
No related merge requests found
......@@ -691,6 +691,9 @@ class NodeHandler(RpcHandler):
# Storage control
##################################
###
# Volume management
@pure
def vol_create(self, pool, name, size):
'''
......@@ -715,15 +718,23 @@ class NodeHandler(RpcHandler):
else:
raise NotImplementedError('host handler has no storage support')
@pure
def vol_copy(self, pool, name, dest_pool, dest_name):
raise NotImplementedError()
###
# Basic network copy
@pure
def vol_export(self, pool, name, raddr, rport):
'''
'''
rport = int(rport)
jmgr = self._host_handle.jobmgr
if hasattr(self._host_handle, 'storage'):
# get device path info
# facilities
sto = self._host_handle.storage()
jmgr = self._host_handle.jobmgr
# get device path
vol_path = sto.pool_get(pool).volume_get(name).get_path()
# create job
job = SendFileJob(jmgr, vol_path, raddr, rport)
......@@ -747,12 +758,14 @@ class NodeHandler(RpcHandler):
'''
'''
if hasattr(self._host_handle, 'storage'):
# get device path info
# facilities
sto = self._host_handle.storage()
# get device path
vol_path = sto.pool_get(pool).volume_get(name).get_path()
# create job
job = ReceiveFileJob(self._host_handle.jobmgr, vol_path)
# prepare job now, so we can fetch the port number below
# do the preparation immediately, so we can fetch the port number
# before the job starts
job.prepare()
job.start_now()
# return job info
......@@ -787,7 +800,14 @@ class NodeHandler(RpcHandler):
'''
'''
jid = int(jid)
# facilities
jmgr = self._host_handle.jobmgr
# get the job
job = jmgr.get_job(jid)
# check job type
if job.get_type() != 'ReceiveFileJob':
raise HostError('this job ID does not match a volume import')
# cancel it
jmgr.cancel(jid)
###
......@@ -882,11 +902,6 @@ class NodeHandler(RpcHandler):
# FIXME
job.drbd_stop()
##################################
# Job management
##################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment