[pve-devel] [PATCH 5/5] DRBD: Implement snapshots.

Dietmar Maurer dietmar at proxmox.com
Thu Nov 12 11:49:12 CET 2015


Hi Philipp,

I just started to implement a PVE storage driver for lvmthin:

https://git.proxmox.com/?p=pve-storage.git;a=blob;f=PVE/Storage/LvmThinPlugin.pm

So far I just use:

sub volume_snapshot_rollback {
    my ($class, $scfg, $storeid, $volname, $snap) = @_;

    my $vg = $scfg->{vgname};
    my $snapvol = "snap_${volname}_$snap";

    my $cmd = ['/sbin/lvremove', '-f', "$vg/$volname"];
    run_command($cmd, errmsg => "lvremove '$vg/$volname' error");

    $cmd = ['/sbin/lvcreate', '-kn', '-n', $volname, '-s', "$vg/$snapvol"];
    run_command($cmd, errmsg => "lvm rollback '$vg/$snapvol' error");
}

While that works, it is not atomic.

Maybe you already found a better way to implement rollback within drbdmanage?

> > >  * There's no implementation for volume_snapshot_rollback() yet.
> > >    Is there a way to change the volume name on rollback?
> > >    The problem is that DRBDmanage (as of now) won't allow to _replace_
> > >    the current contents with the ones from the snapshot --
> > >    but perhaps we want to implement that at some time.
> > 
> > You just need to make sure your plugin return the correct path.
> 
> Well, the logic currently is that "activating" a snapshot creates another 
> COW volume (another thin LVM snapshot), and puts that one in a new 
> resource.
> 
> As the data in DRBDmanage is addressed by *resource name*, that means I'd 
> need to tell the ProxMox layer above that code that the *volume* name has 
> changed - which is not possible, I guess.
> 
> 
> So, I can see a few alternatives:
> 
> a) We change DRBDmanage to allow restoring into the "same" resource again



More information about the pve-devel mailing list