LUCreateInstance: implement disk adoption mode
authorIustin Pop <iustin@google.com>
Sun, 14 Mar 2010 00:55:17 +0000 (01:55 +0100)
committerIustin Pop <iustin@google.com>
Mon, 15 Mar 2010 15:17:00 +0000 (16:17 +0100)
commitc3589cf86c813fc85d82287c0e1cdd033d3641d5
tree98a35a78ab024106106ee9f60a68b9593d6c37ca
parentdf4272e57c2ad395f69bb66dc73965c0d1c6d811
LUCreateInstance: implement disk adoption mode

This new mode, valid only for the plain template disk, allows creation
of an instance based on existing logical volumes (preserving data),
rather than creation of new volumes and OS creation.

The new mode works as follows:

- instead of size, all disks passed in must have an 'adopt' key, which
  signifies the LV name to be used
- all disks must have this key, or neither should
- we check the volume existence, and from the result we fill in the
  actual size
- online (in-use) volumes are not allowed
- 'stealing' of another's instance volumes is prevented via reservation
  of the LV names
- during creation, we rename the logical volumes to the standard Ganeti
  format (based on UUID)

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
lib/cmdlib.py