Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Libvirt updates #552

Merged
merged 6 commits into from
May 31, 2017
Merged

Libvirt updates #552

merged 6 commits into from
May 31, 2017

Conversation

ijc
Copy link

@ijc ijc commented May 19, 2017

Two updates:

  • Pass an entire libvirt domain configuration in spec.Properties.Domain, allowing for more flexibility.
  • Expose any assigned IP addresses in the instance.Description if asked too (properties == true).

@YujiOshima
Copy link
Contributor

Hi @ijc25 !
Flexible configuration look so nice!
Some points.

@ijc
Copy link
Author

ijc commented May 19, 2017

Do we need to set all Domain config? Do you have any default value? Previous code looks having default cpu, memory config.

The new code doesn't set any defaults, that's true. I could add them if you think it is useful, neither the hyperkit nor packet instance plugins seem to do that though.

Though previous code checked property Kernel exist, this PR looks does not. Is it OK?

There are valid VM configurations which do not boot a kernel directly, for example ones which boot BIOS or UEFI firmware and a bootloader on the disk so there would be no kernel given in that case.

Maybe it is better to use version of libvirt-go after c3209e4.

This PR switches to v3.3.0 which is the latest release, there has only been that one commit (c3209e4 which you referenced) since and it is to do with go 1.5 compat in the lxc backend so probably not too interesting to us.

@ijc
Copy link
Author

ijc commented May 19, 2017

CI failure is:

# github.com/docker/infrakit/vendor/github.com/libvirt/libvirt-go
vendor/github.com/libvirt/libvirt-go/lxc.go:63: cannot use cfdlist (type *C.int) as type unsafe.Pointer in argument to func literal
vendor/github.com/libvirt/libvirt-go/lxc.go:85: cannot use coldfdlist (type *C.int) as type unsafe.Pointer in argument to func literal

which might be down to the new commit in libvirt-go: libvirt/libvirt-go@c3209e4. I'll add a patch to update to that and see.

@GordonTheTurtle
Copy link

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "libvirt-updates" git@github.com:ijc25/infrakit.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354025144
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@YujiOshima
Copy link
Contributor

YujiOshima commented May 20, 2017

@ijc25 Thank you for the reply.
Since the presence or absence of a default value is not essential, I think that it will be fine as it is.
I was wondering if there is an implied default value.

Kernel

I understood, thanks.

@ijc
Copy link
Author

ijc commented May 23, 2017

@YujiOshima

I was wondering if there is an implied default value.

It's not impossible that there is one at the libvirt level. I actually don't know. I think it probably makes sense to leave it to libvirt to have defaults, rather than add a second layer of potentially contradictory defaults on top.

@chungers
Copy link
Contributor

@ijc25 - there are errors with the tests

?   	github.com/docker/infrakit/pkg/plugin/instance/image/gcp	[no test files]
time="2017-05-25T03:30:14Z" level=error msg="Creating Domain: virError(Code=1, Domain=20, Message='internal error: missing domain type attribute')" instance=infrakit-7adef51f 
--- FAIL: TestBasicLifecycle (0.00s)
	Error Trace:	instance_test.go:78
	Error:		Received unexpected error:
			virError(Code=1, Domain=20, Message='internal error: missing domain type attribute')
			Creating Domain
			github.com/docker/infrakit/pkg/plugin/instance/libvirt.libvirtPlugin.Provision
				github.com/docker/infrakit/pkg/plugin/instance/libvirt/_test/_obj_test/instance.go:283
			github.com/docker/infrakit/pkg/plugin/instance/libvirt.(*libvirtPlugin).Provision
				<autogenerated>:2
			github.com/docker/infrakit/pkg/plugin/instance/libvirt.TestBasicLifecycle
				/home/ubuntu/.go_workspace/src/github.com/docker/infrakit/pkg/plugin/instance/libvirt/instance_test.go:77
			testing.tRunner
				/usr/local/go/src/testing/testing.go:657
			runtime.goexit
				/usr/local/go/src/runtime/asm_amd64.s:2197
		

Can you have a look?

@ijc
Copy link
Author

ijc commented May 25, 2017

Sure, I somehow missed that in the logs. In hindsight it is rather suspicious that pkg/plugin/instance/libvirt/instance_test.go wasn't touched by this PR.

@codecov
Copy link

codecov bot commented May 25, 2017

Codecov Report

Merging #552 into master will decrease coverage by 0.02%.
The diff coverage is 58.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #552      +/-   ##
==========================================
- Coverage   56.55%   56.52%   -0.03%     
==========================================
  Files          57       57              
  Lines        3977     3945      -32     
==========================================
- Hits         2249     2230      -19     
+ Misses       1440     1433       -7     
+ Partials      288      282       -6
Impacted Files Coverage Δ
pkg/plugin/instance/libvirt/instance.go 47.38% <58.82%> (-1.28%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fcfc8d1...fed472d. Read the comment docs.

@ijc
Copy link
Author

ijc commented May 25, 2017

@chungers fixed and force pushed. I added a test case for that specific failure as well as for another I found having fixed the first one.

Ian Campbell added 5 commits May 30, 2017 11:19
Amongst other changes this fixed Domain.ListAllInterfaceAddresses() when there
are multiple interfaces.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This maps directly to the libvirtxml.Domain object which allows the user much
more flexibility and is more in line with other instance plugins.

Switch the example configuration to yml which is a little more readable.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Thus tries the qemu guest agent first (if it is running) and falls back to
interrogating the libvirt leases database (which is not available with
`qemu://session`).

Filters devices which have no addresses on them.

Modify the example configuration to add a network interface and the necessary
stanza to setup the virtio channel which is used by the guest agent.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This pulls in a single commit since v3.3.0
libvirt/libvirt-go@c3209e4
which improves compatibility with Go 1.5 resolving:

vendor/github.com/libvirt/libvirt-go/lxc.go:63: cannot use cfdlist (type *C.int) as type unsafe.Pointer in argument to func literal
vendor/github.com/libvirt/libvirt-go/lxc.go:85: cannot use coldfdlist (type *C.int) as type unsafe.Pointer in argument to func literal

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This is easier to work with in the context of libvirt than trying to assign IP
addresses. The network object should be configured with static mappings.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
@ijc
Copy link
Author

ijc commented May 30, 2017

Rebased, passed properties=true to DescribeInstances and added TestInvalidProperties to improve coverage.

Copy link
Contributor

@chungers chungers left a comment

Choose a reason for hiding this comment

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

Thanks! Waiting for the tests to pass before merging...

@ijc
Copy link
Author

ijc commented May 31, 2017

@chungers tests have passed ;-)

@chungers chungers merged commit aa4c34d into docker-archive:master May 31, 2017
@ijc ijc deleted the libvirt-updates branch June 7, 2017 17:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants