The Illumos version of 'dd' never stops in case of count=0.
Thus 'truncate' should be used for creating a sparsed file.
Change-Id: I7a1840e2c43a27c648e5f65c2a87286311a34516
'stack/share/volume-1',
self.TEST_SHARE_OPTS)
self.nms_mock.appliance.execute(
- 'dd if=/dev/zero of=/volumes/stack/share/volume-1/volume bs=1M '
- 'count=0 seek=1024'
- )
+ 'truncate --size 1G /volumes/stack/share/volume-1/volume')
self.nms_mock.appliance.execute('chmod ugo+rw '
'/volumes/stack/share/volume-1/volume')
volume)
def test_create_sparsed_file(self):
- self.nms_mock.appliance.execute('dd if=/dev/zero of=/tmp/path bs=1M '
- 'count=0 seek=1024')
+ self.nms_mock.appliance.execute('truncate --size 1G /tmp/path')
self.mox.ReplayAll()
self.drv._create_sparsed_file(self.nms_mock, '/tmp/path', 1)
:param path: path to new file
:param size: size of file
"""
- block_size_mb = 1
- block_count = size * units.GiB / (block_size_mb * units.MiB)
-
nms.appliance.execute(
- 'dd if=/dev/zero of=%(path)s bs=%(bs)dM count=0 seek=%(count)d' % {
+ 'truncate --size %(size)dG %(path)s' % {
'path': path,
- 'bs': block_size_mb,
- 'count': block_count
+ 'size': size
}
)