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

Allow target-level control parameter overrides #103

Merged
merged 3 commits into from Jun 15, 2018
Merged

Conversation

dillaman
Copy link

@dillaman dillaman commented Jun 8, 2018

No description provided.

@dillaman
Copy link
Author

dillaman commented Jun 8, 2018

Requires ceph/ceph-iscsi-config#66

gwcli/gateway.py Outdated
else:
self.logger.error("Failed to reconfigure : "
"{}".format(response_message(api.response,
self.logger)))
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure where yet, but I think we need a _set_controls/_refresh_control_values call somewhere around this time, so if the info command is run after the reconfigure then you see the updated values. Or maybe _get_controls should do a _refresh_control_values, so Target.refresh() calls update those values.

I noticed for disk reconfigure operations we do it in the reconfigure function when successful which I think is in a similar place as here.

Copy link
Author

Choose a reason for hiding this comment

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

Good catch

Copy link
Author

Choose a reason for hiding this comment

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

Updated

gwcli/gateway.py Outdated
sorted(settings.Settings.GATEWAY_SETTINGS))))
return

# Issue the api request for the resize
Copy link
Contributor

Choose a reason for hiding this comment

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

I think change "resize" to "reconfigure".

Copy link
Author

Choose a reason for hiding this comment

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

Updated

Copy link
Author

Choose a reason for hiding this comment

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

Updated

gwcli/gateway.py Outdated
def summary(self):
return "Gateways: {}".format(len(self.gateway_group.children)), None

def ui_command_info(self):
self.logger.debug("CMD: info")

Copy link
Contributor

Choose a reason for hiding this comment

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

Should the Target class be UINode instead of UIGroup, so we can use the info helpers? We can then drop all this and just add a display_attributes arrary with target_iqn and control_values and this function is just a call to

console_message(get_info())

?

I honestly did not understand the difference between uigroup and uinode other than the info difference, so no idea if that is ok wrt python/object oriented design. It just looked easier code wise.

My last review comment. Sorry for the sporadic review comments over multiple days :)

Copy link
Author

Choose a reason for hiding this comment

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

From my quick glance, I thought the UIGroup is allowed to have children and the UINode was designed to be a leaf. I might be wrong, though.

Copy link
Author

Choose a reason for hiding this comment

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

... never mind, they seem to basically be the same thing. updated.

Jason Dillaman added 3 commits June 14, 2018 09:40
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Copy link
Contributor

@mikechristie mikechristie left a comment

Choose a reason for hiding this comment

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

LGTM.

@dillaman dillaman merged commit b9e48a7 into master Jun 15, 2018
@dillaman dillaman deleted the wip-overrides branch June 15, 2018 14:04
controls = {}
raw_controls = json.loads(controls_json)
for k in settings.Settings.GATEWAY_SETTINGS:
if raw_controls.has_key(k):
Copy link
Contributor

Choose a reason for hiding this comment

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

has_key has been deprecated in favor of 'in' (I think).
See http://portingguide.readthedocs.io/en/latest/dicts.html

Copy link
Author

Choose a reason for hiding this comment

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

This is already merged, so feel free to open a PR to incorporate your suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done - #110

raw_controls = json.loads(controls_json)
for k in settings.Settings.GATEWAY_SETTINGS:
if raw_controls.has_key(k):
value = raw_controls[k] if raw_controls[k] else None
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps:

value = raw_controls.get(k) ?

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