Revision b1206984
b/lib/backend.py | ||
---|---|---|
416 | 416 |
def BridgesExist(bridges_list): |
417 | 417 |
"""Check if a list of bridges exist on the current node. |
418 | 418 |
|
419 |
Returns:
|
|
420 |
True if all of them exist, false otherwise
|
|
419 |
@rtype: boolean
|
|
420 |
@return: C{True} if all of them exist, C{False} otherwise
|
|
421 | 421 |
|
422 | 422 |
""" |
423 | 423 |
for bridge in bridges_list: |
... | ... | |
549 | 549 |
def RunRenameInstance(instance, old_name): |
550 | 550 |
"""Run the OS rename script for an instance. |
551 | 551 |
|
552 |
@type instance: objects.Instance
|
|
552 |
@type instance: L{objects.Instance}
|
|
553 | 553 |
@param instance: Instance whose OS is to be installed |
554 | 554 |
@type old_name: string |
555 | 555 |
@param old_name: previous instance name |
... | ... | |
751 | 751 |
def MigrateInstance(instance, target, live): |
752 | 752 |
"""Migrates an instance to another node. |
753 | 753 |
|
754 |
@type instance: C{objects.Instance}
|
|
754 |
@type instance: L{objects.Instance}
|
|
755 | 755 |
@param instance: the instance definition |
756 | 756 |
@type target: string |
757 | 757 |
@param target: the target node name |
... | ... | |
778 | 778 |
def CreateBlockDevice(disk, size, owner, on_primary, info): |
779 | 779 |
"""Creates a block device for an instance. |
780 | 780 |
|
781 |
Args: |
|
782 |
disk: a ganeti.objects.Disk object |
|
783 |
size: the size of the physical underlying device |
|
784 |
owner: a string with the name of the instance |
|
785 |
on_primary: a boolean indicating if it is the primary node or not |
|
786 |
info: string that will be sent to the physical device creation |
|
787 |
|
|
788 |
Returns: |
|
789 |
the new unique_id of the device (this can sometime be |
|
790 |
computed only after creation), or None. On secondary nodes, |
|
791 |
it's not required to return anything. |
|
781 |
@type disk: L{objects.Disk} |
|
782 |
@param disk: the object describing the disk we should create |
|
783 |
@type size: int |
|
784 |
@param size: the size of the physical underlying device, in MiB |
|
785 |
@type owner: str |
|
786 |
@param owner: the name of the instance for which disk is created, |
|
787 |
used for device cache data |
|
788 |
@type on_primary: boolean |
|
789 |
@param on_primary: indicates if it is the primary node or not |
|
790 |
@type info: string |
|
791 |
@param info: string that will be sent to the physical device |
|
792 |
creation, used for example to set (LVM) tags on LVs |
|
793 |
|
|
794 |
@return: the new unique_id of the device (this can sometime be |
|
795 |
computed only after creation), or None. On secondary nodes, |
|
796 |
it's not required to return anything. |
|
792 | 797 |
|
793 | 798 |
""" |
794 | 799 |
clist = [] |
... | ... | |
911 | 916 |
|
912 | 917 |
This is a wrapper over _RecursiveAssembleBD. |
913 | 918 |
|
914 |
Returns:
|
|
915 |
a /dev path for primary nodes
|
|
916 |
True for secondary nodes
|
|
919 |
@rtype: str or boolean
|
|
920 |
@return: a C{/dev/...} path for primary nodes, and
|
|
921 |
C{True} for secondary nodes
|
|
917 | 922 |
|
918 | 923 |
""" |
919 | 924 |
result = _RecursiveAssembleBD(disk, owner, as_primary) |
... | ... | |
1487 | 1492 |
def ImportOSIntoInstance(instance, src_node, src_images, cluster_name): |
1488 | 1493 |
"""Import an os image into an instance. |
1489 | 1494 |
|
1490 |
@type instance: L{objects.instance}
|
|
1495 |
@type instance: L{objects.Instance}
|
|
1491 | 1496 |
@param instance: instance to import the disks into |
1492 | 1497 |
@type src_node: string |
1493 | 1498 |
@param src_node: source node for the disk images |
... | ... | |
1600 | 1605 |
default file_storage_dir stored in SimpleStore. Only paths under that |
1601 | 1606 |
directory are allowed. |
1602 | 1607 |
|
1603 |
Args:
|
|
1604 |
file_storage_dir: string with path
|
|
1608 |
@type file_storage_dir: str
|
|
1609 |
@param file_storage_dir: the path to check
|
|
1605 | 1610 |
|
1606 |
Returns: |
|
1607 |
normalized file_storage_dir (string) if valid, None otherwise |
|
1611 |
@return: the normalized path if valid, None otherwise |
|
1608 | 1612 |
|
1609 | 1613 |
""" |
1610 | 1614 |
cfg = _GetConfig() |
... | ... | |
1622 | 1626 |
def CreateFileStorageDir(file_storage_dir): |
1623 | 1627 |
"""Create file storage directory. |
1624 | 1628 |
|
1625 |
Args:
|
|
1626 |
file_storage_dir: string containing the path
|
|
1629 |
@type file_storage_dir: str
|
|
1630 |
@param file_storage_dir: directory to create
|
|
1627 | 1631 |
|
1628 |
Returns:
|
|
1629 |
tuple with first element a boolean indicating wheter dir
|
|
1630 |
creation was successful or not |
|
1632 |
@rtype: tuple
|
|
1633 |
@return: tuple with first element a boolean indicating wheter dir
|
|
1634 |
creation was successful or not
|
|
1631 | 1635 |
|
1632 | 1636 |
""" |
1633 | 1637 |
file_storage_dir = _TransformFileStorageDir(file_storage_dir) |
Also available in: Unified diff