Revision 9834e2bc lib/rpc.py
b/lib/rpc.py | ||
---|---|---|
1384 | 1384 |
""" |
1385 | 1385 |
return self._SingleNodeCall(node, "blockdev_snapshot", [cf_bdev.ToDict()]) |
1386 | 1386 |
|
1387 |
@_RpcTimeout(_TMO_NORMAL) |
|
1388 |
def call_finalize_export(self, node, instance, snap_disks): |
|
1389 |
"""Request the completion of an export operation. |
|
1390 |
|
|
1391 |
This writes the export config file, etc. |
|
1392 |
|
|
1393 |
This is a single-node call. |
|
1394 |
|
|
1395 |
""" |
|
1396 |
flat_disks = [] |
|
1397 |
for disk in snap_disks: |
|
1398 |
if isinstance(disk, bool): |
|
1399 |
flat_disks.append(disk) |
|
1400 |
else: |
|
1401 |
flat_disks.append(disk.ToDict()) |
|
1402 |
|
|
1403 |
return self._SingleNodeCall(node, "finalize_export", |
|
1404 |
[self._InstDict(instance), flat_disks]) |
|
1405 |
|
|
1406 |
@_RpcTimeout(_TMO_FAST) |
|
1407 |
def call_export_info(self, node, path): |
|
1408 |
"""Queries the export information in a given path. |
|
1409 |
|
|
1410 |
This is a single-node call. |
|
1411 |
|
|
1412 |
""" |
|
1413 |
return self._SingleNodeCall(node, "export_info", [path]) |
|
1414 |
|
|
1415 |
@_RpcTimeout(_TMO_FAST) |
|
1416 |
def call_export_list(self, node_list): |
|
1417 |
"""Gets the stored exports list. |
|
1418 |
|
|
1419 |
This is a multi-node call. |
|
1420 |
|
|
1421 |
""" |
|
1422 |
return self._MultiNodeCall(node_list, "export_list", []) |
|
1423 |
|
|
1424 |
@_RpcTimeout(_TMO_FAST) |
|
1425 |
def call_export_remove(self, node, export): |
|
1426 |
"""Requests removal of a given export. |
|
1427 |
|
|
1428 |
This is a single-node call. |
|
1429 |
|
|
1430 |
""" |
|
1431 |
return self._SingleNodeCall(node, "export_remove", [export]) |
|
1432 |
|
|
1433 | 1387 |
@classmethod |
1434 | 1388 |
@_RpcTimeout(_TMO_NORMAL) |
1435 | 1389 |
def call_node_leave_cluster(cls, node, modify_ssh_setup): |
... | ... | |
1628 | 1582 |
self._InstDict(instance), |
1629 | 1583 |
component, source, |
1630 | 1584 |
_EncodeImportExportIO(source, source_args)]) |
1631 |
|
|
1632 |
@_RpcTimeout(_TMO_FAST) |
|
1633 |
def call_impexp_status(self, node, names): |
|
1634 |
"""Gets the status of an import or export. |
|
1635 |
|
|
1636 |
This is a single-node call. |
|
1637 |
|
|
1638 |
@type node: string |
|
1639 |
@param node: Node name |
|
1640 |
@type names: List of strings |
|
1641 |
@param names: Import/export names |
|
1642 |
@rtype: List of L{objects.ImportExportStatus} instances |
|
1643 |
@return: Returns a list of the state of each named import/export or None if |
|
1644 |
a status couldn't be retrieved |
|
1645 |
|
|
1646 |
""" |
|
1647 |
result = self._SingleNodeCall(node, "impexp_status", [names]) |
|
1648 |
|
|
1649 |
if not result.fail_msg: |
|
1650 |
decoded = [] |
|
1651 |
|
|
1652 |
for i in result.payload: |
|
1653 |
if i is None: |
|
1654 |
decoded.append(None) |
|
1655 |
continue |
|
1656 |
decoded.append(objects.ImportExportStatus.FromDict(i)) |
|
1657 |
|
|
1658 |
result.payload = decoded |
|
1659 |
|
|
1660 |
return result |
|
1661 |
|
|
1662 |
@_RpcTimeout(_TMO_NORMAL) |
|
1663 |
def call_impexp_abort(self, node, name): |
|
1664 |
"""Aborts an import or export. |
|
1665 |
|
|
1666 |
This is a single-node call. |
|
1667 |
|
|
1668 |
@type node: string |
|
1669 |
@param node: Node name |
|
1670 |
@type name: string |
|
1671 |
@param name: Import/export name |
|
1672 |
|
|
1673 |
""" |
|
1674 |
return self._SingleNodeCall(node, "impexp_abort", [name]) |
|
1675 |
|
|
1676 |
@_RpcTimeout(_TMO_NORMAL) |
|
1677 |
def call_impexp_cleanup(self, node, name): |
|
1678 |
"""Cleans up after an import or export. |
|
1679 |
|
|
1680 |
This is a single-node call. |
|
1681 |
|
|
1682 |
@type node: string |
|
1683 |
@param node: Node name |
|
1684 |
@type name: string |
|
1685 |
@param name: Import/export name |
|
1686 |
|
|
1687 |
""" |
|
1688 |
return self._SingleNodeCall(node, "impexp_cleanup", [name]) |
Also available in: Unified diff