]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
qa/tasks/ceph_manager.py: always use self.logger 29239/head
authorKefu Chai <kchai@redhat.com>
Wed, 24 Jul 2019 02:22:40 +0000 (10:22 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 24 Jul 2019 02:28:00 +0000 (10:28 +0800)
commit310ccd9f9f7b16c276d18a6cc109a76d22467ee8
treeca9e2614e4311c3a28552a797c1bd1df361fbb3b
parent1a379bc20227322154d225b3712df49242c05db3
qa/tasks/ceph_manager.py: always use self.logger

in fbd4836d, a regression is introduced:

self.log("failed to read erasure_code_profile. %s was likely removed",
pool)

because `self.log` is actually a lambda which just do

self.logger.info(x)

in this change

* `Thrasher.log()` is added for three reasons:
 - in PEP-8,

> Always use a def statement instead of an assignment statement that
> binds a lambda expression directly to an identifier
so a better way is to define a method using `def`
 - and i think it helps with the readability
* `logger` parameter is now mandatory now in the constructor of
  `Thrasher` class. because the instance of this class is only created
by `qa/tasks/thrashosds.py`, like:

thrash_proc = ceph_manager.Thrasher(
        cluster_manager,
        config,
        logger=log.getChild('thrasher')
        )

and `log.getChild()` does not return `None`, so there is no need to
handle that case.

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/ceph_manager.py