Merge lp:~bgeron/apt-btrfs-snapshot/fix-update-fail into lp:apt-btrfs-snapshot

Proposed by Bram Geron
Status: Merged
Merged at revision: 51
Proposed branch: lp:~bgeron/apt-btrfs-snapshot/fix-update-fail
Merge into: lp:apt-btrfs-snapshot
Diff against target: 36 lines (+14/-5)
1 file modified
apt_btrfs_snapshot.py (+14/-5)
To merge this branch: bzr merge lp:~bgeron/apt-btrfs-snapshot/fix-update-fail
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Review via email: mp+265996@code.launchpad.net

Description of the change

Fixes #853849 (apt failing when the three snapshots are made in a single second), by skipping "duplicate" snapshots in a single second.

(I made a merge proposal earlier, but it was in the wrong direction.)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'apt_btrfs_snapshot.py'
--- apt_btrfs_snapshot.py 2013-01-06 02:45:03 +0000
+++ apt_btrfs_snapshot.py 2015-07-27 16:03:24 +0000
@@ -25,6 +25,9 @@
25import time25import time
26import tempfile26import tempfile
2727
28import gettext
29from gettext import gettext as _
30
2831
29class AptBtrfsSnapshotError(Exception):32class AptBtrfsSnapshotError(Exception):
30 pass33 pass
@@ -163,11 +166,17 @@
163 def create_btrfs_root_snapshot(self, additional_prefix=""):166 def create_btrfs_root_snapshot(self, additional_prefix=""):
164 mp = self.mount_btrfs_root_volume()167 mp = self.mount_btrfs_root_volume()
165 snap_id = self._get_now_str()168 snap_id = self._get_now_str()
166 res = self.commands.btrfs_subvolume_snapshot(169 source = os.path.join(mp, "@")
167 os.path.join(mp, "@"),170 target = os.path.join(mp, self.SNAP_PREFIX + additional_prefix + snap_id)
168 os.path.join(mp, self.SNAP_PREFIX + additional_prefix + snap_id))171
169 self.umount_btrfs_root_volume()172 if os.path.exists(target):
170 return res173 print(_("INFO: snapshot directory '%s' already exists, not creating duplicate")
174 % (target,))
175 return True
176 else:
177 res = self.commands.btrfs_subvolume_snapshot(source, target)
178 self.umount_btrfs_root_volume()
179 return res
171180
172 def get_btrfs_root_snapshots_list(self, older_than=0):181 def get_btrfs_root_snapshots_list(self, older_than=0):
173 """ get the list of available snapshot182 """ get the list of available snapshot

Subscribers

People subscribed via source and target branches

to all changes: