Ganeti network utility module.
This module holds functions that can be used in both daemons (all) and the command line scripts.
| Class | |
Class implementing resolver and hostname functionality. |
| Class | |
IPv4 address class. |
| Class | |
IPv6 address class. |
| Class | |
Class that represents an IP address. |
| Function | |
Format a socket address |
| Function | |
Get the daemon port for this cluster. |
| Function | |
Returns a Hostname object. |
| Function | |
Returns the IP addresses associated to the interface. |
| Function | |
Returns the credentials of the foreign process connected to a socket. |
| Function | |
Validate an interface name. |
| Function | |
Simple ping implementation using TCP connect(2). |
| Function | |
Returns the validated integer port number if it is valid. |
| Function | _ |
Parses the output of the ip command and retrieves the IP addresses and version. |
| Constant | _IP |
Undocumented |
| Constant | _IP |
Undocumented |
| Constant | _NAME |
Undocumented |
| Constant | _STRUCT |
Undocumented |
| Constant | _STRUCT |
Undocumented |
Format a socket address
| Parameters | |
| address:family specific (usually tuple) | address, as reported by this class |
| family:integer | socket family (one of socket.AF_*) or None |
Get the daemon port for this cluster.
Note that this routine does not read a ganeti-specific file, but instead uses socket.getservbyname to allow pre-customization of this parameter outside of Ganeti.
| Parameters | |
| daemon | daemon name (in constants.DAEMONS_PORTS) |
| Returns | |
| int | Undocumented |
Returns a Hostname object.
| Parameters | |
| name:str | hostname or None |
| family:int | AF_INET | AF_INET6 | None |
| Returns | |
Hostname | Hostname object |
| Raises | |
errors.OpPrereqError | in case of errors in resolving |
Returns the IP addresses associated to the interface.
| Parameters | |
| ifname:string | Name of the network interface |
| Returns | |
A dict having for keys the IP version (either constants.IP4_VERSION or constants.IP6_VERSION) and for values the lists of IP addresses of the respective version associated to the interface | |
Returns the credentials of the foreign process connected to a socket.
| Parameters | |
| sock | Unix socket |
| Returns | |
| tuple; (number, number, number) | The PID, UID and GID of the connected foreign process. |
Validate an interface name.
| Parameters | |
| ifname:string | Name of the network interface |
| Returns | |
| boolean indicating whether the interface name is valid or not. | |
Simple ping implementation using TCP connect(2).
Check if the given IP is reachable by doing attempting a TCP connect to it.
| Parameters | |
| target:str | the IP to ping |
| port:int | the port to connect to |
| timeout:int | the timeout on the connection attempt |
| live | whether a closed port will cause the function to return failure, as if there was a timeout |
| source:str or None | if specified, will cause the connect to be made from this specific source address; failures to bind other than EADDRNOTAVAIL will be ignored |
Returns the validated integer port number if it is valid.
| Parameters | |
| port | the port number to be validated |
| Returns | |
| int | the validated value. |
| Raises | |
ValueError | if the port is not valid |
Parses the output of the ip command and retrieves the IP addresses and version.
| Parameters | |
| ip | string containing the output of the ip command; |
| Returns | |
| dict; (int, list) | a dict having as keys the IP versions and as values the corresponding list of addresses found in the IP output. |
Undocumented
| Value |
|
Undocumented
| Value |
|