According to commit 707aee09 the configuration "cache=none" must be set
to allow live migration.
So do it on get_disk_xml() to make sure all guest disks will have this
configuration.
The test needed to be updated because libvirt uses O_DIRECT flag when
cache=none to read the disk file and it is not supported on tmpfs.
For reference:
https://www.redhat.com/archives/libvir-list/2013-August/msg00783.html
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/xmlutils/disk.py | 6 +++++-
tests/test_model.py | 3 ++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/xmlutils/disk.py b/src/kimchi/xmlutils/disk.py
index 2520929..64e243a 100644
--- a/src/kimchi/xmlutils/disk.py
+++ b/src/kimchi/xmlutils/disk.py
@@ -50,7 +50,11 @@ def get_disk_xml(params):
if disk_type is None:
disk_type = _get_disk_type(path) if len(path) > 0 else 'file'
disk = E.disk(type=disk_type, device=params['type'])
- disk.append(E.driver(name='qemu', type=params['format']))
+ driver = E.driver(name='qemu', type=params['format'])
+ if params['type'] != 'cdrom':
+ driver.set('cache', 'none')
+
+ disk.append(driver)
# Get device name according to bus and index values
dev = params.get('dev', (BUS_TO_DEV_MAP[params['bus']] +
diff --git a/tests/test_model.py b/tests/test_model.py
index 563e80a..8fbb642 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -267,12 +267,13 @@ class ModelTests(unittest.TestCase):
inst = model.Model(objstore_loc=self.tmp_store)
with RollbackContext() as rollback:
- path = '/tmp/kimchi-images'
+ path = os.path.join(os.getcwd(), 'kimchi-images')
pool = 'test-pool'
vol = 'test-volume.img'
vol_path = "%s/%s" % (path, vol)
if not os.path.exists(path):
os.mkdir(path)
+ rollback.prependDefer(shutil.rmtree, path)
args = {'name': pool,
'path': path,
--
1.9.3