Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mgr: initialize PyModuleRegistry sooner #20321

Merged
merged 2 commits into from Mar 15, 2018
Merged

mgr: initialize PyModuleRegistry sooner #20321

merged 2 commits into from Mar 15, 2018

Conversation

jcsp
Copy link
Contributor

@jcsp jcsp commented Feb 5, 2018

This was waiting on MgrMap to init, so that it would know whether
modules should be enabled. However, you don't really need to know
that until someone calls standby_start or active_start, so we
can initialize during MgrStandby::init, and fill out the enabled
flags later.

This prevents the mgr from prematurely emitting a MMgrBeacon
that claims no modules are found.

http://tracker.ceph.com/issues/22918
Signed-off-by: John Spray john.spray@redhat.com

@yuriw
Copy link
Contributor

yuriw commented Feb 5, 2018

Seems to have conflict

From https://github.com/jcsp/ceph

  • branch wip-22918 -> FETCH_HEAD
    warning: Failed to merge submodule src/rocksdb (not checked out)
    CONFLICT (rename/add): Rename src/test/ubuntu-12.04/Dockerfile.in->src/test/rbd-ggate.sh in f88a2bd. src/test/rbd-ggate.sh added in HEAD

@jcsp
Copy link
Contributor Author

jcsp commented Feb 5, 2018

Sorry, I had a total brainfart and opened this PR instead of the one I meant to open as a backport -- this is not even a backport at all!

@jcsp jcsp changed the title mgr: initialize PyModuleRegistry sooner [DNM] mgr: initialize PyModuleRegistry sooner Feb 5, 2018
@jcsp jcsp changed the title [DNM] mgr: initialize PyModuleRegistry sooner mgr: initialize PyModuleRegistry sooner Mar 2, 2018
@jcsp
Copy link
Contributor Author

jcsp commented Mar 2, 2018

OK, finally came back to this and fixed it up, should be good to go. Passed locally with tasks.mgr.test_module_selftest

// or active_start
for (const auto &i : modules) {
const auto &module = i.second;
const bool enabled = (mgr_map.modules.count(module_name) > 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos7/DIST/centos7/MACHINE_SIZE/huge/release/13.0.1-2432-g7c5dfdf/rpm/el7/BUILD/ceph-13.0.1-2432-g7c5dfdf/src/mgr/PyModuleRegistry.h:97:53: error: 'module_name' was not declared in this scope
         const bool enabled = (mgr_map.modules.count(module_name) > 0);
                                                     ^~~~~~~~~~~

Copy link
Contributor

@tchaikov tchaikov Mar 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also put following, as we have structured binding in C++17 now:

for (auto& [module_name, module] : modules) {
  const bool enabled = (mgr_map.modules.count(module_name) > 0);
  module.set_enabled(enabled);
}

also, i'd suggest move the implementation of method into .cc file.
please note PyModule::set_enabled() is not a const method. so we cannot use const auto& [module_name, module] here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for suggestions, this is my first time using the new structured binding bits and I like it :-)

The const auto is permitted (if a bit misleading) because the module part is a shared_ptr rather than the actual PyModule

I've pushed an update.

John Spray added 2 commits March 5, 2018 10:12
This was waiting on MgrMap to init, so that it would know whether
modules should be enabled.  However, you don't really need to know
that until someone calls standby_start or active_start, so we
can initialize during MgrStandby::init, and fill out the enabled
flags later.

This prevents the mgr from prematurely emitting a MMgrBeacon
that claims no modules are found.

http://tracker.ceph.com/issues/22918
Signed-off-by: John Spray <john.spray@redhat.com>
This was returning an int that was only ever zero.

Signed-off-by: John Spray <john.spray@redhat.com>
@jcsp
Copy link
Contributor Author

jcsp commented Mar 13, 2018

@tchaikov could you do one last review pass when you have a minute?

@tchaikov tchaikov merged commit e078ec6 into ceph:master Mar 15, 2018
@tchaikov
Copy link
Contributor

@jcsp i think this fix also applies to luminous, so i am adding "backport=luminous" in its tracker ticket accordingly. please correct me if i am wrong.

@jcsp jcsp deleted the wip-22918 branch March 15, 2018 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants