# under the License.
+import math
import mock
import os
import tempfile
self.cfg.rbd_secret_uuid = None
self.cfg.rbd_user = None
self.cfg.volume_dd_blocksize = '1M'
+ self.cfg.rbd_store_chunk_size = 4
mock_exec = mock.Mock()
mock_exec.return_value = ('', '')
self.driver.create_volume(self.volume)
+ chunk_size = self.cfg.rbd_store_chunk_size * units.MiB
+ order = int(math.log(chunk_size, 2))
args = [client.ioctx, str(self.volume_name),
- self.volume_size * units.GiB]
+ self.volume_size * units.GiB, order]
kwargs = {'old_format': False,
'features': self.mock_rbd.RBD_FEATURE_LAYERING}
self.mock_rbd.RBD.create.assert_called_once_with(*args, **kwargs)
self.driver.create_volume(self.volume)
+ chunk_size = self.cfg.rbd_store_chunk_size * units.MiB
+ order = int(math.log(chunk_size, 2))
args = [client.ioctx, str(self.volume_name),
- self.volume_size * units.GiB]
+ self.volume_size * units.GiB, order]
kwargs = {'old_format': True,
'features': 0}
self.mock_rbd.RBD.create.assert_called_once_with(*args, **kwargs)
from __future__ import absolute_import
import io
import json
+import math
import os
import tempfile
import urllib
default=5,
help='Maximum number of nested volume clones that are '
'taken before a flatten occurs. Set to 0 to disable '
- 'cloning.')]
+ 'cloning.'),
+ cfg.IntOpt('rbd_store_chunk_size', default=4,
+ help=_('Volumes will be chunked into objects of this size '
+ '(in megabytes).')),
+]
CONF = cfg.CONF
CONF.register_opts(rbd_opts)
old_format = True
features = 0
+ chunk_size = CONF.rbd_store_chunk_size * units.MiB
+ order = int(math.log(chunk_size, 2))
if self._supports_layering():
old_format = False
features = self.rbd.RBD_FEATURE_LAYERING
self.rbd.RBD().create(client.ioctx,
str(volume['name']),
size,
+ order,
old_format=old_format,
features=features)
self.delete_volume(volume)
+ chunk_size = CONF.rbd_store_chunk_size * units.MiB
+ order = int(math.log(chunk_size, 2))
# keep using the command line import instead of librbd since it
# detects zeroes to preserve sparseness in the image
args = ['rbd', 'import',
'--pool', self.configuration.rbd_pool,
+ '--order', order,
tmp.name, volume['name']]
if self._supports_layering():
args.append('--new-format')