Skip to content
Snippets Groups Projects
Commit b2017320 authored by Filippos Giannakos's avatar Filippos Giannakos
Browse files

Add preliminary support for userspace cache

parent a1f81863
No related branches found
No related tags found
No related merge requests found
...@@ -281,7 +281,7 @@ def snapshot(env): ...@@ -281,7 +281,7 @@ def snapshot(env):
return 1 return 1
def format_qemu_uri(name, pool=None, cephx=None, conf_file=None): def format_qemu_uri(name, pool=None, cephx=None, conf_file=None, cache=None):
"""Create a QEMU RBD URI for the specific image / environment""" """Create a QEMU RBD URI for the specific image / environment"""
uri = 'kvm:rbd:%s' % RBD.format_name(name, pool=pool) uri = 'kvm:rbd:%s' % RBD.format_name(name, pool=pool)
...@@ -290,6 +290,9 @@ def format_qemu_uri(name, pool=None, cephx=None, conf_file=None): ...@@ -290,6 +290,9 @@ def format_qemu_uri(name, pool=None, cephx=None, conf_file=None):
extra_conf += ':id=%s' % cephx['id'] extra_conf += ':id=%s' % cephx['id']
if conf_file: if conf_file:
extra_conf += ':conf=%s' % conf_file extra_conf += ':conf=%s' % conf_file
# TODO: we need to revisit this, to support more caching modes correctly.
if cache in ['writeback']:
extra_conf += ':rbd_cache=true'
if extra_conf: if extra_conf:
uri += extra_conf uri += extra_conf
...@@ -311,6 +314,7 @@ def attach(env): ...@@ -311,6 +314,7 @@ def attach(env):
name = env.get("name") name = env.get("name")
pool = env.get("rbd_pool") pool = env.get("rbd_pool")
cephx = env.get("cephx") cephx = env.get("cephx")
cache = env.get("cache")
if userspace_only: if userspace_only:
device = "" device = ""
else: else:
...@@ -325,7 +329,7 @@ def attach(env): ...@@ -325,7 +329,7 @@ def attach(env):
% (RBD.format_name(name, pool=pool), device)) % (RBD.format_name(name, pool=pool), device))
sys.stdout.write("%s" % device) sys.stdout.write("%s" % device)
qemu_uri = format_qemu_uri(name, pool=pool, cephx=cephx) qemu_uri = format_qemu_uri(name, pool=pool, cephx=cephx, cache=cache)
sys.stdout.write("\n%s" % qemu_uri) sys.stdout.write("\n%s" % qemu_uri)
return 0 return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment