freezer_dr.common package¶
Submodules¶
freezer_dr.common.config module¶
Manage all configuration the OpenStack way.
freezer_dr.common.daemon module¶
Generic deamon.
-
class
freezer_dr.common.daemon.
Daemon
(pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null')[source]¶ Bases:
object
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
-
daemonize
()[source]¶ Do the UNIX double-fork magic.
See Stevens’ “Advanced Programming in the UNIX Environment” for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
-
freezer_dr.common.osclient module¶
OpenStack client class.
-
class
freezer_dr.common.osclient.
OSClient
(authurl, authmethod='password', **kwargs)[source]¶ Bases:
object
Provide OpenStack credentials to initalize the connection.
-
evacuate
(nodes, shared_storage=False)[source]¶ Will get the hypervisors and list all running VMs on it and then start Evacuating one by one … :param nodes: List of nodes to be evacuated ! :param shared_storage: Boolean, True if your compute nodes are running under shared storage and False otherwise :return: List of nodes with VMs that were running on that node
-
get_hypervisor
(node)[source]¶ Get an instance of the hypervisor.
- Parameters
node – dict contains host index
- Returns
Hypervisor
-
freezer_dr.common.utils module¶
Utility functions shared from all modules into the project.
-
freezer_dr.common.utils.
get_admin_os_client
()[source]¶ Return admin client data.
Loads credentials from [keystone_authtoken] section in the configuration file and initialize the client with admin privileges and return an instance of the client :return: Initialized instance of OS Client
-
freezer_dr.common.utils.
get_os_client
()[source]¶ Return the OpenStack client.
Loads credentials from [keystone_authtoken] section in the configuration file and initialize the client and return an instance of the client :return: Initialized instance of OS Client
-
freezer_dr.common.utils.
load_jinja_templates
(template_dir, template_name, template_vars)[source]¶ Load and render existing Jinja2 templates.
The main purpose of the function is to prepare the message to be sent and render it for the driver to send it directly.
- Parameters
template_dir – Location where jinja2 templates are stored
template_name – name of the template to load it
template_vars – Dict to replace existing vars in the template with values.
- Returns
String message
freezer_dr.common.yaml_parser module¶
-
class
freezer_dr.common.yaml_parser.
YamlParser
(yml_file, index='servers')[source]¶ Bases:
object
-
find_server
(key, value)[source]¶ Generic function to query the .yml file to get server information by any key. :param key: :param value: :return:
-
find_server_by_hostname
(hostname)[source]¶ get server information ilo username, password and ip :param hostname: hostname matches one of the ones in the .yml file :return: dict contains the server information
-