Skip to content

Commit

Permalink
fix set storage_domain and bytes_to_transf
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Rodrigues authored and pstorz committed Dec 16, 2019
1 parent 152bcc7 commit 8b15890
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions core/src/plugins/filed/BareosFdPluginOvirt.py
Expand Up @@ -67,7 +67,17 @@ def parse_plugin_definition(self, context, plugindef):

bareosfd.DebugMessage(
context, 100,
"BareosFdPluginOvirt:parse_plugin_definition() called\n")
"BareosFdPluginOvirt:parse_plugin_definition() called with options '%s' \n" % str(self.options))
return bRCs['bRC_OK']

def check_options(self, context, mandatory_options=None):
'''
Check Plugin options
Note: this is called by parent class parse_plugin_definition(),
to handle plugin options entered at restore, the real check
here is done by check_plugin_options() which is called from
start_backup_job() and start_restore_job()
'''
return bRCs['bRC_OK']

def start_backup_job(self, context):
Expand Down Expand Up @@ -539,7 +549,7 @@ def get_vm(self, context, options):
if 'uuid' in options:
search = "uuid=%s" % str(options['uuid'])
elif 'vmname' in options:
search = "name=%s" % str(options['vmname'])
search = "name=%s" % str(options['vm_name'])

if search is not None:
bareosfd.DebugMessage(
Expand Down Expand Up @@ -874,6 +884,8 @@ def prepare_vm_restore(self, context, options):
key = key.replace('{%s}' % OVF_NAMESPACES['ovf'], '')
props[key] = value

# set storage domain
props['storage_domain'] = storage_domain
self.restore_objects.append(props)

return bRCs['bRC_OK']
Expand Down Expand Up @@ -1037,7 +1049,8 @@ def start_upload(self, context, disk):
self.proxy_connection.putrequest("PUT", proxy_url.path)
self.proxy_connection.putheader('Authorization', transfer.signed_ticket)

self.bytes_to_transf = int(disk.actual_size) * 2**30
#self.bytes_to_transf = int(disk.actual_size) * 2**30
self.bytes_to_transf = int(disk.actual_size)

content_range = "bytes %d-%d/%d" % (0, self.bytes_to_transf - 1, self.bytes_to_transf)
self.proxy_connection.putheader('Content-Range', content_range)
Expand Down

0 comments on commit 8b15890

Please sign in to comment.