Skip to content

Commit

Permalink
state: Add the host_path and mnt_dir field to state.
Browse files Browse the repository at this point in the history
These need to be passed to hyperstart with the newcontainer
command for mounting to the correct location within the vm.

Signed-off-by: Archana Shinde <[email protected]>
  • Loading branch information
amshinde committed Jun 21, 2017
1 parent 4bb2d17 commit 53dc5ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,14 @@ cc_mounts_to_json (GSList *mounts)
m->directory_created);
}

json_object_set_string_member (mount, "mnt_dir",
m->mnt.mnt_dir);

if (m->host_path) {
json_object_set_string_member (mount, "host_path",
m->host_path);
}

json_array_add_object_element (array, mount);
}

Expand Down
13 changes: 13 additions & 0 deletions src/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ handle_state_mounts_section(GNode* node, struct handler_data* data) {
m = (struct cc_oci_mount*)l->data;
m->directory_created = g_strdup((char*)node->children->data);
}
} else if (! g_strcmp0(node->data, "mnt_dir")) {
GSList *l = g_slist_last(data->state->mounts);
if (l) {
m = (struct cc_oci_mount*)l->data;
m->mnt.mnt_dir = g_strdup((char*)node->children->data);

}
} else if (! g_strcmp0(node->data, "host_path")) {
GSList *l = g_slist_last(data->state->mounts);
if (l) {
m = (struct cc_oci_mount*)l->data;
m->host_path = g_strdup((char*)node->children->data);
}
}
}

Expand Down

0 comments on commit 53dc5ff

Please sign in to comment.