Commit Graph

1760 Commits

Author SHA1 Message Date
Alice Frosi
a013f9b27b s390x: fix gofmt complain
Fix gofmt complain for virtcontainers/qemu_s390x.go

Fixes: #1553

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2019-04-17 14:10:09 +02:00
Stefan Hajnoczi
53ebe51f1c build: fix race between 'clean' and generated files
When a parallel build is invoked using "make -j4" there is a race
between EXTRA_DEPS ('clean') and generating files:

  CPU1                             CPU2
  ----                             ----
  create cli/generated-config.go
                                   rm cli/generated-config.go
  go build -> error: generated-config.go doesn't exist!

Previous commits ensured that targets relying on version information
like VERSION and COMMIT declare appropriate dependencies.  Therefore
make is now able to detect changes and rebuild targets as needed.  It is
no longer necessary to abuse the clean target to force a rebuild.

Fixes: #1540
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-04-17 11:59:10 +01:00
Stefan Hajnoczi
7949cd6ebc build: turn COMMIT into a file dependency
Makefile uses $(shell) to build a git commit string.  Unfortunately this
means make targets cannot be rebuilt when COMMIT changes value.  We need
to reflect this string value into files on which make can process
dependencies.

I stole a solution from QEMU's Makefile:
1. Print the string into .git-commit.tmp
2. If .git-commit.tmp differs from .git-commit, copy it to .git-commit
3. Depend on .git-commit from all targets that need $COMMIT

This way targets are only rebuilt if the commit string value actually
changes.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-04-17 11:59:10 +01:00
Stefan Hajnoczi
0f7bb25cf7 build: extract config-generated.go.in from Makefile
Makefile had a template for cli/config-generated.go embedded inside it.
There is already a templating mechanism for .in files.  Using a .in file
is cleaner since it avoids make's awkward interaction with shell
escaping and line splitting.

This patch moves the template into cli/config-generated.go.in and reuses
the existing .in file templating mechanism.  Only the PKGRUNDIR variable
needs to be added.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-04-17 11:59:10 +01:00
Stefan Hajnoczi
1eb5d6c900 build: use MAKEFILE_LIST for a more complete Makefile dependency
Depending on Makefile is not enough to detect all changes.  We must
rebuild when included makefiles change, too.

The MAKEFILE_LIST special variable contains the filenames of all
included makefiles and Makefile itself.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-04-17 11:26:24 +01:00
Stefan Hajnoczi
bbf92533f4 build: add VERSION dependency to netmon target
The netmon target must be rebuilt when the VERSION file changes since it
uses the value of VERSION on the build command-line.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-04-17 11:26:00 +01:00
Stefan Hajnoczi
b20fd9d10e build: remove duplicated COLLECT_SCRIPT from clean
GENERATED_FILES already includes COLLECT_SCRIPT, so there's no need to
specify it again:

  GENERATED_FILES += $(COLLECT_SCRIPT)
  ...
  clean:
    $(QUIET_CLEAN)rm -f ... $(GENERATED_FILES) $(COLLECT_SCRIPT)

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-04-17 11:26:00 +01:00
Fupan Li
5d875be274
Merge pull request #1409 from teawater/vmcache_templating
factory: Make VMCache and VM templating can work together
2019-04-16 23:56:08 +08:00
Peng Tao
168665b9a7
Merge pull request #1439 from YongjiXie/pass-correct-mount-type-for-ephemeral-volumes
agent: pass correct mount type to agent for ephemeral volumes
2019-04-16 15:36:14 +08:00
Archana Shinde
edc77a0263
Merge pull request #1502 from amshinde/make-tc-default
network: Make tcfilter model as default
2019-04-15 11:34:07 -07:00
Archana Shinde
385268226f network: Change the package level network default
Change the package level default network model to tcfilter.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-04-15 09:34:58 -07:00
Archana Shinde
33bae7053f network: Make tcfilter model as default
tcfilter requires no changes to the interface provided by the network
plugin and supports a larger set of plugins.

Fixes #1501

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-04-15 09:34:58 -07:00
Sebastien Boeuf
d75e7fc8ca
Merge pull request #1524 from amshinde/fix-netmon-routes-cidr
netmon: Fix bug in how routes are converted
2019-04-15 08:38:15 -06:00
Fupan Li
2b45f0b2fd
Merge pull request #1528 from bergwolf/grpc
shimv2 should return grpc error codes
2019-04-15 09:50:10 +08:00
Hui Zhu
343a0d35fe factory: Make VMCache and VM templating can work together
Make VMCache and VM templating can work together.

Fixes: #1376

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-04-13 21:07:39 +08:00
zhangwei_cs
fae022dc64
Merge pull request #1428 from gabibeyer/slashNburn
Deprecate hyperstart, CC shim, and CC proxy
2019-04-13 11:06:23 +08:00
Hui Zhu
6e5957830e
Merge pull request #1530 from devimc/topic/virtcontainers/inheritParentCpuCgroup
virtcontainers: inherit parent's CPU constraint
2019-04-13 08:36:26 +08:00
Gabi Beyer
b08ab6ae1f vc: modify ioctl function to handle shim test
The kata shim tests make use of an ioctl function, so instead
of having a custom one within that file, use the ioctl
function in utils/utils_linux

Fixes #1419

Signed-off-by: Gabi Beyer <Gabrielle.n.beyer@intel.com>
2019-04-12 10:48:08 -07:00
Gabi Beyer
c42507903d vc: Deprecate CC proxy and shim
Clear Containers proxy and shim are no longer supported. This
was mentioned in issue #1113. Their functionalities are thus
removed from the runtime.

Fixes #1419

Signed-off-by: Gabi Beyer <gabrielle.n.beyer@intel.com>
2019-04-12 10:48:08 -07:00
Gabi Beyer
c658770891 vc: remove virtc api cli
previously used as a small api client for virtcontainers, virtc
no longer needed.

Fixes #1419

Signed-off-by: Gabi Beyer <gabrielle.n.beyer@intel.com>
2019-04-12 10:48:08 -07:00
Gabi Beyer
d4ef9c05d7 vc: deprecate hyperstart agent
The hyperstart agent has not been supported in kata since 2.1,
so remove it as a component to kata. Mentioned in issue #1113.

Fixes: #1419

Signed-off-by: Gabi Beyer <gabrielle.n.beyer@intel.com>
2019-04-12 10:48:06 -07:00
Julio Montes
d5a759e1cf
Merge pull request #1526 from bergwolf/ut-non-root
fix ut failure due to incorrect cleanup and make it runnable with non-root
2019-04-12 12:44:33 -05:00
Archana Shinde
8abd2ec53f netmon: Fix bug in how routes are converted
The agent expects a IP CIDR for the route destination
rather than an IP address. netmon was incorrectly
converting route dest to an IP address and hence
exiting with an error.

We did not have an integration test for netmon with tcfilter mode.
macvtap mode did not uncover this, as with macvtap routes are
not really passed to the agent.
We delete the IP on the veth device, and netmon looks at the
routes after the IP is deleted with macvtap.

Fixes #1523

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-04-12 09:42:47 -07:00
Archana Shinde
9b622b7e77
Merge pull request #1485 from awprice/k8s-empty-dir-local
storage: create k8s emptyDir inside VM
2019-04-12 08:29:18 -07:00
Julio Montes
59e3956397 virtcontainers: inherit parent's CPU constraint
Don't set a default CPU constraint if period and quota are not specified, that
way the container will inherit the CPU constraint from its parent. Container
creation won't fail if the parent CPU constraint is smaller than the default
number of vCPUs.

fixes #1521

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-04-12 08:59:25 -05:00
Julio Montes
d99693a564
Merge pull request #1518 from lifupan/fixtop
virtcontainers: prepend a kata specific string to host cgroups path
2019-04-12 08:58:38 -05:00
Julio Montes
e15f3e4938
Merge pull request #1337 from jongwu/bypass
Factory: enable template feature for arm64
2019-04-12 07:03:48 -05:00
Peng Tao
f5125421d0 sandbox: return ErrNoSuchContainer when failing to find a container
So that caller can determine that it is ENOENT-alike error.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-12 03:57:07 -07:00
Peng Tao
8215a3ce9a shimv2: convert vc errors to grpc errors
containerd checks for the grpc error code to determine
correct recover action upon grpc errors. We need to provide
them properly.

Unfortunately ttrpc doesn't support grpc interceptor so we have
to modify every service function for it.

Fixes: #1527

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-12 03:57:01 -07:00
Peng Tao
cf90751638 vc: export vc error types
So that shimv2 can convert it into grpc errors.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-12 02:01:02 -07:00
Peng Tao
9040f6a8cd ut: fix UT failure due to incorrect cleanup
cleanup() actually removes all things under testdir and
causes UT failures.

=== RUN   TestCreateMockSandbox
ERRO[0000] Create new sandbox failed                     error="QEMU path (/tmp/vc-tmp-007004370/hypervisor) does not exist" sandbox=7f49d00d-1995-4156-8c79-5f5ab24ce138 sandboxid=7f49d00d-1995-4156-8c79-5f5ab24ce138 source=virtcontainers subsystem=sandbox
exit status 1

Fixes: #1525

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-11 23:33:57 -07:00
Peng Tao
a0f49a91e4 ut: fix UT failure due to non-root
We should allow UT to run without root.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-11 23:21:27 -07:00
lifupan
1a1f93bc78 virtcontainers: add a kata specific prefix to host cgroups path
prepend a kata specific string to oci cgroup path to
form a different cgroup path, thus cAdvisor couldn't
find kata containers cgroup path on host to prevent it
from grabbing the stats data.

Fixes:#1488

Signed-off-by: lifupan <lifupan@gmail.com>
2019-04-12 10:30:19 +08:00
Sascha Grunert
e26f342e00
build: Update golang to 1.12.3
This commit bumps the golang version to remove the go modules hash
mismatch between 1.11 and 1.12.

Fixes: #1520

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-04-11 15:41:41 +02:00
Fupan Li
da08b3afc9
Merge pull request #1509 from bergwolf/kata-check
cli: fix kata-check test
2019-04-11 20:13:24 +08:00
Julio Montes
c08976e1a2
Merge pull request #1494 from lifupan/fixstop
shimv2: fix the issue of stop container failed
2019-04-11 07:10:49 -05:00
Julio Montes
dd5c6aa757
Merge pull request #1507 from bergwolf/state
split sandbox/container state
2019-04-11 07:09:23 -05:00
lifupan
f7223c6f00 shimv2: fix the issue of stop container failed
There is no need to send another SIGKILL signal following
SIGTERM signal, otherwise, sending the SIGKILL signal would
get failed since the container process would has been terminated
by the previous SIGTERM signal.

Fixes:#1493

Signed-off-by: lifupan <lifupan@gmail.com>
2019-04-11 18:01:23 +08:00
Fupan Li
6d81e44670
Merge pull request #1437 from teawater/vmcache_grpc
Make factory can control VMCache server
2019-04-11 14:01:47 +08:00
Alex Price
76c4639ada storage: create k8s emptyDir inside VM
This introduces a new storage type: local. Local storage type will
tell the kata-agent to create an empty directory in the sandbox
directory within the VM.

K8s host emptyDirs will then use the local storage type and mount it
inside each container. By doing this, we utilise the storage medium
that the sandbox uses. In most cases this will be 9p.

If the VM is using device mapper for container storage, the containers
will benefit from the better performance of device mapper for
host emptyDir.

Fixes #1472

Signed-off-by: Alex Price <aprice@atlassian.com>
2019-04-11 09:01:58 +10:00
Julio Montes
6ab15ab890
Merge pull request #1511 from bergwolf/spawner
vc: remove spawner
2019-04-10 08:33:10 -05:00
Julio Montes
baa30b4fd0
Merge pull request #1460 from alicefr/golangci-lint
s390x: fix golangci-lint complains
2019-04-10 07:53:41 -05:00
Peng Tao
40f2a03c85
Merge pull request #1491 from teawater/factory_leak
qemu: Remove the storage directories if qemu get from the factory
2019-04-10 20:14:17 +08:00
Jianyong Wu
98687a3463 Template: enable template for arm64
Now, template feature can't work on arm64. When using bypass-shared-memory
cap to saving sandbox as a template, new sandbox cloning from the template
will fail. From initial investigation, it maybe a qemu issue. Further
research should be done.
To enable template on arm64, this patch adds a switch to offer the capability
to open or close the bypass-shared-memory cap.
While closing bypass-shared-memory cap, saving vm will occupy more space
and consume more time. So increase 300M for mount size and bump the time
waiting for migration to 10 seconds.

Fixes: #1336

Signed-off-by: Jianyong Wu  <jianyong.wu@arm.com>
2019-04-10 05:30:59 -04:00
Hui Zhu
d63b7c92a8
Merge pull request #1496 from lifupan/fixproxy
katautils: fix the issue of missing proxy debug config
2019-04-10 13:59:33 +08:00
Hui Zhu
16fe8553af qemu: Remove the storage directories if qemu get from the factory
Store related in directory /var/lib/vc/sbs and /run/vc/sbs if
vm template is enabled.
The cause is NewVM and NewVMFromGrpc will create vcStore with
VM's ID and set it as store of hypervisor if the factory is enabled.

This commit record the VM's ID to HypervisorConfig.VMid and remove
directories in qemu.cleanupVM to handle the issue.

Fixes: #1452

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-04-10 11:11:45 +08:00
Hui Zhu
ace81155a4 factory: Make factory status can show status of VMCache server
This commit adds a new gRPC function Status to CacheService.  VMCache
server will reply the status of VMCache server.
Factory destroy will call gRPC Status to get the status of VMCache
server and output it when VMCache is enabled.

Fixes: #1395

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-04-10 11:03:14 +08:00
Hui Zhu
f639787e02 factory: Make factory destroy can stop VMCache server
VMCache server just can be stopped by ctrl-c without current commit.

This commit adds a new gRPC function Quit to CacheService.  VMCache
server will stop by itself after 1 second when Quit is called.
Factory destroy will call gRPC Quit when VMCache is enabled.

Fixes: #1395

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-04-10 11:03:14 +08:00
Hui Zhu
3343e9f7b3
Merge pull request #1498 from devimc/topic/vendor/govmm
vendor: update govmm
2019-04-10 10:22:33 +08:00
Peng Tao
9ac68310f7 cli: fix kata-check test
We don't really require nested nor unrestricted_guest to run. And there
is no point validating host cpu properties in UT.

Fixes: #1508

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-09 19:00:38 -07:00