ganeti¶
Ganeti module.
-
class
spicerack.ganeti.
Ganeti
(username: str, password: str, timeout: int)[source]¶ Bases:
object
Class which wraps all Ganeti clusters.
Initialize the instance.
- Parameters
-
rapi
(cluster: str) → spicerack.ganeti.GanetiRAPI[source]¶ Return a RAPI object for a particular cluster.
- Parameters
cluster (str) -- the name of the cluster to get a RAPI for.
- Returns
the RAPI interface object
- Return type
- Raises
spicerack.ganeti.GanetiError -- on an invalid cluster name
-
exception
spicerack.ganeti.
GanetiError
[source]¶ Bases:
spicerack.exceptions.SpicerackError
Raised on errors from Ganeti operations.
-
class
spicerack.ganeti.
GanetiRAPI
(cluster_url: str, username: str, password: str, timeout: int, ca_path: str)[source]¶ Bases:
object
Class which wraps the read-only Ganeti RAPI.
Initialize the instance.
- Parameters
-
fetch_instance
(fqdn: str) → Dict[source]¶ Return full information about an instance.
- Parameters
fqdn -- the FQDN of the instance in question
- Returns
host information
- Return type
- Raises
spicerack.ganeti.GanetiError -- API errors
-
fetch_instance_mac
(fqdn: str) → str[source]¶ Convenience method to return the 0th adapter's MAC address for an instance.
Note that we don't allow the creation of instances with more than one MAC address at this time.
- Parameters
fqdn -- the FQDN of the instance in question
- Returns
MAC address
- Return type
- Raises
GanetiError -- API errors
-
property
info
¶ Return complete cluster information.
- Returns
Cluster information dictionary
- Return type
- Raises
spicerack.ganeti.GanetiError -- API errors
-
property
master
¶ Return the internal name for the current ganeti master node.
- Returns
The hostname of the master node (or None if the data is missing).
- Return type
- Raises
spicerack.ganeti.GanetiError -- API errors