def convert_image(source, dest, out_format, bps_limit=None):
"""Convert image to other format."""
start_time = timeutils.utcnow()
- cmd = ('qemu-img', 'convert', '-O', out_format, source, dest)
+ # Always set -t none. First it is needed for cgroup io/limiting
+ # and it is needed to ensure that all data hit the device before
+ # it gets unmapped remotely from the host
+ cmd = ('qemu-img', 'convert',
+ '-t', 'none',
+ '-O', out_format, source, dest)
cgcmd = volume_utils.setup_blkio_cgroup(source, dest, bps_limit)
if cgcmd:
cmd = tuple(cgcmd) + cmd
- cmd += ('-t', 'none') # required to enable ratelimit by blkio cgroup
utils.execute(*cmd, run_as_root=True)
duration = timeutils.delta_seconds(start_time, timeutils.utcnow())
TEST_SOURCE = 'img/qemu.img'
TEST_DEST = '/img/vmware.vmdk'
- utils.execute('qemu-img', 'convert', '-O', TEST_OUT_FORMAT,
- TEST_SOURCE, TEST_DEST, run_as_root=True)
+ utils.execute(
+ 'qemu-img', 'convert', '-t', 'none', '-O', TEST_OUT_FORMAT,
+ TEST_SOURCE, TEST_DEST, run_as_root=True)
mox.ReplayAll()
if has_qemu and dest_inf:
if bps_limit:
prefix = ('cgexec', '-g', 'blkio:test')
- postfix = ('-t', 'none')
else:
- prefix = postfix = ()
- cmd = prefix + ('qemu-img', 'convert', '-O', 'raw',
- self.TEST_DEV_PATH, self.TEST_DEV_PATH) + postfix
+ prefix = ()
+ cmd = prefix + ('qemu-img', 'convert', '-t', 'none', '-O', 'raw',
+ self.TEST_DEV_PATH, self.TEST_DEV_PATH)
volume_utils.setup_blkio_cgroup(
self.TEST_DEV_PATH, self.TEST_DEV_PATH,
if bps_limit:
CONF.set_override('volume_copy_bps_limit', bps_limit)
prefix = ('cgexec', '-g', 'blkio:test')
- postfix = ('-t', 'none')
else:
- prefix = postfix = ()
- cmd = prefix + ('qemu-img', 'convert', '-O', 'qcow2',
- mox.IgnoreArg(), mox.IgnoreArg()) + postfix
+ prefix = ()
+ cmd = prefix + ('qemu-img', 'convert', '-t', 'none', '-O', 'qcow2',
+ mox.IgnoreArg(), mox.IgnoreArg())
m = self._mox
m.StubOutWithMock(utils, 'execute')
m = self._mox
m.StubOutWithMock(utils, 'execute')
- utils.execute('qemu-img', 'convert', '-O', 'qcow2',
+ utils.execute('qemu-img', 'convert', '-t', 'none', '-O', 'qcow2',
mox.IgnoreArg(), mox.IgnoreArg(), run_as_root=True)
utils.execute(
'env', 'LC_ALL=C', 'qemu-img', 'info',