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

Conversation

bergwolf
Copy link
Member

container_populate_volume() checks _data existance to determine if it
should populate old data. We only need to create new _data with 0777
mode if there is no existing one. That includes two cases:

  1. before populating old data in container_populate_volume()
  2. mount an empty volume for the fist time

For file volume case, we need to chmod it instead, to make sure any user
is able to read/write the file.

container_populate_volume() checks _data existance to determine if it
should populate old data. We only need to create new _data with 0777
mode if there is no existing one. That includes two cases:
1. before populating old data in container_populate_volume()
2. mount an empty volume for the fist time

For file volume case, we need to chmod it instead, to make sure any user
is able to read/write the file.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
/* No data in the volume yet, treat as non-file-volume */
if (errno == ENOENT) {
return 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

free list in error path.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. Thanks.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
@bergwolf
Copy link
Member Author

Before patch:

[~]$hyper run -d --size=l1 neo4j
7f7cc4d3cebb5d2a4fa2eeab207e467d322d4130d6cc53693678c9be2b21320d
[~]$hyper exec 7f7cc4d3cebb5d2a4fa2eeab207e467d322d4130d6cc53693678c9be2b21320d ls -l /data
total 0

After patch:

[lear@master]$mypkt run -d --size=l1 neo4j
f9f9040359cf586b18d3c3393123b870a371081fbe9b1e3cef9ad1fcaa128e75
[lear@master]$mypkt exec f9f9040359cf586b18d3c3393123b870a371081fbe9b1e3cef9ad1fcaa128e75 ls -l /data
total 8
drwxr-xr-x 3  112 nogroup 4096 Aug 14 06:16 databases
drwxr-xr-x 2 root root    4096 Aug 14 06:16 dbms

@bergwolf
Copy link
Member Author

Normal empty volume works as usual.

[lear@master]$mypkt run -d -v vol1:/data busybox
f2e1c8372de9117c8f1686efc34f8e3cddd7b68c634bdb12d3493e3c947b9b0c
[lear@master]$mypkt exec f2e1c8372de9117c8f1686efc34f8e3cddd7b68c634bdb12d3493e3c947b9b0c df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdb              10190100     38060   9611368   0% /
devtmpfs                250392         0    250392   0% /dev
tmpfs                   253336         0    253336   0% /dev/shm
/dev/sda                999320      2568    927940   0% /data
share_dir                 1024         4      1020   0% /etc/hosts

@gao-feng gao-feng merged commit c72276b into hyperhq:master Aug 14, 2016
@bergwolf bergwolf deleted the mkdir-for-file-volume-only branch May 8, 2017 07:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants