On 12/19/19 7:34 AM, Florian Florensa wrote:
Starting from ceph Nautilus, RBD has support for namespaces, allowing
for finer grain ACLs on images inside a pool, and tenant isolation.

In the rbd cli tool documentation, the new image-spec and snap-spec are :
  - [pool-name/[namespace-name/]]image-name
  - [pool-name/[namespace-name/]]image-name@snap-name

When using an non namespace's enabled qemu, it complains about not
finding the image called namespace-name/image-name, thus we only need to
parse the image once again to find if there is a '/' in its name, and if
there is, use what is before it as the name of the namespace to later
pass it to rados_ioctx_set_namespace.
rados_ioctx_set_namespace if called with en empty string or a null
pointer as the namespace parameters pretty much does nothing, as it then
defaults to the default namespace.

The namespace is extracted inside qemu_rbd_parse_filename, stored in the
qdict, and used in qemu_rbd_connect to make it work with both qemu-img,
and qemu itself.

Signed-off-by: Florian Florensa <fflore...@online.net>
---

+++ b/qapi/block-core.json
@@ -3657,6 +3657,8 @@
  #
  # @pool:               Ceph pool name.
  #
+# @nspace:             Rados namespace name in the Ceph pool.
+#

Needs a '(since 5.0)' tag.

  # @image:              Image name in the Ceph pool.
  #
  # @conf:               path to Ceph configuration file.  Values
@@ -3683,6 +3685,7 @@
  ##
  { 'struct': 'BlockdevOptionsRbd',
    'data': { 'pool': 'str',
+            'nspace': 'str',

This makes a new argument mandatory, which breaks expectations of older clients that failed to provide it. You probably want to make it '*nspace', and have a sane default when the argument is not present.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Reply via email to