Commit Graph

2271 Commits

Author SHA1 Message Date
Julio Montes
2c310fecd4 virtcontainers: handle persistent memory volumes
A persistent memory volume MUST meet the following conditions:
* A loop device must be mounted in the directory passed as volume
* The loop device must have a backing file
* The backing file must have the PFN signature at offset 4k [1][2]

The backing file is used as backend file for a NVDIMM device in the guest

fixes #2262

[1] - https://github.com/kata-containers/osbuilder/blob/master/image-builder
/nsdax.gpl.c
[2] - https://github.com/torvalds/linux/blob/master/drivers/nvdimm/pfn.h

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 15:02:01 +00:00
Julio Montes
434b30255e virtcontainers: hotplug block drives that are pmem devices as nvdimm
hotplug as NVDIMM devices the block drives that can be used as pmem devices
(`Pmem=true`), the host path to such devices is a raw file that contains
the PFN signature.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 15:02:01 +00:00
Julio Montes
84e0ee13c8 virtcontainers: reimplement createBlockDevices
Reimplement `createBlockDevices` to identify possible volumes that can be
used as pmem devices

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 15:02:01 +00:00
Julio Montes
abbdf078cd virtcontainers: add Pmem attribute to BlockDrive
A `BlockDrive` can be used as pmem device, since they both are similar and
can be mounted in the same way in the guest. The `Pmem` attribute helps kata
to identify a pmem device and how it has to be hotplugged in the guest.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 15:02:01 +00:00
Julio Montes
ee941e5c56 virtcontainers: Implement function to get the pmem DeviceInfo
Implement function to get the pmem `DeviceInfo` from a volume.
`PmemDeviceInfo` return a new `DeviceInfo` object if a volume has a loop device
as backend and the backing file for such loop device contains the PFN signature,
needed to enable DAX in the guest.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 15:02:01 +00:00
Julio Montes
9ff44dba87 virtcontainers: implement function to get the backing file
Implement function the get the backing file from a loop device.
The backing file can be used as backend file for a NVDIMM device in the guest

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 15:02:01 +00:00
Julio Montes
0a4e2edcf4 virtcontainers: move GetDevicePathAndFsType to utils_linux
`GetDevicePathAndFsType` is a function to get the path and filesystem type
of a mount point from `/proc/mounts`.
Move `GetDevicePathAndFsType` to utils_linux since it's linux specific
and that way it can be used in other subpackages.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 13:56:40 +00:00
Julio Montes
2c7f27ec4f vendor: update govmm
bring `pmem` option to pmem/nvdimm devices

shortlog:
qemu: add pmem flag to memory-backend-file

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-03-20 13:45:58 +00:00
Graham Whaley
aa0d4ee0e8
Merge pull request #2512 from Pennyzct/FC_mount_noexec
Jailer: checking whether chrootBasedir is mounted `noexec`
2020-03-19 09:35:12 +00:00
Penny
e433719f47
Merge pull request #2390 from dong-liuliu/xliu2/vhost-user-blk
Assign vhost-user-blk device to Kata container as ephemeral or persistent storage #2380
2020-03-19 10:00:53 +08:00
GabyCT
0329dbb5aa
Merge pull request #2534 from bergwolf/1.11.0-alpha1-branch-bump
# Kata Containers 1.11.0-alpha1
2020-03-18 10:13:15 -06:00
Penny Zheng
00da1270be unit-test: refine related unit tests
We need to refine related unit tests.

Fixes: #2511

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-03-17 05:22:00 +00:00
Penny Zheng
13390df005 Jailer: re-mount jailerRoot with exec
The default chrootBaseDir "/run/vc" in many distributions is mounted
with `noexec` flag, which will bring 'permission denied' error
when running kata-containers with jailer.
Therefore, we decided to remount the jailerRoot dir with exec when setting
up a new firecracker sandbox and umount it when cleaning up.

Fixes: #2511

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-03-17 04:10:33 +00:00
Penny Zheng
9d3022a85a mount: modify func bindMount
originally, we forcefully set any bind-mount with `private` propagation
type, and it's not applied for all scenarios. e.g. we need to provide
`slave` or `shared` propagation type for bind-mounts in setting up jail
house.
Here, we add another parameter `pgtype` in func bindMount for providing
customized propagation parameters.

Fixes: #2511

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-03-17 04:10:28 +00:00
Archana Shinde
aaa4e5c661
Merge pull request #2529 from likebreath/clh_remove_deadcode
clh: Remove dead-code on maxClhVcpus
2020-03-16 11:07:10 -07:00
Peng Tao
17a92aed6f release: Kata Containers 1.11.0-alpha1
- README: logging: add shimv2 information
- vc: add agent.container_pipe_size annotation
- clh: set rootfstype
- logging: reduce default log level to Warn from Info
- vc: Remove container share dir when stopping
- clh: enable CPU hotplug
- clh: add 'APIsocket' to persist HypervisorState
- vc: Use BlockIndexMap instead of BlockIndex
- vendor: update agent client
- cri-o: fix netns mount point leaking from cri-o
- cli: add virtioFsDaemon to kata-env
- qemu: pass rootfs image in readonly mode
- Fix rescan PCI conflicts with shpchp / pciehp
- clh: Fix version check
- Implement cgroup manager
- vc: do not follow symlink when umounting contanier host path

4ce44ab0 clh: set rootfstype
4c287173 vc: add agent.container_pipe_size annotation
eee4d701 katutils: logging: default log level to Warn
913d1530 cli: logging: Default to Warn level
2cd0c885 README: logging: add shimv2 information
ed431175 vc: Remove container share dir when stopping
17b9de14 clh: enable CPU hotplug
63c7ac5b clh: add 'APIsocket' to persist HypervisorState
e9a46580 vc: Use BlockIndexMap instead of BlockIndex
376c4252 cli: add virtioFsDaemon to kata-env.
171eb705 qemu: use govmm vhost user device types directly
c6cc8b93 virtcontainers: support lazy attach devices
46392945 qemu: pass guest image file readonly
63fdf532 vendor: update govmm dependency
7427fea8 dnm: vendor: update agent client
ea82922a virtcontainers/pkg/cgroups: implement cgroup manager
03cdf6c4 virtcontainers: add new package for cgroups
33459779 clh: update minimal supported version to check.
20332298 clh: Fix version check
0da10105 version-update: version update for cri-o and k8s
5f9a77cc vc: validate container path when cleaning up
5bf32312 vc: do not follow symlink when umounting contanier host path

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-03-16 12:39:48 +00:00
Bo Chen
94298dd15c clh: Remove dead-code on maxClhVcpus
Our CLH driver in kata defines its own constant variable 'maxClhVcpus'
which can conflict with the maximum number of vCPUs specified from the
kata configuration file 'clh.config.DefaultMaxVCPUs'. As the value from
kata configuration file is preferred anyway and the code on 'maxClhVcpus'
is not being used. We'd better remove it for better readability and
avoiding further confusions.

Fixes: #2528

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-03-13 13:02:22 -07:00
GabyCT
ee01fa82b5
Merge pull request #2521 from grahamwhaley/20200310_shimv2_logs
README: logging: add shimv2 information
2020-03-12 09:02:23 -06:00
Liu Xiaodong
126fa157a3 agent: append and handle vhost-user-blk device
Kata-runtime can append vhost-user-blk device to the
device list of a container. And handle volumes who is
a block device and in VhostUserBlk type.

The vhost-user-blk device will be identified by its
PCI address by Kata-agent inside VM.

Fixes: #2380

Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
2020-03-12 03:42:02 -04:00
Liu Xiaodong
cf066b75ac devices: hotplug vhost-user-blk device to qemu
vhost-user-blk device can be hotplugged or hotremoved
by QMP commands.

Fixes: #2380

Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
2020-03-12 03:41:59 -04:00
Liu Xiaodong
3696318436 devices: filter vhost-user-blk/scsi device
Reserved number of Linux device number 241 and 242
are used to identify vhost-user-blk and vhost-user-scsi
devices.
for example, after command:
mknod <Vhost-User-Dir>/block/devices/vhost-dev0 b 241 0
this node will be recognized as vhost-user-blk device.

Fixes: #2380

Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
2020-03-12 03:41:55 -04:00
Liu Xiaodong
54b24dad4d devices: add vhost-user storage configuration
Two parameters are used to set in toml file:

1. Set "enable_vhost_user_store = true" to indicate
that vhost-user storage device feature is enabled.

2. Set "vhost_user_store_path = <Vhost-User-Dir>".
vhost-user socket files will be under
"<Vhost-User-Dir>/block/sockets/"; and device node
for vhost-user device will be under
"<Vhost-User-Dir>/block/devices/"
The default value of "vhost_user_store_path" is
"/var/run/kata-containers/vhost-user/".

Fixes: #2380

Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
2020-03-11 21:18:29 -04:00
Julio Montes
511dc4a0e4
Merge pull request #2510 from awprice/issue-2467
vc: add agent.container_pipe_size annotation
2020-03-11 11:20:16 -06:00
Jose Carlos Venegas Munoz
aa40eeffe6
Merge pull request #2525 from jcvenegas/fix-ext2-warn
clh: set rootfstype
2020-03-11 08:57:46 -06:00
Jose Carlos Venegas Munoz
4ce44ab067 clh: set rootfstype
set rootfstype=ext4 to make kernel not do print errros like:

```
Mount option "data=ordered" incompatible with ext2
```

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

Fixes: #2524

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2020-03-11 12:49:13 +00:00
Alex Price
4c28717335 vc: add agent.container_pipe_size annotation
This adds the `agent.container_pipe_size` annotation which allows
configuration of the size of the pipes for stdout/stderr for containers
inside the guest.

fixes #2467

Signed-off-by: Alex Price <aprice@atlassian.com>
2020-03-11 21:04:26 +11:00
Fupan Li
5717da9262
Merge pull request #2523 from grahamwhaley/20200310_log_warn
logging: reduce default log level to Warn from Info
2020-03-11 09:23:44 +08:00
Graham Whaley
eee4d7012d katutils: logging: default log level to Warn
Set the katautils default log level to 'Warn', rather than 'Info',
as 'Info' is rather noisy.

Fixes: #2522

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2020-03-10 18:28:18 +00:00
Graham Whaley
913d1530fb cli: logging: Default to Warn level
Set the default log level explicitly to 'Warn', rather than taking
the logrus default (which is normally 'Info').

Fixes: #2522

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2020-03-10 18:28:18 +00:00
Graham Whaley
2cd0c88574 README: logging: add shimv2 information
The shimv2 runtime logs slightly differently - let's clarify
that in the existing OCI/CRI-O only runtime section.

Fixes: #2520

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2020-03-10 16:01:47 +00:00
Julio Montes
a5436627f5
Merge pull request #2517 from darfux/remove_ctr_share_dir_when_stop
vc: Remove container share dir when stopping
2020-03-10 08:10:44 -06:00
Li Yuxuan
ed43117554 vc: Remove container share dir when stopping
Remove the rootfs bind dest and finally remove the created share
directory when stopping the container.

Fixes #2516
Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2020-03-10 01:12:30 +08:00
Jose Carlos Venegas Munoz
2656d1da22
Merge pull request #2509 from likebreath/hotplug_cpu
clh: enable CPU hotplug
2020-03-09 09:01:55 -06:00
Bo Chen
17b9de140f clh: enable CPU hotplug
With the HTTP API 'vm.resize()', the CPU hotplug with CLH is much simpler
comparing with QEMU. This is because we don't need to distinguish adding from
removing CPUs.

Fixes: #2495

Depends-on: github.com/kata-containers/packaging#968
Depends-on: github.com/kata-containers/tests#2364

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-03-06 11:26:58 -08:00
Jose Carlos Venegas Munoz
8cffbde514
Merge pull request #2507 from likebreath/fix-persist-clh
clh: add 'APIsocket' to persist HypervisorState
2020-03-04 16:45:09 -06:00
Bo Chen
63c7ac5bbe clh: add 'APIsocket' to persist HypervisorState
The 'apiSocket' member in the CloudHypervisorState struct needs to be kept
across different executions of kata-runtime with persist HypervisorState, so
that kata-runtime can talk with the same running cloud-hypervisor through
HTTP/REST API calls.

Fixes: #2506

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-03-04 09:15:36 -08:00
Julio Montes
83eef430bd
Merge pull request #2008 from darfux/use_block_index_map_instead
vc: Use BlockIndexMap instead of BlockIndex
2020-03-04 09:34:35 -06:00
Penny
e94cf0f135
Merge pull request #2454 from jcvenegas/fix-2453
vendor: update agent client
2020-03-03 17:11:17 +08:00
Penny
e0a4515609
Merge pull request #2458 from Pennyzct/netns_leak_on_crio
cri-o: fix netns mount point leaking from cri-o
2020-03-03 13:06:11 +08:00
Li Yuxuan
e9a46580b1 vc: Use BlockIndexMap instead of BlockIndex
This allows to reuse detached block index and ensures that the
index will not reach the limit of device(such as `maxSCSIDevices`)
after restarting containers many times in one pod.

Fixes: #2007
Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2020-03-03 10:30:18 +08:00
GabyCT
a1dcaac9ed
Merge pull request #2492 from jongwu/env
cli: add virtioFsDaemon to kata-env
2020-03-02 09:39:30 -06:00
Jianyong Wu
376c42523a cli: add virtioFsDaemon to kata-env.
virtiofsd should be added in kata-env as virtiofs enabled kata then
it will be easy to get the info of virtiofsd from kata-env.

Fixes: #2491
Change-Id: I37ff58ed4315344d1e2b87f3abcd04311661e910
Jira: ENTOS-1579
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2020-03-02 11:37:41 +08:00
Fupan Li
6bed2a724d
Merge pull request #2477 from bergwolf/ro
qemu: pass rootfs image in readonly mode
2020-02-26 19:22:13 +08:00
Fupan Li
fde6447c16
Merge pull request #2461 from Jimmy-Xu/support-lazy-attach-device
Fix rescan PCI conflicts with shpchp / pciehp
2020-02-26 17:49:35 +08:00
Peng Tao
171eb70564 qemu: use govmm vhost user device types directly
For one thing, we should not make kata's internal device type
exactly as govmm string by string.

For another thing, latest govmm changes the device driver strings
and it breaks kata in such a way but the fault is on kata side IMHO.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-02-26 00:33:55 -08:00
Jimmy Xu
c6cc8b93f9 virtcontainers: support lazy attach devices
- support attach large bar space vfio devices after create container

fixes #2460

Signed-off-by: Jimmy Xu <junming.xjm@antfin.com>
2020-02-26 11:56:07 +08:00
Peng Tao
46392945c6 qemu: pass guest image file readonly
So that we fobid guest from making changes to it.

Fixes: #2476
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-02-25 18:46:26 -08:00
Peng Tao
63fdf5328f vendor: update govmm dependency
To include block readonly capability. Included commits:

3700c55 qemu: add block device readonly support
88a25a2 Refactor code to support multiple virtio transports at runtime
2ee53b0 qemu: Don't set ".cache-size=" when CacheSize is 0

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-02-25 18:46:26 -08:00
Jose Carlos Venegas Munoz
7427fea864 dnm: vendor: update agent client
changes:
367b5296e protocols: client: Add timeout for hybrid vsock handshake

Fixes: #2453

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2020-02-25 21:16:32 +00:00
GabyCT
18b21eb6ca
Merge pull request #2490 from jcvenegas/fix-2489
clh: Fix version check
2020-02-25 14:53:58 -06:00