Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How implement rbd export/import using go-ceph? #319

Closed
mysugar opened this issue Jul 1, 2020 · 6 comments
Closed

How implement rbd export/import using go-ceph? #319

mysugar opened this issue Jul 1, 2020 · 6 comments

Comments

@mysugar
Copy link

mysugar commented Jul 1, 2020

I did not found export func on rbd.Image stuct , any idea to implement this?

@mysugar mysugar changed the title How implement rbd export/import useing go-ceph? How implement rbd export/import using go-ceph? Jul 1, 2020
@agarwal-mudit
Copy link
Collaborator

Are you talking about this?

@nixpanic
Copy link
Member

nixpanic commented Jul 1, 2020

What kind of Export() interface do you expect? You already noticed you can use Read() and Write() to the image in #318.

@mysugar
Copy link
Author

mysugar commented Jul 1, 2020

I mean the rbd export on linux cli

[root@nceph ~]# rbd info test/disk01
rbd image 'disk01':
	size 10GiB in 2560 objects
	order 22 (4MiB objects)
	block_name_prefix: rbd_data.10286b8b4567
	format: 2
	features: layering
	flags: 
	create_timestamp: Wed Jun 17 15:40:08 2020
[root@nceph ~]# rbd export test/disk01  /tmp/disk01.rbd
Exporting image: 100% complete...done.
[root@nceph ~]# du -sh /tmp/disk01.rbd 
639M	/tmp/disk01.rbd

If use Read() the size of /tmp/disk01.rbd will be 10G.

@nixpanic
Copy link
Member

nixpanic commented Jul 1, 2020

Ah, that probably uses rbd_read_iterate2() to skip writing the zero-filled areas of the image. We do not have that in go-ceph yet.

Or it could be used in combination with SeekHole and SeekData, but we do not have that yet either.

@phlogistonjohn
Copy link
Collaborator

We have issue #279 filed for rbd_read_iterate2. I don't think seek style interfaces are implemented (in librdb). Where they do exist, in cephfs, the Seek(Hole|Data) whence values don't actually seek the holes or data, they're just stubs (see issue #227).

In the short term I suggest doing a simple copy loop as @nixpanic suggests with read calls and perhaps do hole detection yourself (eg. read N-size blocks and if the block is all zeros seek forward in your destination file). In the future, when rbd_read_iterate2 or other hole sensitive calls are available use it as an optimization. It's not pretty but that's today's situation AFAICT.

@mysugar mysugar closed this as completed Jul 3, 2020
@tareksha
Copy link

Hi @nixpanic, @phlogistonjohn, the export command in rbd cli does not only dump the sparse contents. It produces a file in a special format that also contains the image metadata and diffs.
https://docs.ceph.com/en/pacific/dev/rbd-export/
Is it withinbgo-ceph's scope to have a full implementation of export/import?

@ceph ceph locked and limited conversation to collaborators Dec 22, 2021
@phlogistonjohn phlogistonjohn converted this issue into discussion #625 Dec 22, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants