r = rbd.stat(image, info);
if (r < 0)
return r;
-#if 0
+
r = rbd.read_iterate(image, 0, info.size, export_read_cb, (void *)&fd);
if (r < 0)
return r;
-#endif
- librbd::RBD::AioCompletion *completion = rbd.aio_create_completion(NULL, NULL);
- if (!completion) {
- r = -ENOMEM;
- goto done;
- }
- r = rbd.aio_read(image, 0, info.size, bl, completion);
- completion->wait_for_complete();
- r = completion->get_return_value();
- completion->release();
- if (r < 0) {
- cerr << "error writing to image block" << std::endl;
- goto done;
- }
+
r = write(fd, bl.c_str(), bl.length());
if (r < 0)
return r;
r = ftruncate(fd, info.size);
if (r < 0)
return r;
-done:
+
close(fd);
return 0;
update_snap_name(*new_img, snap);
}
-static void write_completion(librbd::completion_t cb, void *arg)
-{
- cout << "write_completion!" << std::endl;
-}
-
static int do_import(librados::pool_t pool, const char *imgname, int *order, const char *path)
{
int fd = open(path, O_RDONLY);
}
bufferlist bl;
bl.append(p);
- cout << "write_completion=" << (void *)write_completion << std::endl;
- librbd::RBD::AioCompletion *completion = rbd.aio_create_completion(NULL, write_completion);
+ librbd::RBD::AioCompletion *completion = rbd.aio_create_completion(NULL, NULL);
if (!completion) {
r = -ENOMEM;
goto done;