Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 92b7419

Browse files
committed
wait for volume device to appear
Signed-off-by: Peng Tao <bergwolf@gmail.com>
1 parent 68942fb commit 92b7419

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/container.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ static int container_check_file_volume(char *hyper_path, const char **filename)
9595
return 0;
9696
}
9797

98-
static int container_setup_volume(struct hyper_container *container)
98+
static int container_setup_volume(struct hyper_pod *pod,
99+
struct hyper_container *container)
99100
{
100101
int i;
101102
char dev[512], path[512];
@@ -135,6 +136,12 @@ static int container_setup_volume(struct hyper_container *container)
135136
if (!strcmp(vol->fstype, "xfs"))
136137
options = "nouuid";
137138

139+
if (access(dev, R_OK) < 0) {
140+
char device[512];
141+
sprintf(device, "/block/%s", vol->device);
142+
hyper_netlink_wait_dev(pod->ueventfd, device);
143+
}
144+
138145
if (mount(dev, path, vol->fstype, 0, options) < 0) {
139146
perror("mount volume device failed");
140147
return -1;
@@ -648,7 +655,7 @@ static int hyper_setup_container_rootfs(void *data)
648655
// ignore error of setup modules
649656
container_setup_modules(container);
650657

651-
if (container_setup_volume(container) < 0) {
658+
if (container_setup_volume(arg->pod, container) < 0) {
652659
fprintf(stderr, "container sets up voulme failed\n");
653660
goto fail;
654661
}

0 commit comments

Comments
 (0)