Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add support for update of Compute service #1902

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

Merged
merged 11 commits into from
Mar 25, 2020

Conversation

dkt26111
Copy link
Contributor

For #1901

Links to the line numbers/files in the OpenStack source code that support the
code in this PR:

API doc:
https://docs.openstack.org/api-ref/compute/#update-compute-service

API code:
https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/services.py#L199

@coveralls
Copy link

coveralls commented Mar 23, 2020

Coverage Status

Coverage increased (+0.008%) to 78.773% when pulling d42065f on dkt26111:os_services into fbb6b8b on gophercloud:master.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 23, 2020

Build failed.

@dkt26111
Copy link
Contributor Author

@jtopjian This is ready for review.

Copy link
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

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

@dkt26111 Thanks for working on this. I have one change request and one comment. Please let me know if you have any questions.

// UpdateOpts specifies the base attributes that may be updated on a service.
type UpdateOpts struct {
// Status represents the new service status. One of enabled or disabled.
Status string `json:"status,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is input (part of a request) and there are finite choices, we can use a defined type:

type ServiceStatus string

const (
  // ServiceEnabled is used to mark a service as being enabled.
  ServiceEnabled ServiceStatus = "enabled"

  // ServiceDisabled is used to mark a service as being disabled.
  ServiceDisabled ServiceStatus = "disabled"
)

type UpdateOpts struct {
  ...
  Status ServiceStatus `json:"status,omitempty"`
  ...
}

The Status field in the results.go will stay a string, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, that looks better. I'll make that change.


// ForcedDown is a manual override to tell nova that the service in question
// has been fenced manually by the operations team.
ForcedDown bool `json:"forced_down,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

The combination of bool and omitempty will cause values of false to never be sent. Just to be sure: there is absolutely no reason to ever send this field with a value of false, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, that is my understanding.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 24, 2020

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@theopenlab-ci
Copy link

theopenlab-ci bot commented Mar 24, 2020

Build succeeded.

Copy link
Contributor

@jtopjian jtopjian left a comment

Choose a reason for hiding this comment

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

LGTM - thank you!

@jtopjian jtopjian merged commit 07253c9 into gophercloud:master Mar 25, 2020
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.

3 participants