-
Notifications
You must be signed in to change notification settings - Fork 556
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
Conversation
Build failed.
|
@jtopjian This is ready for review. |
There was a problem hiding this 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"` |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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. |
Build succeeded.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thank you!
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