On Thu, Aug 6, 2015 at 12:26 PM, Łukasz Szymczyk
<[email protected]> wrote:
> Hi,
>
> I'm writing some program to replace image in cluster with it's copy.
> But I have problem with metadata_list.
> I created pool:
> #rados mkpool dupa
> then I created image:
> #rbd create --size 1000 -p mypool image --image-format 2
>
> Below is code which tries to get metadata, but it fails with -EOPNOTSUPP.
> I compile it with command like this:
> g++ file.cpp -lrbd -lrados -I/ceph/source/directory/src
>
> #include <stdio.h>
> #include <stdlib.h>
> #include "include/rbd/librbd.h"
> #include "include/rbd/librbd.hpp"
> using namespace ceph;
> #include "librbd/ImageCtx.h"
>
> int main() {
> rados_t clu;
> int ret = rados_create(&clu, NULL);
> if (ret) return -1;
>
> ret = rados_conf_read_file(clu, NULL);
> if (ret) return -1;
>
> rados_conf_parse_env(clu, NULL);
> ret = rados_connect(clu);
> if (ret) return -1;
>
> rados_ioctx_t io;
> ret = rados_ioctx_create(clu, "mypool", &io);
> if (ret) return -1;
>
> rbd_image_t im;
> ret = rbd_open(io, "image", &im, NULL);
> if (ret) return -1;
>
> librbd::ImageCtx *ic = (librbd::ImageCtx*)im;
> std::string start;
> int max = 1000;
> bufferlist in, out;
> ::encode(start, in);
> ::encode(max, in);
> ret = ((librados::IoCtx*)&io)->exec(ic->header_oid, "rbd",
> "metadata_list", in, out);
> if (ret < 0) printf("fail\n");
You should use rbd_metadata_list() C API instead of this.
>
> return 0;
>
> }
>
> So, my question is: what should be set/enabled to get those metadata?
> Or maybe what I'm doing wrong here.
Try "rbd image-meta list image"?
It's a fairly recent feature, are you sure your OSDs support it?
What's the output of "ceph daemon osd.0 version"?
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html