Project

General

Profile

Feature #1413

librbd asynchronous copy

Added by Damien Churchill over 12 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
librbd
Target version:
% Done:

0%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

It would be handy if there was an asynchronous version of the librbd copy method. Or at least some means of getting some progress reporting using the API.

History

#1 Updated by Sage Weil over 12 years ago

  • Target version set to v0.35
  • translation missing: en.field_position set to 30

#2 Updated by Sage Weil over 12 years ago

What would such an API look like? Copy is implemented using read_iterate... we could add a user-supplied callback that reports the byte offset.

Whatever it is, we should do the same for import, export, and any other long-running operation.

#3 Updated by Colin McCabe over 12 years ago

  • Assignee set to Colin McCabe

#4 Updated by Damien Churchill over 12 years ago

I would say the callback route would be best.

Something along the lines of:

callback(int totalChunks, int chunks, int chunkSize, void* userData)

would be good.

#5 Updated by Yehuda Sadeh over 12 years ago

For being more in line with the read_iterate() that'll call it, I suggest:

for C:

int callback(uint64_t total_len, uint64_t ofs, const char *chunk_data, uint64_t chunk_len, void *user_data);

for C++:

class RbdCopyContext {
public:
int callback(uint64_t total_len, uint64_t ofs, bufferlist& bl) = 0;
};

#6 Updated by Damien Churchill over 12 years ago

Works for me

#7 Updated by Colin McCabe over 12 years ago

Thanks, Yehuda. I suppose it does make sense to provide a C++-style API with a virtual base class, just to be consistent with the rest of the interface. As Sage said, we should also make this slightly more generic and call it something like ProgressContext / callback so that it can be used with some other rbd operations.

#8 Updated by Colin McCabe over 12 years ago

  • Status changed from New to Resolved

implemented

Also available in: Atom PDF