Revision 97e3cece lib/backend.py
b/lib/backend.py | ||
---|---|---|
3055 | 3055 |
_Fail("Failed to grow block device: %s", err, exc=True) |
3056 | 3056 |
|
3057 | 3057 |
|
3058 |
def BlockdevSnapshot(disk): |
|
3058 |
def BlockdevSnapshot(disk, snap_name, snap_size):
|
|
3059 | 3059 |
"""Create a snapshot copy of a block device. |
3060 | 3060 |
|
3061 | 3061 |
This function is called recursively, and the snapshot is actually created |
... | ... | |
3063 | 3063 |
|
3064 | 3064 |
@type disk: L{objects.Disk} |
3065 | 3065 |
@param disk: the disk to be snapshotted |
3066 |
@type snap_name: string |
|
3067 |
@param snap_name: the name of the snapshot |
|
3068 |
@type snap_size: int |
|
3069 |
@param snap_size: the size of the snapshot |
|
3066 | 3070 |
@rtype: string |
3067 | 3071 |
@return: snapshot disk ID as (vg, lv) |
3068 | 3072 |
|
... | ... | |
3078 | 3082 |
if not disk.children: |
3079 | 3083 |
_Fail("DRBD device '%s' without backing storage cannot be snapshotted", |
3080 | 3084 |
disk.unique_id) |
3081 |
return BlockdevSnapshot(disk.children[0]) |
|
3085 |
return BlockdevSnapshot(disk.children[0], snap_name, snap_size)
|
|
3082 | 3086 |
elif disk.dev_type == constants.DT_PLAIN: |
3083 |
return _DiskSnapshot(disk) |
|
3087 |
return _DiskSnapshot(disk, snap_name, snap_size)
|
|
3084 | 3088 |
elif disk.dev_type == constants.DT_EXT: |
3085 |
return _DiskSnapshot(disk) |
|
3089 |
return _DiskSnapshot(disk, snap_name, snap_size)
|
|
3086 | 3090 |
else: |
3087 | 3091 |
_Fail("Cannot snapshot block device '%s' of type '%s'", |
3088 | 3092 |
disk.logical_id, disk.dev_type) |
Also available in: Unified diff