Revision 97e3cece
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) |
b/lib/masterd/instance.py | ||
---|---|---|
1182 | 1182 |
|
1183 | 1183 |
# result.payload will be a snapshot of an lvm leaf of the one we |
1184 | 1184 |
# passed |
1185 |
result = self._lu.rpc.call_blockdev_snapshot(src_node, (disk, instance)) |
|
1185 |
result = self._lu.rpc.call_blockdev_snapshot(src_node, |
|
1186 |
(disk, instance), |
|
1187 |
None, None) |
|
1186 | 1188 |
new_dev = False |
1187 | 1189 |
msg = result.fail_msg |
1188 | 1190 |
if msg: |
b/lib/rpc_defs.py | ||
---|---|---|
446 | 446 |
], None, None, "Export a given disk to another node"), |
447 | 447 |
("blockdev_snapshot", SINGLE, None, constants.RPC_TMO_NORMAL, [ |
448 | 448 |
("cf_bdev", ED_SINGLE_DISK_DICT_DP, None), |
449 |
("snap_name", None, None), |
|
450 |
("snap_size", None, None), |
|
449 | 451 |
], None, None, "Export a given disk to another node"), |
450 | 452 |
("blockdev_rename", SINGLE, None, constants.RPC_TMO_NORMAL, [ |
451 | 453 |
("devlist", ED_BLOCKDEV_RENAME, None), |
b/lib/server/noded.py | ||
---|---|---|
358 | 358 |
def perspective_blockdev_snapshot(params): |
359 | 359 |
"""Create a snapshot device. |
360 | 360 |
|
361 |
Note that this is only valid for LVM disks, if we get passed |
|
361 |
Note that this is only valid for LVM and ExtStorage disks, if we get passed
|
|
362 | 362 |
something else we raise an exception. The snapshot device can be |
363 | 363 |
remove by calling the generic block device remove call. |
364 | 364 |
|
365 | 365 |
""" |
366 |
cfbd = objects.Disk.FromDict(params[0]) |
|
367 |
return backend.BlockdevSnapshot(cfbd) |
|
366 |
(disk, snap_name, snap_size) = params |
|
367 |
cfbd = objects.Disk.FromDict(disk) |
|
368 |
return backend.BlockdevSnapshot(cfbd, snap_name, snap_size) |
|
368 | 369 |
|
369 | 370 |
@staticmethod |
370 | 371 |
def perspective_blockdev_grow(params): |
Also available in: Unified diff