Skip to content

Latest commit

 

History

History
450 lines (309 loc) · 11.1 KB

utils.md

File metadata and controls

450 lines (309 loc) · 11.1 KB

Utils

Auto-generated documentation for ocs_ci.ocs.utils module.

apply_oc_resource

[find in source code]

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.

Arguments

  • template_name str - Name of the ocs-deployment config template
  • cluster_path str - Path to cluster directory, where files will be written
  • _templating Templating - Object of Templating class used for templating
  • template_data dict - Data for render template (default: {})
  • template_dir str - Directory under templates dir where template
    • exists (default - ocs-deployment)

check_ceph_healthly

[find in source code]

def check_ceph_healthly(
    ceph_mon,
    num_osds,
    num_mons,
    mon_container=None,
    timeout=300,
):

Function to check ceph is in healthy state

Arguments

  • ceph_mon - monitor node
  • num_osds - number of osds in cluster
  • num_mons - number of mons in cluster
  • mon_container - monitor container name if monitor is placed in the container
  • timeout - 300 seconds(default) max time to check if cluster is not healthy within timeout period return 1

Returns

return 0 when ceph is in healthy state, else 1

cleanup_ceph_nodes

[find in source code]

def cleanup_ceph_nodes(osp_cred, pattern=None, timeout=300):

collect_ocs_logs

[find in source code]

def collect_ocs_logs(dir_name, ocp=True, ocs=True):

Collects OCS logs

Arguments

  • 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 logs
  • ocs bool - Whether to gather OCS logs

config_ntp

[find in source code]

def config_ntp(ceph_node):

create_ceph_conf

[find in source code]

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',
):

create_ceph_nodes

[find in source code]

def create_ceph_nodes(
    cluster_conf,
    inventory,
    osp_cred,
    run_id,
    instances_name=None,
):

create_nodes

[find in source code]

@retry(LibcloudError, tries=5, delay=15)
def create_nodes(conf, inventory, osp_cred, run_id, instances_name=None):

create_oc_resource

[find in source code]

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.

Arguments

  • template_name str - Name of the ocs-deployment config template
  • cluster_path str - Path to cluster directory, where files will be written
  • _templating Templating - Object of Templating class used for templating
  • template_data dict - Data for render template (default: {})
  • template_dir str - Directory under templates dir where template
    • exists (default - ocs-deployment)

generate_repo_file

[find in source code]

def generate_repo_file(base_url, repos):

get_ceph_versions

[find in source code]

def get_ceph_versions(ceph_nodes, containerized=False):

Log and return the ceph or ceph-ansible versions for each node in the cluster.

Arguments

  • ceph_nodes - nodes in the cluster
  • containerized - is the cluster containerized or not

Returns

A dict of the name / version pair for each node or container in the cluster

get_iso_file_url

[find in source code]

def get_iso_file_url(base_url):

get_openstack_driver

[find in source code]

def get_openstack_driver(yaml):

get_pod_name_by_pattern

[find in source code]

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

Arguments

  • pattern str - name of the pod with given pattern
  • namespace str - Namespace value
  • filter str - pod name to filter from the list

Returns

  • pod_list list - List of pod names matching the pattern

get_public_network

[find in source code]

def get_public_network():

Get the configured public network subnet for nodes in the cluster.

Returns

(str) public network subnet

get_root_permissions

[find in source code]

def get_root_permissions(node, path):

Transfer ownership of root to current user for the path given. Recursive.

Arguments

node(ceph.ceph.CephNode):

  • path - file path

hard_reboot

[find in source code]

def hard_reboot(gyaml, name=None):

keep_alive

[find in source code]

def keep_alive(ceph_nodes):

node_power_failure

[find in source code]

def node_power_failure(gyaml, sleep_time=300, name=None):

open_firewall_port

[find in source code]

def open_firewall_port(ceph_node, port, protocol):

Opens firewall ports for given node

Arguments

  • ceph_node ceph.ceph.CephNode - ceph node
  • port str - port
  • protocol str - protocol

run_must_gather

[find in source code]

def run_must_gather(log_dir_path, image, command=None):

Runs the must-gather tool against the cluster

Arguments

  • log_dir_path str - directory for dumped must-gather logs
  • image str - must-gather image registry path
  • command str - optional command to execute within the must-gather image

search_ethernet_interface

[find in source code]

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.

Arguments

  • ceph_node ceph.ceph.CephNode - node where check is performed
  • ceph_node_list(list) - node list to check

set_cdn_repo

[find in source code]

def set_cdn_repo(node, repos):

setup_cdn_repos

[find in source code]

def setup_cdn_repos(ceph_nodes, build=None):

setup_ceph_toolbox

[find in source code]

def setup_ceph_toolbox():

Setup ceph-toolbox - also checks if toolbox exists, if it exists it behaves as noop.

setup_deb_cdn_repo

[find in source code]

def setup_deb_cdn_repo(node, build=None):

setup_deb_repos

[find in source code]

def setup_deb_repos(node, ubuntu_repo):

setup_repos

[find in source code]

def setup_repos(ceph, base_url, installer_url=None):

setup_vm_node

[find in source code]

def setup_vm_node(node, ceph_nodes, **params):

store_cluster_state

[find in source code]

def store_cluster_state(ceph_cluster_object, ceph_clusters_file_name):

update_ca_cert

[find in source code]

def update_ca_cert(node, cert_url, timeout=120):

write_docker_daemon_json

[find in source code]

def write_docker_daemon_json(json_text, node):

Write given string to /etc/docker/daemon/daemon

Arguments

  • json_text - json string
  • node ceph.ceph.CephNode - Ceph node object