Project

General

Profile

Actions

Feature #19441

open

Merge snapshot of the cloned image back to the parent image

Added by Maxim Manuylov about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

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

Description

Hi!

I would like to use Ceph as a storage for CI build caches. I have a working Ceph cluster and created an image with my build data. Then I want to update that data and make a snapshot on every VCS commit - so I could perform builds incrementally using the data from the previous snapshot. And I want to remove the obsolete snapshots after some time since I do not need them anymore.

The problem is that Ceph image normally uses "plain" snapshot structure (s0 -> s1 -> s2 -> ...) while VCS has a tree of commits. I have thought of the following approaches (no one of which fully satisfies my needs though):

1). Seems it is possible to have a tree of snapshots in a Ceph image because one can rollback to the previous snapshot, make some changes to the image content and take snapshot again. Then the snapshot we rolled back to has two "child" snapshots and we can clone any of them. So my algorithm of processing a new VCS commit could look like this:

  • Find parent commit and corresponding image snapshot
  • Rollback the image to that snapshot
  • Run the build updating image content
  • Take a new snapshot

But this approach has important disadvantages:

  • Rollback is not an immediate operation and can take some time
  • It's not possible to process two revisions simultaneously (e.g. from the different branches) since I cannot rollback an image to two snapshots at the same time

2). Instead of rolling the image back, I can just clone needed snapshot. Then the algorithm looks like this:

  • Find parent commit and corresponding image snapshot
  • Clone that snapshot
  • Run the build updating cloned image content
  • Take a new snapshot of the cloned image

Here cloning is an immediate operation and the original image is not affected anyhow so I could build any number of revisions simultaneously. But there are some new problems those previous approach did not have:

  • Now my snapshots are distributed among several images and I must handle somehow which one belongs to which image to find needed image/snapshot pair on the first step of my algorithm (but OK, it's not an unsolvable problem, just an inconvenience)
  • Now I cannot delete obsolete snapshots because they have child clones (and it is already a big problem)

What I actually dream about is a mixed approach:

  • Find parent commit and corresponding image snapshot
  • Clone that snapshot
  • Run the build updating cloned image content
  • Take a new snapshot of the cloned image
  • (!) Move/merge this snapshot back to the original image and delete the cloned one

Is it possible to create such an operation to merge new snapshot to the original image deleting the cloned image? And since there is no copying of the blocks (if the cloned image is deleted) this operation probably could be O(1).

No data to display

Actions

Also available in: Atom PDF