Commit Graph

794 Commits

Author SHA1 Message Date
Archana Shinde
c38792ef9e config: Add documentation for tcfilter in configuration.toml
Document this mode for users to be able to use it.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-24 13:38:57 -07:00
Archana Shinde
17be8e37f5 network: Introduce constants for the network model strings
Introduce constants for the network model strings, so as to
avoid using the strings directly at multiple places.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-24 13:37:54 -07:00
Archana Shinde
5da973d465 test: Add test to verify tc redirect
The test verifies tc filter setup by creating a test veth interface.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-24 10:46:02 -07:00
Archana Shinde
e20dbd04e0 network: Use tc redirect filter to redirect traffic to the VM
Introduce a new mode that uses tc filters to redirect traffic from
the network interface created by the network plugin to a
tap interface that we connect to the VM.
This mode will help support ipvlan as well.

Fixes #144

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-24 10:46:00 -07:00
zhangwei_cs
5a8b738818
Merge pull request #733 from caoruidong/qemu-ns
cli: add configuration option to use or not use host netns
2018-10-24 11:35:33 +08:00
Graham Whaley
f3ef220dce
Merge pull request #744 from jodh-intel/update-to-golang-1.10.4
versions: Update golang to 1.10.4
2018-10-23 14:56:11 +01:00
James O. D. Hunt
526d55b4af versions: Update golang to 1.10.4
Move to golang version 1.10.4 -- the oldest stable golang release at the
time of writing -- since golang 1.10+ is needed to make namespace
handling safe.

Re-ordered a couple of structs (moved `sync.WaitGroup` fields) to keep
the `maligned` linter happy. Previously:

``
virtcontainers/pkg/mock/cc_proxy_mock.go:24:18⚠️ struct of size 160 could be 152 (maligned)
virtcontainers/monitor.go:15:14⚠️ struct of size 80 could be 72 (maligned)
```

See:

- https://github.com/golang/go/issues/20676
- 2595fe7fb6

Also bumped `languages.golang.meta.newest-version` to golang version
1.11, which is the newest stable release at the time of writing.

Fixes #148.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-10-23 14:20:12 +01:00
James O. D. Hunt
62992f5485 versions: Update cri containerd version for golang 1.10.2 fix
Updated `externals.cri-containerd.version` in `versions.yaml` to the
newest version that includes the fix for building on golang 1.10.2:

- 8b0d53c09c

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-10-23 14:20:09 +01:00
Ruidong Cao
7a5a57d50f cli: test: add unit test for kata-env and kata-check
Add unit test for `disable_new_netns`

Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
2018-10-22 21:06:58 +08:00
Ruidong Cao
14e5437cae cli: add configuration option to use or not use host netns
If `disable_new_netns` set to true, create VM and shim processes in the host netns

Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
2018-10-22 21:06:58 +08:00
Ruidong Cao
6935279beb network: add new NetInterworkingModel "none" and endpoint type TapEndpoint
This model is for not creating a new net ns for VM and directly
creating taps in the host net ns.

Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
2018-10-22 21:06:58 +08:00
Ruidong Cao
f8f29622a4 virtcontainers: refactor hotplug qmp functions
Refactor these functions so differernt types of endpoints can use a unified
function to hotplug nics.

Fixes #731

Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
2018-10-22 21:06:56 +08:00
Archana Shinde
40ee885e8e
Merge pull request #846 from amshinde/marshal-net-endpoints
network: Marshal BridgedMacvlanEndpoint and MacvtapEndpoint
2018-10-19 11:37:09 -07:00
Archana Shinde
21d38e9948 network: Marshal BridgedMacvlanEndpoint and MacvtapEndpoint
These were skipped.
Fixes #842

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-19 09:29:24 -07:00
Julio Montes
4c82d526ee
Merge pull request #832 from lifupan/fix_blk
device: fix the issue of passing wrong device address using virtio-blk
2018-10-18 09:12:01 -05:00
James O. D. Hunt
b81131f4c0
Merge pull request #823 from jodh-intel/fix-default-bundle-path
create/run: Make bundle path default to cwd
2018-10-18 09:57:00 +01:00
Frank Cao
633f4567f3
Merge pull request #825 from jodh-intel/add-trace-to-remaining-api-funcs
virtcontainers: Add missing API trace calls
2018-10-18 16:53:30 +08:00
Graham Whaley
0a652a1ab8
Merge pull request #786 from linzichang/master
sandbox/virtcontainers: memory resource hotplug when create container.
2018-10-18 09:43:24 +01:00
Peng Tao
708007e42c
Merge pull request #830 from caoruidong/add-release
virtcontainers: Add missing API release calls
2018-10-18 15:24:26 +08:00
Zichang Lin
36306e283c sandbox/virtcontainers: modify tests relate to memory hotplug.
Signed-off-by: Clare Chen <clare.chenhui@huawei.com>
Signed-off-by: Zichang Lin <linzichang@huawei.com>
2018-10-17 23:01:13 -04:00
Ruidong Cao
3f39d6e807 virtcontainers: Add missing API release calls
Add missing release sandbox calls to network related functions in
virtcontainers API.

Fixes #732.

Signed-off-by: Ruidong Cao <caoruidong@huawei.com>
2018-10-18 06:58:04 +08:00
Julio Montes
daf52dec57
Merge pull request #813 from sboeuf/romfile
qemu: Disable the default romfile used by virtio-pci
2018-10-17 15:12:57 -05:00
fupan
b72a3cdcce device: fix the issue of passing wrong device address using virtio-blk
Kata agent expects the pci address to be passed and not the
virtPath in guest.

Fixes: #831

Signed-off-by: fupan <lifupan@gmail.com>
2018-10-17 20:15:34 +08:00
James O. D. Hunt
ee9275fedb virtcontainers: Add missing API trace calls
Add missing trace calls to remaining public virtcontainers API
functions.

Fixes #824.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-10-17 11:34:43 +01:00
James O. D. Hunt
8831245e30 create/run: Make bundle path default to cwd
The bundle path was documented as defaulting to the current directory
but was not being set to that value if not explicitly specified.

Also moved factory creation code to a new `handleFactory()` function to
avoid cyclomatic complexity issues.

Fixes #821.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2018-10-17 11:34:16 +01:00
Sebastien Boeuf
0ae5b142a6 qemu: Disable the default romfile used by virtio-pci
As we try to make sure we don't pull unneeded dependency when using
QEMU or NEMU as the hypervisor, and because SeaBIOS and OVMF firmware
already handle what's done by the default efi-virtio.rom binary, this
commit gets rid of this dependency by providing a default empty one.

Fixes #812

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2018-10-16 18:29:49 -07:00
Sebastien Boeuf
6f0873a2c3 vendor: Update govmm vendoring
Shortlog:

9c819db qemu: Fix virtio-net-pci QMP command
7fdfc6a qemu: Add support for romfile option
e74de3c Update guidelines on security issue reporting
ec83abe qemu: Add virtio-balloon device suppport.
4697078 qemu: Show full path to qemu binary at launch time

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2018-10-16 18:29:40 -07:00
Archana Shinde
d00742f43f
Merge pull request #811 from amshinde/network_refactor
Refactor network.go
2018-10-15 09:07:16 -07:00
Clare Chen
14f480af8f sandbox/virtcontainers: combine addResources and updateResources
addResources is just a special case of updateResources. Combine the shared codes
so that we do not maintain the two pieces of identical code.

Signed-off-by: Clare Chen <clare.chenhui@huawei.com>
2018-10-15 10:39:08 +08:00
Zichang Lin
8e2ee686bd sandbox/virtcontainers: memory resource hotplug when create container.
When create sandbox, we setup a sandbox of 2048M base memory, and
then hotplug memory that is needed for every new container. And
we change the unit of c.config.Resources.Mem from MiB to Byte in
order to prevent the 4095B < memory < 1MiB from being lost.

Depends-on:github.com/kata-containers/tests#813

Fixes #400

Signed-off-by: Clare Chen <clare.chenhui@huawei.com>
Signed-off-by: Zichang Lin <linzichang@huawei.com>
2018-10-15 10:37:29 +08:00
Archana Shinde
b04691e229 network: Collapse log calls for endpoint Attach and Detach
Log Attach, Detach, HotAttach and HotDetach at a single
location.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-11 14:45:57 -07:00
Archana Shinde
ab15498bdf network: Explicitly check for veth type
Explicitly check for "veth" intergace type while creating a
veth endpoint. Error out for unsupported network interfaces.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-11 14:45:57 -07:00
Archana Shinde
3c590b0e2c network: Rename VirtualEndpoint to VethEndpoint
As this really represents a veth pair rather than a generic
virtual interface, rename VirtualEndpoint to VethEndpoint.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-11 14:45:57 -07:00
Archana Shinde
df8f21d9fe network: Refactor network tests.
Split network_test.go into separate test files.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-11 14:45:57 -07:00
Archana Shinde
adcd9106f9 network: Refactor network.go
Split endpoint implementations into their own file.

Fixes #799

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-11 14:45:55 -07:00
Archana Shinde
7fb2706667
Merge pull request #814 from amshinde/fix-endpoint-indexing
network: Sort endpoints by name
2018-10-11 14:38:32 -07:00
Archana Shinde
8f1b28da34 network: Sort endpoints by name
Sort endpoints by name to control the order in which
they are passed to the VM as the interface name inside
the VM depends on the order in which it is passed.

Long term we should come up with a more robust approach.

Fixes #785

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-11 09:23:49 -07:00
Manohar Castelino
c3cfe8204a
Merge pull request #805 from sboeuf/fix_virt
virtcontainers: qemu: Add proper support for virt machine type
2018-10-03 17:19:07 -07:00
Archana Shinde
a0968ce1ce
Merge pull request #506 from amshinde/macvlan-support
network: Add support for macvlan and macvtap driver
2018-10-03 14:19:14 -07:00
Sebastien Boeuf
dffb4f96ae virtcontainers: qemu: Add proper support for virt machine type
The virt machine type provided by the NEMU project needs to be
supported the same way we support pc and q35 machine types.

First, this patch takes care of adding the hotpluggable block device
capability to this machine type, this way when using devicemapper, we
prevent the code from falling back on using 9pfs instead of SCSI.

It also add one or several bridges to this machine type, as the code
is tightly coupled to the fact that a bridge is required for PCI
hotplug.

At last, it changes the name of the PCI host bridge (main bus), to
use "pcie.0". The default set up from pc machine type "pci.0" is not
suitable for this machine type.

Fixes #804

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2018-10-03 10:04:02 -07:00
Archana Shinde
3c7cf589ad tests: Add additional network tests to verifu link creation functions
Add tests to verify bridge, tap and macvtap link creation.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-03 09:46:16 -07:00
Archana Shinde
378191a52c tests: Add tests for macvlan and macvtap endpoints
Add unit tests in network_test.go and qemu_arch_base_test.go
for macvlan and macvtap network endpoints.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-03 09:46:16 -07:00
Archana Shinde
def070d651 golint: Refactor to reduce cyclomatic complexity
Introduce function  getLinkForEndpoint to reduce cyclomatic
complexity.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-02 17:39:48 -07:00
Archana Shinde
417c1f07f9 macvtap: Add support for macvtap
Plugin may provide a macvtap interface. Add support for
directly attaching this to the VM.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-02 17:39:48 -07:00
Sebastien Boeuf
0de7572f7b vendor: Update govmm vendoring
Shortlog:

ef72505 qemu: Fix the support of PCIe bridge
56f645e qmp: add ExecuteQueryMigration
a429677 govmm: fix memory prealloc
1130aab qmp: add "query-cpus" support

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2018-10-02 17:15:14 -07:00
Archana Shinde
581ff17857 macvlan: Assign random MAC address
Macvtap interfaces require mac addresses to be unique even
though they may be in a separate namespace. Hence use a randomly
generate MAC address.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-02 16:23:50 -07:00
Archana Shinde
8847af8343 network: Add support for macvlan driver
Add support for macvlan driver by bridging it with a macvtap or
tap+bridge and moving the mac and ip address from the
macvlan to the bridged interface.

Fixes #162

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2018-10-02 16:23:50 -07:00
Sebastien Boeuf
c061fe1ff5
Merge pull request #802 from jcvenegas/fix-memory-update
memory: update: Update state using the memory removed
2018-10-02 15:23:11 -07:00
Jose Carlos Venegas Munoz
1f5792ecbb test: fix unit test nil pointer.
Add filesystem to qemu object.
Fix mock_hypervisor

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2018-10-02 15:58:08 -05:00
Jose Carlos Venegas Munoz
4697cf3c79 memory: update: Update state using the memory removed.
If the memory is reduced , its cgroup in the VM was updated properly. But the
runtime assumed that the memory was also removed from the VM.

Then when it is added more memory again, more is added (but not needed).

Fixes: #801

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2018-10-02 14:38:21 -05:00