Skip to content

Commit

Permalink
fix backup with bytearray copy
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 61ec8de commit 664bf65
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion core/src/plugins/filed/BareosFdPluginOvirt.py
Expand Up @@ -250,7 +250,13 @@ def plugin_io(self, context, IOP):
(self.jobType))

if IOP.func == bIOPS['IO_OPEN']:

self.FNAME = IOP.fname
bareosfd.DebugMessage(
context, 100,
"self.FNAME was set to %s from IOP.fname\n" %
(self.FNAME))

if self.options.get('local') == 'yes':
try:
if IOP.flags & (os.O_CREAT | os.O_WRONLY):
Expand Down Expand Up @@ -311,8 +317,13 @@ def plugin_io(self, context, IOP):
context, 100,
"plugin_io: read from file %s\n" % (self.backup_obj['file']['filename']) )
elif 'disk' in self.backup_obj:
bareosfd.DebugMessage(
context, 100,
"plugin_io: read from disk %s\n" % (self.backup_obj['disk'].alias) )
try:
IOP.buf = self.ovirt.process_download(context, IOP.count)
IOP.buf = bytearray(IOP.count)
chunk = self.ovirt.process_download(context, IOP.count)
IOP.buf[:] = chunk
IOP.status = len(IOP.buf)
IOP.io_errno = 0
except Exception as e:
Expand Down Expand Up @@ -340,6 +351,7 @@ def plugin_io(self, context, IOP):
except IOError as msg:
IOP.io_errno = -1
bareosfd.DebugMessage(context, 100, "Error writing data: " + msg + "\n");
return bRCs['bRC_Error']
elif self.FNAME.endswith('.ovf'):
self.ovirt.process_ovf(context,IOP.buf)
IOP.status = IOP.count
Expand Down Expand Up @@ -747,6 +759,7 @@ def start_download(self, context, snapshot, disk):
" Transfer disk snapshot of %s bytes\n" % (str(self.bytes_to_transf)))

def process_download(self,context, chunk_size):

chunk = ""

bareosfd.DebugMessage(
Expand Down

0 comments on commit 664bf65

Please sign in to comment.