Merge "VMAX driver - replace pickle with jsonutils"
This commit is contained in:
commit
e43ce2088e
cinder
@ -8662,7 +8662,7 @@ class VMAXUtilsTest(test.TestCase):
|
||||
self.driver.utils.insert_live_migration_record(
|
||||
self.data.test_volume, maskingviewdict, connector, extraSpecs)
|
||||
mock_open.assert_called_once_with(
|
||||
utils.LIVE_MIGRATION_FILE, "wb")
|
||||
utils.LIVE_MIGRATION_FILE, "w")
|
||||
|
||||
@mock.patch.object(
|
||||
common.VMAXCommon,
|
||||
@ -8685,12 +8685,12 @@ class VMAXUtilsTest(test.TestCase):
|
||||
'/livemigrationarray')
|
||||
m = mock.mock_open()
|
||||
with mock.patch('{}.open'.format(__name__), m, create=True):
|
||||
with open(utils.LIVE_MIGRATION_FILE, "wb") as f:
|
||||
with open(utils.LIVE_MIGRATION_FILE, "w") as f:
|
||||
f.write('live migration details')
|
||||
self.driver.utils.insert_live_migration_record(
|
||||
self.data.test_volume, maskingviewdict, connector, extraSpecs)
|
||||
self.driver.utils.delete_live_migration_record(self.data.test_volume)
|
||||
m.assert_called_once_with(utils.LIVE_MIGRATION_FILE, "wb")
|
||||
m.assert_called_once_with(utils.LIVE_MIGRATION_FILE, "w")
|
||||
shutil.rmtree(tempdir)
|
||||
|
||||
@mock.patch.object(
|
||||
|
@ -17,13 +17,13 @@ import ast
|
||||
import datetime
|
||||
import hashlib
|
||||
import os
|
||||
import pickle
|
||||
import random
|
||||
import re
|
||||
import time
|
||||
from xml.dom import minidom
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import loopingcall
|
||||
from oslo_utils import units
|
||||
import six
|
||||
@ -2704,8 +2704,8 @@ class VMAXUtils(object):
|
||||
live_migration_details = {volume['id']: [maskingviewdict,
|
||||
connector, extraSpecs]}
|
||||
try:
|
||||
with open(LIVE_MIGRATION_FILE, "wb") as f:
|
||||
pickle.dump(live_migration_details, f)
|
||||
with open(LIVE_MIGRATION_FILE, "w") as f:
|
||||
jsonutils.dump(live_migration_details, f)
|
||||
except Exception:
|
||||
exceptionMessage = (_(
|
||||
"Error in processing live migration file."))
|
||||
@ -2725,8 +2725,8 @@ class VMAXUtils(object):
|
||||
if live_migration_details:
|
||||
if volume['id'] in live_migration_details:
|
||||
del live_migration_details[volume['id']]
|
||||
with open(LIVE_MIGRATION_FILE, "wb") as f:
|
||||
pickle.dump(live_migration_details, f)
|
||||
with open(LIVE_MIGRATION_FILE, "w") as f:
|
||||
jsonutils.dump(live_migration_details, f)
|
||||
else:
|
||||
LOG.debug("%(Volume)s doesn't exist in live migration "
|
||||
"record.",
|
||||
@ -2745,7 +2745,7 @@ class VMAXUtils(object):
|
||||
returned_record = None
|
||||
if os.path.isfile(LIVE_MIGRATION_FILE):
|
||||
with open(LIVE_MIGRATION_FILE, "rb") as f:
|
||||
live_migration_details = pickle.load(f)
|
||||
live_migration_details = jsonutils.load(f)
|
||||
if returnallrecords:
|
||||
returned_record = live_migration_details
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user