linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: James Antill <james@fedoraproject.org>
To: Mike Snitzer <msnitzer@fedoraproject.org>
Cc: okozina@fedoraproject.org, yum-devel@lists.baseurl.org,
	linux-lvm@redhat.com
Subject: Re: [linux-lvm] [PATCH 4/2] fs snapshot plugin: add LVM tag to allow tools to link pre and post snapshots
Date: Tue, 12 Mar 2013 12:41:00 -0400	[thread overview]
Message-ID: <1363106460.24725.236.camel@code.and.org> (raw)
In-Reply-To: <20130312144129.GA13459@redhat.com>

On Tue, 2013-03-12 at 10:41 -0400, Mike Snitzer wrote:
> On Tue, Mar 12 2013 at  9:46am -0400,
> James Antill <james@fedoraproject.org> wrote:
> 
> > 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.
> 
> I couldn't figure out how to store anything in pretrans_hook() and
> retrieve it in posttrans_hook().  Use of a global caused the plugin to
> fail silently.

 Using globals should work, the only real problem is if some python API
creates multiple YumBase() instances (but although we've worried about
that, nothing has ever really done it AFAIK).
 The common way is to just stuff something unique in the yum base object
(base.__plugin_fssnap_whatever = blah).

[...]

> I like the idea of using the actual future rpmDB version; but as you
> note it won't be unique on its own if you undo a transaction.  SO this
> is the incremental change I came up with.  I'll post v2 of the 4/2 patch
> with these chnages folded in:
[...] 
> -def yum_fs_snapshot_trans_id(ts):
> +def yum_fs_snapshot_trans_id(conduit):
>      # return pseudo yum transaction id string
>      # this string is identical for both {pre,post}trans_hook
> -    yum_ts_hash = "%d" % abs(hash(ts.ts))
> -    return "yum_fs_snapshot_" + yum_ts_hash[:16]
> +    tsInfo = conduit.getTsInfo()
> +    # using hash of tsInfo purely to get unique number that isn't tied to rpmDB
> +    tsInfo_hash = "%d" % (abs(hash(tsInfo)))
> +    frpmdbv = tsInfo.futureRpmDBVersion()
> +    return "yum_fs_snapshot_%s_%s" % (tsInfo_hash[:8], frpmdbv)

 I still worry about how unique "abs(hash(ts.ts))" will be over multiple
runs ... is the reason for not using a timestamp just that you don't
know where to store it?

  reply	other threads:[~2013-03-12 16:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 16:18 [linux-lvm] [PATCH 0/2] yum-utils fs snapshot plugin: fix old LVM snapshots and add thinp support Mike Snitzer
2013-03-10 16:18 ` [linux-lvm] [PATCH 1/2] fs snapshot plugin: fix inspect_volume_lvm to use supported dmsetup splitname options Mike Snitzer
2013-03-10 16:18 ` [linux-lvm] [PATCH 2/2] fs snapshot plugin: add support for snapshotting thinly provisioned LVM volumes Mike Snitzer
2013-03-11 21:25 ` [linux-lvm] [PATCH 3/2] fs snapshot plugin: add ability to create snapshots during post transaction Mike Snitzer
2013-03-11 21:25   ` [linux-lvm] [PATCH 4/2] fs snapshot plugin: add LVM tag to allow tools to link pre and post snapshots Mike Snitzer
2013-03-12 13:46     ` [linux-lvm] [Yum-devel] " James Antill
2013-03-12 14:41       ` [linux-lvm] " Mike Snitzer
2013-03-12 16:41         ` James Antill [this message]
2013-03-12 18:09           ` Mike Snitzer
2013-03-12 19:52             ` [linux-lvm] [Yum-devel] " James Antill
2013-03-12 20:30               ` [linux-lvm] " Mike Snitzer
2013-03-12 15:00     ` [linux-lvm] [PATCH 4/2 v2] " Mike Snitzer
2013-03-12 18:16     ` [linux-lvm] [PATCH 4/2 v3] " Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363106460.24725.236.camel@code.and.org \
    --to=james@fedoraproject.org \
    --cc=linux-lvm@redhat.com \
    --cc=msnitzer@fedoraproject.org \
    --cc=okozina@fedoraproject.org \
    --cc=yum-devel@lists.baseurl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).