Revision 8e70b181 lib/backend.py
b/lib/backend.py | ||
---|---|---|
1511 | 1511 |
@param name: the OS name we should look for |
1512 | 1512 |
@type os_dir: str |
1513 | 1513 |
@param os_dir: the directory inwhich we should look for the OS |
1514 |
@rtype: int or None |
|
1515 |
@return: |
|
1516 |
Either an integer denoting the version or None in the |
|
1517 |
case when this is not a valid OS name. |
|
1518 |
@raise errors.InvalidOS: if the OS cannot be found |
|
1514 |
@rtype: tuple |
|
1515 |
@return: tuple (status, data) with status denoting the validity and |
|
1516 |
data holding either the vaid versions or an error message |
|
1519 | 1517 |
|
1520 | 1518 |
""" |
1521 | 1519 |
api_file = os.path.sep.join([os_dir, "ganeti_api_version"]) |
... | ... | |
1593 | 1591 |
"""Create an OS instance from disk. |
1594 | 1592 |
|
1595 | 1593 |
This function will return an OS instance if the given name is a |
1596 |
valid OS name. Otherwise, it will raise an appropriate |
|
1597 |
L{errors.InvalidOS} exception, detailing why this is not a valid OS. |
|
1594 |
valid OS name. |
|
1598 | 1595 |
|
1599 | 1596 |
@type base_dir: string |
1600 | 1597 |
@keyword base_dir: Base directory containing OS installations. |
... | ... | |
1640 | 1637 |
return False, ("Script '%s' under path '%s' is not a regular file" % |
1641 | 1638 |
(script, os_dir)) |
1642 | 1639 |
|
1643 |
os_obj = objects.OS(name=name, path=os_dir, status=constants.OS_VALID_STATUS,
|
|
1640 |
os_obj = objects.OS(name=name, path=os_dir, |
|
1644 | 1641 |
create_script=os_scripts[constants.OS_SCRIPT_CREATE], |
1645 | 1642 |
export_script=os_scripts[constants.OS_SCRIPT_EXPORT], |
1646 | 1643 |
import_script=os_scripts[constants.OS_SCRIPT_IMPORT], |
Also available in: Unified diff