Add support for update of Compute service#1902
Conversation
|
Build failed.
|
|
@jtopjian This is ready for review. |
| // 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.
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.
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.
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.
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.
|
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