提交 209ada69 编写于 作者: Z zhangsong34

iSulad: support syscontainer without external rootfs

Signed-off-by: Nzhangsong34 <zhangsong34@huawei.com>
上级 eefff013
......@@ -248,7 +248,7 @@ static int send_signal_to_process(pid_t pid, unsigned long long start_time, uint
static int umount_dev_tmpfs_for_system_container(const container_t *cont)
{
if (cont->hostconfig != NULL && cont->hostconfig->system_container) {
if (cont->hostconfig != NULL && cont->hostconfig->system_container && cont->hostconfig->external_rootfs != NULL) {
char rootfs_dev_path[PATH_MAX] = { 0 };
int nret = snprintf(rootfs_dev_path, sizeof(rootfs_dev_path), "%s/dev", cont->common_config->base_fs);
if ((size_t)nret >= sizeof(rootfs_dev_path) || nret < 0) {
......@@ -514,7 +514,7 @@ static int mount_dev_tmpfs_for_system_container(const container_t *cont)
if (cont == NULL || cont->hostconfig == NULL || cont->common_config == NULL) {
return 0;
}
if (!cont->hostconfig->system_container) {
if (!cont->hostconfig->system_container || cont->hostconfig->external_rootfs == NULL) {
return 0;
}
int nret = snprintf(rootfs_dev_path, sizeof(rootfs_dev_path), "%s/dev", cont->common_config->base_fs);
......
......@@ -285,12 +285,23 @@ static int merge_config_for_syscontainer(const container_create_request *request
const container_config *container_spec, const oci_runtime_spec *oci_spec)
{
int ret = 0;
char *value = NULL;
if (!host_spec->system_container || request->rootfs == NULL) {
if (!host_spec->system_container) {
return 0;
}
if (request->rootfs == NULL) {
value = oci_spec->root->path;
} else {
value = request->rootfs;
}
if (append_json_map_string_string(oci_spec->annotations, "rootfs.mount", request->rootfs)) {
if (append_json_map_string_string(oci_spec->annotations, "rootfs.mount", value)) {
ERROR("Realloc annotations failed");
ret = -1;
goto out;
}
if (request->rootfs != NULL && append_json_map_string_string(oci_spec->annotations, "external.rootfs", "true")) {
ERROR("Realloc annotations failed");
ret = -1;
goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册