Skip to content

[skip ci] Define REST API handlers for listing VCHs#6155

Merged
zjs merged 1 commit intovmware:feature/vic-machine-servicefrom
zjs:topic/vic-machine-service-impl-list
Sep 14, 2017
Merged

[skip ci] Define REST API handlers for listing VCHs#6155
zjs merged 1 commit intovmware:feature/vic-machine-servicefrom
zjs:topic/vic-machine-service-impl-list

Conversation

@zjs
Copy link
Member

@zjs zjs commented Aug 29, 2017

Introduce a pair of handlers for listing information about VCHs, optionally scoped to a compute resource or datacenter.

Include basic authentication and error handling, which should be improved on as development continues.

Resolves #6026.

Note: this change builds on #6154 and, once approved, I would like this to land as the fourth commit on feature/vic-machine-service.

@zjs zjs self-assigned this Aug 29, 2017
@zjs zjs requested a review from caglar10ur August 30, 2017 19:41
for _, vch := range vchs {
var version *version.Build
var dockerHost string
var adminPortal string
Copy link
Contributor

Choose a reason for hiding this comment

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

you may want to declare them outside of the loop and reusing them if vchs potentially a big slice of vms

Copy link
Member Author

Choose a reason for hiding this comment

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

If I declare them outside the loop, I need to re-zero them on each iteration.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just for curiosity I would take a look at the generated code, I suspect all these variable are allocated on stack.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure why it matters whether or not these three variables are allocated on the stack. Could you elaborate?


if public := vchConfig.ExecutorConfig.Networks["public"]; public != nil {
if public_ip := public.Assigned.IP; public_ip != nil {
var docker_port string
Copy link
Contributor

Choose a reason for hiding this comment

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

docker_port := fmt.Sprintf("%d", opts.DefaultHTTPPort)
if !vchConfig.HostCertificate.IsNil() {
	docker_port = fmt.Sprintf("%d", opts.DefaultTLSHTTPPort)
}

saves a declaration and branch :)

model.UpgradeStatus = upgradeStatusMessage(ctx, vch, installerVer, version)
}

if adminPortal != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

the default values of AdminPortal and DockerHost is "" anyway so I think you could just assign them without checking

@zjs zjs changed the base branch from master to feature/vic-machine-service September 7, 2017 20:57
@zjs zjs force-pushed the topic/vic-machine-service-impl-list branch from 399fdfc to ec1fdfd Compare September 14, 2017 17:36
@zjs zjs requested a review from jzt September 14, 2017 18:14
@jzt
Copy link
Contributor

jzt commented Sep 14, 2017

Are the tests you added here related to the VCH listing api handlers?

@zjs zjs force-pushed the topic/vic-machine-service-impl-list branch from ec1fdfd to 6f60f17 Compare September 14, 2017 21:09
Introduce a pair of handlers for listing information about VCHs,
optionally scoped to a compute resource or datacenter.

Include basic authentication and error handling, which should be
improved on as development continues.
@zjs zjs force-pushed the topic/vic-machine-service-impl-list branch from 6f60f17 to f85af3b Compare September 14, 2017 21:22
@zjs zjs merged commit cda0d34 into vmware:feature/vic-machine-service Sep 14, 2017
@zjs zjs deleted the topic/vic-machine-service-impl-list branch September 27, 2017 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants