From: Mike Snitzer <msnitzer@fedoraproject.org>
To: yum-devel@lists.baseurl.org
Cc: okozina@fedoraproject.org, James Antill <james@fedoraproject.org>,
linux-lvm@redhat.com
Subject: [linux-lvm] [PATCH 3/2] fs snapshot plugin: add ability to create snapshots during post transaction
Date: Mon, 11 Mar 2013 17:25:49 -0400 [thread overview]
Message-ID: <1363037150-8757-1-git-send-email-msnitzer@fedoraproject.org> (raw)
In-Reply-To: <1362932290-28679-1-git-send-email-msnitzer@fedoraproject.org>
It can be useful to create a post transaction snapshot to allow tools
(e.g. snapper) to analyze the differences introduced by the yum
transaction.
Add 'create_snapshots_in_post' to main section of fs-snapshot.conf.
Signed-off-by: Mike Snitzer <msnitzer@fedoraproject.org>
---
docs/yum-fs-snapshot.conf.5 | 4 ++++
plugins/fs-snapshot/fs-snapshot.conf | 1 +
plugins/fs-snapshot/fs-snapshot.py | 10 +++++++++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/docs/yum-fs-snapshot.conf.5 b/docs/yum-fs-snapshot.conf.5
index dc5c0c1..4ac623a 100644
--- a/docs/yum-fs-snapshot.conf.5
+++ b/docs/yum-fs-snapshot.conf.5
@@ -20,6 +20,10 @@ utilizes configuration options in the form of
.IP exclude
This is a space delimited list of the mount points you do not wish to have
snapshotted by this plugin.
+.SH OPTION
+.IP create_snapshots_in_post
+This is a boolean value used to control whether snapshots are also created
+after running the yum transaction.
.SH OPTION - [lvm] section
.IP enabled
This is a boolean value used to control whether LVM snapshots will be
diff --git a/plugins/fs-snapshot/fs-snapshot.conf b/plugins/fs-snapshot/fs-snapshot.conf
index 3a67c69..9ada717 100644
--- a/plugins/fs-snapshot/fs-snapshot.conf
+++ b/plugins/fs-snapshot/fs-snapshot.conf
@@ -1,5 +1,6 @@
[main]
enabled = 1
+create_snapshots_in_post = 0
[lvm]
enabled = 0
diff --git a/plugins/fs-snapshot/fs-snapshot.py b/plugins/fs-snapshot/fs-snapshot.py
index 7483c2d..32a1f17 100644
--- a/plugins/fs-snapshot/fs-snapshot.py
+++ b/plugins/fs-snapshot/fs-snapshot.py
@@ -287,7 +287,7 @@ def _create_lvm_snapshot(conduit, snapshot_tag, volume):
return 1
return 2
-def pretrans_hook(conduit):
+def create_snapshots(conduit):
"""
This runs before the transaction starts. Try to snapshot anything and
everything that is snapshottable, since we do not know what an RPM will
@@ -304,3 +304,11 @@ def pretrans_hook(conduit):
elif rc == 2 and hasattr(conduit, 'registerPackageName'):
# A snapshot was successfully created
conduit.registerPackageName("yum-plugin-fs-snapshot")
+
+def pretrans_hook(conduit):
+ create_snapshots(conduit)
+
+def posttrans_hook(conduit):
+ create_snapshots_in_post = conduit.confBool('main', 'create_snapshots_in_post', default=0)
+ if create_snapshots_in_post:
+ create_snapshots(conduit)
--
1.8.1
next prev parent reply other threads:[~2013-03-11 21:25 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 ` Mike Snitzer [this message]
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
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=1363037150-8757-1-git-send-email-msnitzer@fedoraproject.org \
--to=msnitzer@fedoraproject.org \
--cc=james@fedoraproject.org \
--cc=linux-lvm@redhat.com \
--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).