Skip to content

python-common: only validate host_pattern if present#34860

Merged
sebastian-philipp merged 5 commits intoceph:masterfrom
jschmid1:host_spec_fixes
Jun 3, 2020
Merged

python-common: only validate host_pattern if present#34860
sebastian-philipp merged 5 commits intoceph:masterfrom
jschmid1:host_spec_fixes

Conversation

@jschmid1
Copy link
Contributor

Signed-off-by: Joshua Schmid jschmid@suse.de

Fixes: https://tracker.ceph.com/issues/45203

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@jschmid1 jschmid1 requested a review from a team as a code owner April 30, 2020 13:06
@smithfarm
Copy link
Contributor

Note: @sebastian-philipp appears to have changed the scope of the tracker https://tracker.ceph.com/issues/45203 ... I guess this PR just fixes the originally reported bug, but doesn't implement the feature?

@sebastian-philipp
Copy link
Contributor

ping?

@jschmid1
Copy link
Contributor Author

I noticed that we don't have a uniformget_hosts return type across our orchestrators.

While we have:

cephadm:

  • self.cache.get_hosts() -> List[str]
    goes via HostCache and looks for daemons hostnames

  • self._get_hosts() -> List[str]
    goes via inventory

  • self.get_hosts() -> List[orchestrator.HostSpec]
    gets information from list(inventory.all_specs()) very odd..

  • several instances where we get hosts via one of the above funcs and shove the return in HostPlacementSpec

rook:

  • self.get_hosts -> List[orchestrator.HostSpec]
    gets this from rook_cluster.get_node_names()

test_orchestrator:

  • self.get_hosts -> List[orchestrator.HostSpec]
    via the _inventory object

This probably needs to be cleaned up some day. I'd argue that this is out of scope of this patchset.

@sebastian-philipp
Copy link
Contributor

Plus HostPlacementSpec is odd:

https://github.com/ceph/ceph/blob/master/src/pybind/mgr/cephadm/module.py#L1181-L1186

to get the hosts matching a label, you need to call

self._get_hosts(spec.placement.label)

to get the host matching a patterm, you need to call

spec.placement.pattern_matches_hosts(self.inventory.keys())

Would be great to have a unified

HostPlacementSpec.get_matching_hosts(hosts: List[HostSpec])

@sebastian-philipp
Copy link
Contributor

I noticed that we don't have a uniformget_hosts return type across our orchestrators.

While we have:

cephadm:

  • self.cache.get_hosts() -> List[str]
    goes via HostCache and looks for daemons hostnames
  • self._get_hosts() -> List[str]
    goes via inventory
  • self.get_hosts() -> List[orchestrator.HostSpec]

self.get_hosts() -> Completion

gets information from list(inventory.all_specs()) very odd..

  • several instances where we get hosts via one of the above funcs and shove the return in HostPlacementSpec

rook:

  • self.get_hosts -> List[orchestrator.HostSpec]

self.get_hosts() -> Completion

gets this from rook_cluster.get_node_names()

test_orchestrator:

  • self.get_hosts -> List[orchestrator.HostSpec]

self.get_hosts() -> Completion

via the _inventory object

This probably needs to be cleaned up some day. I'd argue that this is out of scope of this patchset.

@sebastian-philipp
Copy link
Contributor

=================================== FAILURES ===================================
_________________________ test_DriveGroup[test_input0] _________________________

test_input = [{'data_devices': {'paths': ['/dev/sda']}, 'placement': {'host_pattern': 'hostname'}, 'service_id': 'testing_drivegroup', 'service_type': 'osd'}]

    @pytest.mark.parametrize("test_input",
    [
        (
            [  # new style json
                {
                    'service_type': 'osd',
                    'service_id': 'testing_drivegroup',
                    'placement': {'host_pattern': 'hostname'},
                    'data_devices': {'paths': ['/dev/sda']}
                }
            ]
        ),
    ])
    def test_DriveGroup(test_input):
        dg = [DriveGroupSpec.from_json(inp) for inp in test_input][0]
>       assert dg.placement.pattern_matches_hosts(['hostname']) == ['hostname']
E       AttributeError: 'PlacementSpec' object has no attribute 'pattern_matches_hosts'

ceph/tests/test_drive_group.py:27: AttributeError
___________________________ test_drivegroup_pattern ____________________________

    def test_drivegroup_pattern():
        dg = DriveGroupSpec(PlacementSpec(host_pattern='node[1-3]'), data_devices=DeviceSelection(all=True))
>       assert dg.placement.pattern_matches_hosts(['node{}'.format(i) for i in range(10)]) == ['node1', 'node2', 'node3']
E       AttributeError: 'PlacementSpec' object has no attribute 'pattern_matches_hosts'

ceph/tests/test_drive_group.py:56: AttributeError

@sebastian-philipp sebastian-philipp added the wip-swagner-testing My Teuthology tests label May 19, 2020
Joshua Schmid added 4 commits May 28, 2020 10:10
Signed-off-by: Joshua Schmid <jschmid@suse.de>
Signed-off-by: Joshua Schmid <jschmid@suse.de>
Signed-off-by: Joshua Schmid <jschmid@suse.de>
Signed-off-by: Joshua Schmid <jschmid@suse.de>
@jschmid1
Copy link
Contributor Author

jschmid1 commented May 28, 2020

about to schedule another teuthology run for test_orchestrator ..

looks fine now: http://pulpito.ceph.com/jschmid-2020-05-28_12:06:59-rados:cephadm-wip-jschmid1-testing-2020-05-28-1115-distro-basic-smithi/

Signed-off-by: Joshua Schmid <jschmid@suse.de>
@sebastian-philipp
Copy link
Contributor

@jschmid1
Copy link
Contributor Author

jschmid1 commented Jun 2, 2020

@sebastian-philipp sebastian-philipp merged commit 66052c9 into ceph:master Jun 3, 2020
jmolmo added a commit to jmolmo/ceph that referenced this pull request Jul 3, 2020
ceph#34860 broke Rook Integration tests (Rook orchestrator module)

This fix the error that can be seen in:
https://jenkins.rook.io/blue/rest/organizations/jenkins/pipelines/rook/pipelines/rook/branches/master/runs/2046/nodes/63/steps/121/log/?start=0

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
sebastian-philipp pushed a commit to sebastian-philipp/ceph that referenced this pull request Jul 15, 2020
ceph#34860 broke Rook Integration tests (Rook orchestrator module)

This fix the error that can be seen in:
https://jenkins.rook.io/blue/rest/organizations/jenkins/pipelines/rook/pipelines/rook/branches/master/runs/2046/nodes/63/steps/121/log/?start=0

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
(cherry picked from commit 9fd4b48)
ideepika pushed a commit to ideepika/ceph that referenced this pull request Aug 7, 2020
ceph#34860 broke Rook Integration tests (Rook orchestrator module)

This fix the error that can be seen in:
https://jenkins.rook.io/blue/rest/organizations/jenkins/pipelines/rook/pipelines/rook/branches/master/runs/2046/nodes/63/steps/121/log/?start=0

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
ideepika pushed a commit to ceph/ceph-ci that referenced this pull request Sep 3, 2020
ceph/ceph#34860 broke Rook Integration tests (Rook orchestrator module)

This fix the error that can be seen in:
https://jenkins.rook.io/blue/rest/organizations/jenkins/pipelines/rook/pipelines/rook/branches/master/runs/2046/nodes/63/steps/121/log/?start=0

Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants