Skip to content

Commit

Permalink
Merge pull request #12 from flyingcircusio/DIR-919-disable-writeback-…
Browse files Browse the repository at this point in the history
…cache

disable the writeback cache
  • Loading branch information
ctheune authored Jan 8, 2024
2 parents b2ec6c0 + 71342a2 commit a138ab8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 37 deletions.
3 changes: 1 addition & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Release notes
1.4.3 (unreleased)
------------------

- Nothing changed yet.

- Disable the writeback cache (DIR-919)

1.4.2 (2023-12-15)
------------------
Expand Down
1 change: 0 additions & 1 deletion src/fc/qemu/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,6 @@ def generate_config(self):
self.qemu.config = tpl.format(
accelerator=accelerator,
machine_type=machine_type,
disk_cache_mode=self.qemu.disk_cache_mode,
network="".join(netconfig),
**self.cfg,
)
11 changes: 0 additions & 11 deletions src/fc/qemu/hazmat/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,6 @@ def __init__(self, vm_cfg):
]:
setattr(self, f, getattr(self, f).format(**vm_cfg))

# prepare qemu-specific config settings
self.qemu_cfg = self.cfg.get("qemu", {})

# The default if nothing is set is to enable "writeback" for backwards
# compatability: before introducing this option everything used
# writeback.
if self.qemu_cfg.get("write_back_cache", True):
self.disk_cache_mode = "writeback"
else:
self.disk_cache_mode = "none"

# We are running qemu with chroot which causes us to not be able to
# resolve names. :( See #13837.
a = self.migration_address.split(":")
Expand Down
6 changes: 3 additions & 3 deletions src/fc/qemu/qemu.vm.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
format = "rbd"
file = "rbd:{rbd_pool}/{name}.root:id={{ceph_id}}"
aio = "threads"
cache = "{disk_cache_mode}"
cache = "none"

[drive]
index = "1"
Expand All @@ -29,7 +29,7 @@
format = "rbd"
file = "rbd:{rbd_pool}/{name}.swap:id={{ceph_id}}"
aio = "threads"
cache = "{disk_cache_mode}"
cache = "none"

[drive]
index = "2"
Expand All @@ -38,7 +38,7 @@
format = "rbd"
file = "rbd:{rbd_pool}/{name}.tmp:id={{ceph_id}}"
aio = "threads"
cache = "{disk_cache_mode}"
cache = "none"

[device]
driver = "virtio-rng-pci"
Expand Down
20 changes: 0 additions & 20 deletions src/fc/qemu/tests/qemu_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,3 @@ def test_proc_pidfile_with_garbage(qemu_with_pidfile):
with open(qemu_with_pidfile.pidfile, "a") as f:
f.write("trailing line\n")
assert isinstance(qemu_with_pidfile.proc(), psutil.Process)


def test_disk_cache_mode_default_writeback():
q = Qemu(dict(name="testvm", id=1234))
assert q.disk_cache_mode == "writeback"


def test_disk_cache_mode_default_writeback2():
q = Qemu(dict(name="testvm", id=1234, qemu=dict()))
assert q.disk_cache_mode == "writeback"


def test_disk_cache_mode_enc_enabled():
q = Qemu(dict(name="testvm", id=1234, qemu=dict(write_back_cache=True)))
assert q.disk_cache_mode == "writeback"


def test_disk_cache_mode_enc_disabled():
q = Qemu(dict(name="testvm", id=1234, qemu=dict(write_back_cache=False)))
assert q.disk_cache_mode == "none"

0 comments on commit a138ab8

Please sign in to comment.