Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

qemu: use x-ignore-shared to implement vm template #1799

Merged
merged 1 commit into from
Jul 18, 2019

Conversation

bergwolf
Copy link
Member

@bergwolf bergwolf commented Jun 14, 2019

As we want to move to upstream qemu, we should drop as many private qemu patches as possible. One big change we carry with qemu-lite is the migration bypass-shared-memory patch. Qemu 4.0 already has a x-ignore-shared migration capability. With a small change to it, we can make it work similar to bypass-shared-memory and thus get rid of the private qemu patch. Then we can use x-ignore-shared instead of bypass-shared-memory to implement the VM template feature.

@bergwolf bergwolf added the do-not-merge PR has problems or depends on another label Jun 14, 2019
@devimc
Copy link

devimc commented Jun 14, 2019

@bergwolf govmm pr was merged

@bergwolf
Copy link
Member Author

@devimc Thanks. It still needs to wait for the qemu patch which is being reviewed on the qemu mailing list though.

@raravena80
Copy link
Member

@bergwolf ping, any updates on the qemu patch?

@bergwolf
Copy link
Member Author

@raravena80 I asked Dave and he said the patch will be included in the next qemu migration pull request. Once that is done, I'll move forward the kata side changes.

bergwolf added a commit to bergwolf/kata-packaging that referenced this pull request Jul 17, 2019
Then we can use x-ignore-shared to do migration and drop the
extra patch once we move to qemu 4.1.0 or later.

Fixes: kata-containers#640
Depends-on: github.com/kata-containers/runtime#1799
Signed-off-by: Peng Tao <[email protected]>
@bergwolf bergwolf removed the do-not-merge PR has problems or depends on another label Jul 17, 2019
@bergwolf
Copy link
Member Author

Dropping dnm as the qemu patch has been merged upstream.

@bergwolf
Copy link
Member Author

/test

@codecov
Copy link

codecov bot commented Jul 17, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@bc15e44). Click here to learn what that means.
The diff coverage is 0%.

@@            Coverage Diff            @@
##             master    #1799   +/-   ##
=========================================
  Coverage          ?   52.41%           
=========================================
  Files             ?      108           
  Lines             ?    13976           
  Branches          ?        0           
=========================================
  Hits              ?     7325           
  Misses            ?     5781           
  Partials          ?      870

@codecov
Copy link

codecov bot commented Jul 17, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@bc15e44). Click here to learn what that means.
The diff coverage is 27.9%.

@@            Coverage Diff            @@
##             master    #1799   +/-   ##
=========================================
  Coverage          ?   52.56%           
=========================================
  Files             ?      108           
  Lines             ?    13982           
  Branches          ?        0           
=========================================
  Hits              ?     7349           
  Misses            ?     5762           
  Partials          ?      871

Copy link
Contributor

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

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

Thanks @bergwolf. I appreciate this isn't strictly required since you're refactoring code that was already there, but could you consider adding a few unit tests?

@@ -585,6 +584,85 @@ func (q *qemu) vhostFSSocketPath(id string) (string, error) {
return utils.BuildSocketPath(store.RunVMStoragePath, id, vhostFSSocket)
}

func (q *qemu) setupVirtiofsd(timeout int) (remain int, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if timeout < 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

timeout is internal and never changed before reaching here. I'm not against validating it but what is the place to do the validation along the call stack? That said, we do make sure it is non-negative when changing it below.

// connection with QEMU closes. Therefore we do not keep track
// of this child process after returning from this function.
sourcePath := filepath.Join(kataHostSharedDir, q.id)
args := []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

This function does three things:

  1. constructs arguments.
  2. goroutine and channel logic.
  3. adjusts the timeout.

If you broke it into sub-functions for (atleast) (1) and (3), you could add some simple unit tests for those.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I'll add some UTs for it.

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've split the function and added UTs. PTAL.

qemu upstream has x-ignore-shared that works similar
to our private bypass-shared-memory. We can use it to
implement the vm template feature.

Fixes: kata-containers#1798
Depends-on: github.com/kata-containers/packaging#641
Signed-off-by: Peng Tao <[email protected]>
@bergwolf
Copy link
Member Author

/test

Copy link
Contributor

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

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

Thanks @bergwolf.

lgtm

@chavafg
Copy link
Contributor

chavafg commented Jul 17, 2019

Found this error on the nemu job:

08:01:03 [2] run container with docker 
08:01:03 [2]   in background, interactive and with a tty
08:01:03 [2]   /tmp/jenkins/workspace/kata-containers-runtime-ubuntu-nemu/go/src/github.com/kata-containers/tests/vendor/github.com/onsi/ginkgo/extensions/table/table_entry.go:46
08:01:03 [2] Running command '/usr/bin/docker [docker run --cidfile /tmp/cid577675508/StgN2Yo5CpBsjk77tAl8OrYVzfbSs2 --runtime kata-runtime --name StgN2Yo5CpBsjk77tAl8OrYVzfbSs2 -dit busybox sh]'
08:01:43 [2] command failed error 'exit status 125'
08:01:43 [2] [docker run --cidfile /tmp/cid577675508/StgN2Yo5CpBsjk77tAl8OrYVzfbSs2 --runtime kata-runtime --name StgN2Yo5CpBsjk77tAl8OrYVzfbSs2 -dit busybox sh]
08:01:43 [2] Timeout: 120 seconds
08:01:43 [2] Exit Code: 125
08:01:43 [2] Stdout: 8aa0465c28a1c978c76de03840ffe08b48e360215857ef715ef8ecf61f0dc973
08:01:43 [2] 
08:01:43 [2] Stderr: docker: Error response from daemon: OCI runtime create failed: nemu-system-x86_64: -device vhost-user-fs-pci,chardev=char-07b3b750745d5889,tag=kataShared,cache-size=1024M: Failed to read msg header. Read 0 instead of 12. Original request 1.
08:01:43 [2] nemu-system-x86_64: -device vhost-user-fs-pci,chardev=char-07b3b750745d5889,tag=kataShared,cache-size=1024M: vhost_dev_init failed: Operation not permitted: unknown.

restarted job

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants