olopez32 / ganeti

Automatically exported from code.google.com/p/ganeti
0 stars 0 forks source link

Reduce LVM space taken by export snapshot #859

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
[ganeti 2.10.4, wheezy-backports]

ganeti-backup export takes an LVM snapshot of the VM to be exported. At the 
moment it takes a worst-case view and allocates 100% of the original LVM size 
for the snapshot. In cases where a cluster is near to full, and/or exporting a 
large LV, this can cause out-of-space errors.

The size of the snapshot only has to be enough to store any modifications made 
to the LV while the snapshot is active.

Ideas:

1. For a shutdown instance, don't create any snapshot at all, or create a tiny 
snapshot (e.g. 1%)

2. For a running instance, have a tunable for the snapshot size. It could 
default to say 10%.

3. For a running instance, choose min(desired_space, available_space) for the 
snapshot size, rather than choosing desired_space and then failing if it is 
less than available_space

4. It's also possible to poll the snapshot space used during the export and 
extend it if necessary:
http://dustymabe.com/2012/03/04/automatically-extend-lvm-snapshots/
but I doubt that's worth the effort.

Presumably if the snapshot fills during the export in case (2) or (3), there 
will be some error (EIO?) - this is worth testing, to ensure that the export 
aborts gracefully.

Discussion:
https://groups.google.com/forum/#!topic/ganeti/cu68vZmWZko

Relevant code:

[lib/backend.py]
    if r_dev is not None:
      # FIXME: choose a saner value for the snapshot size
      # let's stay on the safe side and ask for the full size, for now
      return r_dev.Snapshot(disk.size)

[lib/storage/bdev.py]
  def Snapshot(self, size):
...
    if free_size < size:
      base.ThrowError("Not enough free space: required %s,"
                      " available %s", size, free_size)

Original issue reported on code.google.com by bcandler...@googlemail.com on 17 Jun 2014 at 8:31

GoogleCodeExporter commented 9 years ago

Original comment by aeh...@google.com on 18 Jun 2014 at 8:04

GoogleCodeExporter commented 9 years ago
This is closely related to issue #264 (the part which asks for percentage of 
space for snapshots)

Original comment by bcandler...@googlemail.com on 6 Oct 2014 at 8:43

GoogleCodeExporter commented 9 years ago
1. done in 2.14

For other ideas, patches welcome.

Original comment by pud...@google.com on 17 Jun 2015 at 1:40