Skip to content

Commit

Permalink
add requires; add percentage of completed upload; add some warning me…
Browse files Browse the repository at this point in the history
…ssages
  • Loading branch information
Carlos Rodrigues authored and pstorz committed Dec 16, 2019
1 parent 4127e5c commit f4623e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
20 changes: 10 additions & 10 deletions core/src/plugins/filed/BareosFdPluginOvirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ def prepare_vm_restore(self, context, options):
vm_memory = None
if 'vm_memory' in options:
vm_memory = int(options['vm_memory']) * 2**20

vm_cpu = None
if 'vm_cpu' in options:
vm_cpu_arr = options['vm_cpu'].split(',')
Expand Down Expand Up @@ -970,7 +971,7 @@ def prepare_vm_restore(self, context, options):
network = props['Connection']
if network not in self.network_profiles:
bareosfd.JobMessage(
context, bJobMessageType['M_INFO'],
context, bJobMessageType['M_WARNING'],
"No network profile found for '%s'\n" % (network) )
else:
profile_id = self.network_profiles[network]
Expand Down Expand Up @@ -1045,7 +1046,7 @@ def get_vm_disk_by_basename(self, context, fname):
found = disk
else:
bareosfd.JobMessage(
context, bJobMessageType['M_INFO'],
context, bJobMessageType['M_WARNING'],
"The backup have snapshots and only base will be restored\n")

i += 1
Expand Down Expand Up @@ -1163,8 +1164,7 @@ 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)
self.init_bytes_to_transf = 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 All @@ -1185,18 +1185,18 @@ def process_upload(self,context, chunk):

bareosfd.DebugMessage(
context, 100,
"process_upload(): transfer %s of %s \n" %
(self.bytes_to_transf,len(chunk)) )
"process_upload(): transfer %s of %s (%s) \n" %
(self.bytes_to_transf,self.init_bytes_to_transf,len(chunk)) )

self.proxy_connection.send(chunk)

self.bytes_to_transf -= len(chunk)

#completed = 1 - (self.bytes_to_transf / float(self.response.getheader('Content-Length')))
completed = 1 - (self.bytes_to_transf / float(self.init_bytes_to_transf))

#bareosfd.DebugMessage(
# context, 100,
# "process_upload(): Completed {:.0%}\n" . format(completed))
bareosfd.DebugMessage(
context, 100,
"process_upload(): Completed {:.0%}\n" . format(completed))

def end_transfer(self,context):

Expand Down
5 changes: 4 additions & 1 deletion core/src/plugins/filed/packaging/bareos-ovirt-plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ License: GPL
URL: http://eurotux.com
Source: bareos-ovirt-plugin.tar.gz

#BuildRequires:
Requires: bareos-filedaemon-python-plugin
Requires: python-ovirt-engine-sdk4
Requires: openssl
Requires: python-pycurl
Requires: python-lxml


%description
Ovirt backup plugin for Bareos uses the Ovirt API to take a snapshot of running VMs and
Expand Down

0 comments on commit f4623e4

Please sign in to comment.