Skip to content

Commit

Permalink
WIP Open files as binary for use by pickle
Browse files Browse the repository at this point in the history
TODO: audit other instances
  • Loading branch information
ydirson committed Feb 26, 2024
1 parent 5201c16 commit 1ce4b09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xapi/storage/libs/tapdisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def save_tapdisk_metadata(dbg, path, tap):
except OSError as e:
if e.errno != errno.EEXIST:
raise
with open(dirname + "/" + TD_PROC_METADATA_FILE, "w") as fd:
with open(dirname + "/" + TD_PROC_METADATA_FILE, "wb") as fd:
pickle.dump(tap.__dict__, fd)


Expand All @@ -251,7 +251,7 @@ def load_tapdisk_metadata(dbg, path):
# if not(os.path.exists(filename)):
# raise Exception('volume doesn\'t exist')
# #raise xapi.storage.api.v5.volume.Volume_does_not_exist(dirname)
with open(filename, "r") as fd:
with open(filename, "rb") as fd:
meta = pickle.load(fd)
tap = Tapdisk(meta['minor'], meta['pid'], meta['f'])
tap.secondary = meta['secondary']
Expand Down

0 comments on commit 1ce4b09

Please sign in to comment.