ceph.ceph_admin.orch module

Module that interacts with the orchestrator CLI.

Provide the interfaces to ceph orch and in turn manage the orchestration engine.

class ceph.ceph_admin.orch.Orch(cluster, **config)

Bases: LSMixin, PSMixin, ReconfigMixin, RedeployMixin, RemoveMixin, RestartMixin, StartMixin, StopMixin, UpgradeMixin, PauseMixin, ResumeMixin, CephCLI

Represent ceph orch command.

apply_spec(config) None

Execute the apply_spec method using the object’s service name and provided input.

Parameters

config (Dict) – Key/value pairs passed from the test suite.

Example:

config:
    command: apply_spec
    service: orch
    base_cmd_args:          # arguments to ceph orch
        concise: true
        verbose: true
    specs:
     - service_type: host
       attach_ip_address: true
       labels: apply-all-labels
       nodes:
         - node2
         - node3

base_cmd_args   - key/value pairs to set for base command
specs           - service specifications.
check_service(service_name: str, timeout: int = 300, interval: int = 5, exist=True) bool

check service existence based on the exist parameter. if exist is set, then validate its presence. otherwise, for its removal.

Parameters
  • service_name (Str) – service name

  • timeout (Int) – timeout in seconds

  • interval (Int) – interval in seconds

  • exist (Bool) – exists or not

Returns

Boolean

check_service_exists(service_name: Optional[str] = None, service_type: Optional[str] = None, timeout: int = 1800, interval: int = 20) bool

Verify the provided service is running for the given list of ids.

Parameters
  • service_name (Str) – The name of the service to be checked.

  • service_type (Str) – The type of the service to be checked.

  • timeout (Int) – In seconds, the maximum allowed time (default=300)

  • interval (int) – In seconds, the polling interval time (default=5)

Returns

True if the service and the list of daemons are running else False.

Return type

Boolean

direct_calls = ['ls', 'ps']
get_hosts_by_label(label: str)

Fetch host object by label attached to it.

Parameters

label (Str) – name of the label

Returns

hosts (List)

get_role_service(service_name: str) str

Get service info by name.

Parameters

service_name (Str) – service name

Returns

service (Dict)

Raises

ResourceNotFound – when no resource with the provided is matched.

op(op, config)

Execute the command ceph orch <start|stop|restart|reconfigure|redeploy> <service>.

Parameters
  • config (Dict) – command and service are passed from the test case.

  • op (Str) – operation parameters.

Returns

output (Str), error (Str) returned by the command.

Example:

Testing ceph orch restart mon
op: restart|start|stop|reconfigure|redeploy

config:
  command: restart
  service: mon
...

config:
    command: start
    base_cmd_args:
        verbose: true
    pos_args:
        - service_name
status(config) bool

Execute the command ceph orch status <args>.

Parameters

config (Dict) – The key/value pairs passed from the test case.

Returns

output, error returned by the command.

Example:

Testing ceph orch status

config:
    command: status
    base_cmd_args:
        verbose: true
        format: json | json-pretty | xml | xml-pretty | plain | yaml
    args:
        detail: true
validate_spec_services(specs) None
verify_status(op) None

Verify the status of the orchestrator for the operation specified.

Parameters

op (str) – pause/resume based on whether the pause or resume status to be checked