Bug 236168 - pvcreate should automatically make a backup of what it overwrites
pvcreate should automatically make a backup of what it overwrites
Status: CLOSED DUPLICATE of bug 174701
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: lvm2 (Show other bugs)
5.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Petr Rockai
Corey Marthaler
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-12 04:26 EDT by Milan Broz
Modified: 2013-02-28 23:05 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-06-18 10:16:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Milan Broz 2007-04-12 04:26:12 EDT
RHEL 5.1 clone - some code exists (see bug 174701),
nice to have this in RHEL5 too.

+++ This bug was initially created as a clone of Bug #174701 +++

LVM2 pvcreate should make an automatic backup of the part of
the device that it overwrites, so you can undo it.

(Could add as a generic option in the low-level write function, so other
commands could use it too.)

[split off from bugzilla 168330]

...

-- Additional comment from prockai@redhat.com on 2007-04-11 12:43 EST --
Created an attachment (id=152288)
lvm2-pvcreate-undo-prelim

Here comes a preliminary patch implementing basic pvcreate --undo
functionality. It has a few rough edges yet, like there is no configuration
option to disable pvcreate archive creation (easy to fix) and that
offset/length pairs are written out in host byte order (needs ntohll/htonll
which seem to be missing from libc? needs investigation).

The design is simplistic, it provides new device write primitives suffixed
_backup that take an extra file descriptor argument, which they use to write
out a copy of whatever they are going to overwrite, prepended with offset and
length of the block.

The restore function takes a file that contains several such blocks and writes
them over in their original positions, in reverse order from the file. This
allows for easy backup implementation, where a backup file is created and
opened for writing, its fd is passed to every device write operation and file
is closed. Then, restore takes the opened device and a filename of backup file.


Things like further metadata about the operation are left for higher layers, in
this case pvcreate. Current implementation just uses <archive_dir>/<uuid>.pv as
backup file and --undo on a PV looks for this file which when found is used for
restore. There is room for a more elaborate operation logfile, which may
reference the (simplistic) binary backup files. Any checksumming should be
probably done on that (operation logfile) level as well.

To make it possible for format_text to use the backup-enabled device
operations, i have added device_backup_fd to toolcontext. This may need
different addressing as well, although there is not much room for maneuvering
-- probably either way, all dev_write/dev_set calls that need backup
functionality will have to be modified in a way or other (either replace them
with versions that take toolcontext parameter, or the _backup versions).

I will followup with improved patches either tonight or tomorrow.
Comment 2 RHEL Product and Program Management 2007-10-16 00:02:27 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 7 RHEL Product and Program Management 2008-06-02 16:38:03 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 8 Petr Rockai 2008-07-02 06:03:02 EDT
From #174701:

> We have decided with Alasdair to rework this patch differently, for improved 
> maintainability and future-proofness. The feature is not critical in any way 
> and can be deferred for next update. I will followup with updates when the 
> work on this is resumed.

That means it might be done in 5.3 timeframe, or might not (although I'd hope 
for the former). Hotspare capabilities get priority over this.
Comment 9 RHEL Product and Program Management 2008-10-27 14:21:46 EDT
This request was previously evaluated by Red Hat Product Management
for inclusion in the current Red Hat Enterprise Linux release, but
Red Hat was unable to resolve it in time.  This request will be
reviewed for a future Red Hat Enterprise Linux release.

Note You need to log in before you can comment on or make changes to this bug.