Auto-generated documentation for ocs_ci.ocs.utils module.
- Ocs-ci / Modules / Ocs Ci / Ocs / Utils
- apply_oc_resource
- check_ceph_healthly
- cleanup_ceph_nodes
- collect_ocs_logs
- config_ntp
- create_ceph_conf
- create_ceph_nodes
- create_nodes
- create_oc_resource
- generate_repo_file
- get_ceph_versions
- get_iso_file_url
- get_openstack_driver
- get_pod_name_by_pattern
- get_public_network
- get_root_permissions
- hard_reboot
- keep_alive
- node_power_failure
- open_firewall_port
- run_must_gather
- search_ethernet_interface
- set_cdn_repo
- setup_cdn_repos
- setup_ceph_toolbox
- setup_deb_cdn_repo
- setup_deb_repos
- setup_repos
- setup_vm_node
- store_cluster_state
- update_ca_cert
- write_docker_daemon_json
def apply_oc_resource(
template_name,
cluster_path,
_templating,
template_data=None,
template_dir='ocs-deployment',
):
Apply an oc resource after rendering the specified template with the rook data from cluster_conf.
template_name
str - Name of the ocs-deployment config templatecluster_path
str - Path to cluster directory, where files will be written_templating
Templating - Object of Templating class used for templatingtemplate_data
dict - Data for render template (default: {})template_dir
str - Directory under templates dir where templateexists
(default - ocs-deployment)
def check_ceph_healthly(
ceph_mon,
num_osds,
num_mons,
mon_container=None,
timeout=300,
):
Function to check ceph is in healthy state
ceph_mon
- monitor nodenum_osds
- number of osds in clusternum_mons
- number of mons in clustermon_container
- monitor container name if monitor is placed in the containertimeout
- 300 seconds(default) max time to check if cluster is not healthy within timeout period return 1
return 0 when ceph is in healthy state, else 1
def cleanup_ceph_nodes(osp_cred, pattern=None, timeout=300):
def collect_ocs_logs(dir_name, ocp=True, ocs=True):
Collects OCS logs
dir_name
str - directory name to store OCS logs. Logs will be stored in dir_name suffix with _ocs_logs.ocp
bool - Whether to gather OCP logsocs
bool - Whether to gather OCS logs
def config_ntp(ceph_node):
def create_ceph_conf(
fsid,
mon_hosts,
pg_num='128',
pgp_num='128',
size='2',
auth='cephx',
pnetwork='172.16.0.0/12',
jsize='1024',
):
def create_ceph_nodes(
cluster_conf,
inventory,
osp_cred,
run_id,
instances_name=None,
):
@retry(LibcloudError, tries=5, delay=15)
def create_nodes(conf, inventory, osp_cred, run_id, instances_name=None):
def create_oc_resource(
template_name,
cluster_path,
_templating,
template_data=None,
template_dir='ocs-deployment',
):
Create an oc resource after rendering the specified template with the rook data from cluster_conf.
template_name
str - Name of the ocs-deployment config templatecluster_path
str - Path to cluster directory, where files will be written_templating
Templating - Object of Templating class used for templatingtemplate_data
dict - Data for render template (default: {})template_dir
str - Directory under templates dir where templateexists
(default - ocs-deployment)
def generate_repo_file(base_url, repos):
def get_ceph_versions(ceph_nodes, containerized=False):
Log and return the ceph or ceph-ansible versions for each node in the cluster.
ceph_nodes
- nodes in the clustercontainerized
- is the cluster containerized or not
A dict of the name / version pair for each node or container in the cluster
def get_iso_file_url(base_url):
def get_openstack_driver(yaml):
def get_pod_name_by_pattern(pattern='client', namespace=None, filter=None):
In a given namespace find names of the pods that match the given pattern
pattern
str - name of the pod with given patternnamespace
str - Namespace valuefilter
str - pod name to filter from the list
pod_list
list - List of pod names matching the pattern
def get_public_network():
Get the configured public network subnet for nodes in the cluster.
(str) public network subnet
def get_root_permissions(node, path):
Transfer ownership of root to current user for the path given. Recursive.
node(ceph.ceph.CephNode):
path
- file path
def hard_reboot(gyaml, name=None):
def keep_alive(ceph_nodes):
def node_power_failure(gyaml, sleep_time=300, name=None):
def open_firewall_port(ceph_node, port, protocol):
Opens firewall ports for given node
ceph_node
ceph.ceph.CephNode - ceph nodeport
str - portprotocol
str - protocol
def run_must_gather(log_dir_path, image, command=None):
Runs the must-gather tool against the cluster
log_dir_path
str - directory for dumped must-gather logsimage
str - must-gather image registry pathcommand
str - optional command to execute within the must-gather image
def search_ethernet_interface(ceph_node, ceph_node_list):
Search interface on the given node node which allows every node in the cluster accesible by it's shortname.
ceph_node
ceph.ceph.CephNode - node where check is performedceph_node_list(list)
- node list to check
def set_cdn_repo(node, repos):
def setup_cdn_repos(ceph_nodes, build=None):
def setup_ceph_toolbox():
Setup ceph-toolbox - also checks if toolbox exists, if it exists it behaves as noop.
def setup_deb_cdn_repo(node, build=None):
def setup_deb_repos(node, ubuntu_repo):
def setup_repos(ceph, base_url, installer_url=None):
def setup_vm_node(node, ceph_nodes, **params):
def store_cluster_state(ceph_cluster_object, ceph_clusters_file_name):
def update_ca_cert(node, cert_url, timeout=120):
def write_docker_daemon_json(json_text, node):
Write given string to /etc/docker/daemon/daemon
json_text
- json stringnode
ceph.ceph.CephNode - Ceph node object