Revision 48e175a2
b/lib/backend.py | ||
---|---|---|
2517 | 2517 |
disk.unique_id, disk.dev_type) |
2518 | 2518 |
|
2519 | 2519 |
|
2520 |
def BlockdevSetInfo(disk, info): |
|
2521 |
"""Sets 'metadata' information on block devices. |
|
2522 |
|
|
2523 |
This function sets 'info' metadata on block devices. Initial |
|
2524 |
information is set at device creation; this function should be used |
|
2525 |
for example after renames. |
|
2526 |
|
|
2527 |
@type disk: L{objects.Disk} |
|
2528 |
@param disk: the disk to be grown |
|
2529 |
@type info: string |
|
2530 |
@param info: new 'info' metadata |
|
2531 |
@rtype: (status, result) |
|
2532 |
@return: a tuple with the status of the operation (True/False), and |
|
2533 |
the errors message if status is False |
|
2534 |
|
|
2535 |
""" |
|
2536 |
r_dev = _RecursiveFindBD(disk) |
|
2537 |
if r_dev is None: |
|
2538 |
_Fail("Cannot find block device %s", disk) |
|
2539 |
|
|
2540 |
try: |
|
2541 |
r_dev.SetInfo(info) |
|
2542 |
except errors.BlockDeviceError, err: |
|
2543 |
_Fail("Failed to set information on block device: %s", err, exc=True) |
|
2544 |
|
|
2545 |
|
|
2520 | 2546 |
def FinalizeExport(instance, snap_disks): |
2521 | 2547 |
"""Write out the export configuration information. |
2522 | 2548 |
|
b/lib/cmdlib.py | ||
---|---|---|
7480 | 7480 |
new_file_storage_dir)) |
7481 | 7481 |
|
7482 | 7482 |
_StartInstanceDisks(self, inst, None) |
7483 |
# update info on disks |
|
7484 |
info = _GetInstanceInfoText(inst) |
|
7485 |
for (idx, disk) in enumerate(inst.disks): |
|
7486 |
for node in inst.all_nodes: |
|
7487 |
self.cfg.SetDiskID(disk, node) |
|
7488 |
result = self.rpc.call_blockdev_setinfo(node, disk, info) |
|
7489 |
if result.fail_msg: |
|
7490 |
self.LogWarning("Error setting info on node %s for disk %s: %s", |
|
7491 |
node, idx, result.fail_msg) |
|
7483 | 7492 |
try: |
7484 | 7493 |
result = self.rpc.call_instance_run_rename(inst.primary_node, inst, |
7485 | 7494 |
old_name, self.op.debug_level) |
b/lib/rpc_defs.py | ||
---|---|---|
418 | 418 |
], _BlockdevGetMirrorStatusMultiPreProc, |
419 | 419 |
_BlockdevGetMirrorStatusMultiPostProc, |
420 | 420 |
"Request status of (mirroring) devices from multiple nodes"), |
421 |
("blockdev_setinfo", SINGLE, None, constants.RPC_TMO_NORMAL, [ |
|
422 |
("disk", ED_OBJECT_DICT, None), |
|
423 |
("info", None, None), |
|
424 |
], None, None, "Sets metadata information on a given block device"), |
|
421 | 425 |
] |
422 | 426 |
|
423 | 427 |
_OS_CALLS = [ |
b/lib/server/noded.py | ||
---|---|---|
367 | 367 |
dest_node, dest_path, cluster_name = params[1:] |
368 | 368 |
return backend.BlockdevExport(disk, dest_node, dest_path, cluster_name) |
369 | 369 |
|
370 |
@staticmethod |
|
371 |
def perspective_blockdev_setinfo(params): |
|
372 |
"""Sets metadata information on the given block device. |
|
373 |
|
|
374 |
""" |
|
375 |
(disk, info) = params |
|
376 |
disk = objects.Disk.FromDict(disk) |
|
377 |
return backend.BlockdevSetInfo(disk, info) |
|
378 |
|
|
370 | 379 |
# blockdev/drbd specific methods ---------- |
371 | 380 |
|
372 | 381 |
@staticmethod |
Also available in: Unified diff