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

[gluster_block] Added new plugin gluster_block #1041

Merged
merged 1 commit into from Jun 28, 2017

Conversation

vredara
Copy link
Contributor

@vredara vredara commented Jun 19, 2017

gluster_block plugin collects config and log files related to blocks

Signed-off-by: venkata edara redara@redhat.com


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?

@bmr-cymru
Copy link
Member

In future please fill out the pull request template - it is there to save everyone time (including you, by avoiding unnecessary requests to respin the branch).

@bmr-cymru bmr-cymru self-requested a review June 19, 2017 10:15
@bmr-cymru bmr-cymru self-assigned this Jun 19, 2017
Copy link
Member

@bmr-cymru bmr-cymru left a comment

Choose a reason for hiding this comment

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

This should be a very short and simple plugin: just detect the presence of gluster_block and collect the logs. Nothing more.

Duplicating the targetcli plugin functionality is not acceptable - once all that is removed we can merge the rest as a simple log collector for the block service.

plugin_name = 'gluster_block'
profiles = ('storage',)
packages = ["gluster-block"]
files = ["/usr/sbin/gluster-block"]
Copy link
Member

Choose a reason for hiding this comment

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

Why lists for these? The normal sos style is to use a tuple (since they are invariant and do not need the baggage of a mutable list type).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok. I am changing lists to tuples.

config_to_collect = ["/sys/kernel/config/target", "/etc/target"]

def setup(self):
self.add_cmd_output("targetcli ls")
Copy link
Member

Choose a reason for hiding this comment

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

Nack. We have the targetcli plugin for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. removed this cmd.


# collect config files
for config_file in self.config_to_collect:
self.add_copy_spec(config_file)
Copy link
Member

Choose a reason for hiding this comment

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

Nack. Please look at the API documentation. The add_copy_spec() method accepts either a single string, or a list of strings. This is just pointless make-work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, will collect only "/sys/kernel/config/target" which is not being collected by targetcli.

Copy link
Member

@bmr-cymru bmr-cymru Jun 19, 2017

Choose a reason for hiding this comment

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

It needs to go into the targetcli plugin - you can either file a separate pull request for that, or just amend your existing commit (to address the review items), and then add a new commit with the change for targetcli. Once that's done you can update the branch for the PR with git push --force.

Note that we don't accept 'fixup' commits in master so you'll need to respin the branch anyway for the review items.

limit = self.get_option("log_size")
else:
limit = 0

Copy link
Member

Choose a reason for hiding this comment

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

Ack, thanks for implementing log limiting.

limit = 0

if limit:
for f in glob.glob("/var/log/gluster-block/*.log"):
Copy link
Member

Choose a reason for hiding this comment

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

Ack. This is ugly, but it is in keeping with other plugins that try to work around the current limits API shortcomings. We can clean it up later when those are addressed.

profiles = ('storage',)
packages = ["gluster-block"]
files = ["/usr/sbin/gluster-block"]
config_to_collect = ["/sys/kernel/config/target", "/etc/target"]
Copy link
Member

Choose a reason for hiding this comment

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

Nack: you're just duplicating the targetcli plugin under a different name!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didnt observed the targetcli plugin, I will remove targetcli from gluster-block plugin.

@vredara
Copy link
Contributor Author

vredara commented Jun 19, 2017

I changed the code in latest commit. please review the latest changes.

@bmr-cymru
Copy link
Member

Please don't push fixup commits ("update gluster_block.py" - and even without being a fixup, that subject does not comply with the commit formatting guidelines - every commit must be in [component] short description of change format).

Use git reset and git commit --amend, or git rebase -i to produce a single commit with the changes you want to merge, and then push the result with git push --force.

Copy link
Member

@bmr-cymru bmr-cymru left a comment

Choose a reason for hiding this comment

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

Need to remove targetcli change - can either move it to targetcli in this PR, or start a new one - I don't mind, but it does not belong in this plugin.

Once that change is done & the extra commit folded back into the original this should be ready for merge.

for config_file in self.config_to_collect:
self.add_copy_spec(config_file)
# collect config
self.add_copy_spec("/sys/kernel/config/target")
Copy link
Member

Choose a reason for hiding this comment

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

As discussed, this needs to go in the targetcli plugin.

@@ -43,3 +40,4 @@ def setup(self):
self.add_copy_spec(f, limit)
else:
self.add_copy_spec("/var/log/gluster-block")

Copy link
Member

Choose a reason for hiding this comment

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

Other than the remaining targetcli line these changes look fine, once they are folded into the original commit and the branch updated.

@vredara
Copy link
Contributor Author

vredara commented Jun 20, 2017

Sorry for too many updates. I am contributing to sos report for 1st time. I made code changes according to guidelines and submitted new commit. the new commit also has target cli changes in targetcli plugin only. so gluster block plugin only collects logs related to it.

@vredara
Copy link
Contributor Author

vredara commented Jun 27, 2017

can you please review my latest commit. I incorporated all the comments.

@bmr-cymru
Copy link
Member

You should either note that targetcli change in the commit message or (better, but I won't insist on it), in a separate commit (although technically, to comply with our commit formatting, you'd then need to have a subject of [targetcli, gluster_block] add new plugin and one item to targetcli, which just looks weird..).

It's obfuscating to hide a change to another plugin inside a commit that say "add a new plugin"; it's potentially confusing for people reading the logs and trying to track down changes.

The point is to make it easy for folks reviewing for changes, or filtering commits by affected plugins.

gluster_block plugin collects config/log files related to blocks

Signed-off-by: venkata edara <redara@redhat.com>
@vredara
Copy link
Contributor Author

vredara commented Jun 28, 2017 via email

Copy link
Member

@bmr-cymru bmr-cymru left a comment

Choose a reason for hiding this comment

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

ack

@bmr-cymru
Copy link
Member

Looks good, thanks for re-working. 👍

@adam-stokes adam-stokes merged commit 07e6ce3 into sosreport:master Jun 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants