[linux-lvm] [Yum-devel] [PATCH 4/2] fs snapshot plugin: add LVM tag to allow tools to link pre and post snapshots

James Antill james at fedoraproject.org
Tue Mar 12 13:46:12 UTC 2013

On Mon, 2013-03-11 at 17:25 -0400, Mike Snitzer wrote:
> Add a "yum_fs_snapshot_<trans_id>_<origin_volume>" LVM tag to LVM-based
> snapshots (old or thinp).  These tags will allow tools (e.g snapper) to
> link the pre and post snapshot volumes together.
> yum_fs_snapshot_trans_id() uses the first 16 digits of the hash() of the
> rpm TransactionSet instance to establish a unique id that is common to
> both the pretrans_hook() and posttrans_hook() -- this is quite the hack;
> I'm open to using other (more future-proof) methods.

 Esp. as hash(ts.ts) is just the address of the pointer for that object
in C.
 It depends what you want, I guess.
 My first guess is that you'd want roughly what the rest of yum uses,

rpmdbv  = self.rpmdb.simpleVersion(main_only=True)[0]
frpmdbv = self.tsInfo.futureRpmDBVersion()

...except things like yum history also get the real "future" rpmdbv
after the transaction happens, which this can't (unless we can add the
tags in post_trans? -- and then there are problems about what happens if
we don't get there).

 This should identify the state of the system, and what will happen well
enough ... but that means if the user does:

yum blah
yum history undo last
yum history undo last
yum history undo last

...you'll have multiple snapshots with the same tag (as the system will
be in the same states from the packaging POV -- is this what you want?).
 The other alternative is to just use a stored time.time(), of the first
snapshot (or maybe that and the start rpmdbv?).

More information about the linux-lvm mailing list