249 Commits
Author SHA1 Message Date
Xu Wang fcc973cda6 Merge pull request #106 from gnawux/release_06
bump version to 0.6.0
2016-05-25 19:35:33 +08:00
Xu Wang a70c3cfb54 bump version to 0.6.0 2016-05-25 14:44:33 +08:00
Xu Wang 1a4a6794e0 Merge pull request #86 from bergwolf/9p-getattr
9p getattr hack
2016-05-25 12:53:31 +08:00
Lai Jiangshan 8024730027 Merge pull request #104 from gao-feng/fd
close fd in hyper_create
2016-05-24 16:08:35 +08:00
Gao feng 211eb96eb6 close fd in hyper_create
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-05-24 15:59:17 +08:00
Lai Jiangshan 5b7069c8b4 Merge pull request #102 from laijs/HOME-env
set the HOME env correctly when it is not configured
2016-05-20 07:57:27 +08:00
Lai Jiangshan ece6aa1a79 set the HOME env correctly when it is not configured
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-05-19 20:36:04 +08:00
Lai Jiangshan 185cfb9fe4 Merge pull request #95 from gao-feng/interface
support setup interface command
2016-05-19 14:02:38 +08:00
Gao feng c8b2fee21c Merge pull request #99 from gao-feng/fix
podinit: wait until container environment is ready
2016-05-18 14:56:00 +08:00
Gao feng 9ce56b757e podinit: wait until container environment is ready
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-05-18 14:48:11 +08:00
Gao feng 72fc9ade82 Merge pull request #98 from gao-feng/exit
use _exit replace exit
2016-05-18 12:33:02 +08:00
Gao feng 05c85499bc use _exit replace exit
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-05-18 12:32:11 +08:00
Lai Jiangshan 3785a4d02c Merge pull request #94 from gao-feng/exit
make exit code of exec/container consist with docker
2016-05-17 23:17:13 +08:00
Gao feng d74aaa326d make exit code of exec/container consist with docker
The exit code from `docker run` gives information about why the container
failed to run or why it exited.  When `docker run` exits with a non-zero code,
the exit codes follow the `chroot` standard, see below:

**_125_** if the error is with Docker daemon **_itself_**

    $ docker run --foo busybox; echo $?
    # flag provided but not defined: --foo
      See 'docker run --help'.
      125

**_126_** if the **_contained command_** cannot be invoked

    $ docker run busybox /etc; echo $?
    # docker: Error response from daemon: Container command '/etc' could not be invoked.
      126

**_127_** if the **_contained command_** cannot be found

    $ docker run busybox foo; echo $?
    # docker: Error response from daemon: Container command 'foo' not found or does not exist.
      127

**_Exit code_** of **_contained command_** otherwise

    $ docker run busybox /bin/sh -c 'exit 3'; echo $?
    # 3

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-05-17 15:33:24 +08:00
Gao feng 9615c24fca reagrd exec/start-container success after fork/clone success
If fork/clone failed, return ERROR message to outside.
otherwise ragard exec/start-container success, add
container/exec to exec list, waitpid in init will get
the exec status.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-05-17 15:33:01 +08:00
Lai Jiangshan 783d711be1 Merge pull request #96 from gao-feng/init-exit
kill processes in container if container init exited
2016-05-17 15:08:11 +08:00
Gao feng 30b3bf772b kill processes in container if container init exited
consist with docker behavior.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-05-17 11:13:20 +08:00
Lai Jiangshan d69a74be22 Merge pull request #90 from laijs/user
enable the user config
2016-05-16 22:31:19 +08:00
Lai Jiangshan 908797e672 enable the user config
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-05-13 16:34:40 +08:00
Gao feng cf2267cff2 support setup interface command
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-05-12 16:40:56 +08:00
Lai Jiangshan 42ba6daf6d Merge pull request #91 from WeiZhang555/typo
Fix typo
2016-05-10 18:11:06 +08:00
Zhang Wei 61b2963d0d Fix typo
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-05-10 16:36:50 +08:00
Peng Tao c92d2d6430 Merge pull request #87 from laijs/fix-double-free
fix double free bug
2016-05-05 09:26:24 +08:00
Lai Jiangshan 274fa5cd84 fix double free bug
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-05-05 00:33:05 +08:00
Peng Tao baa07ce3f9 9p getattr hack
Update kernel to include 9p's getattr hack to make
fstat after unlink work.

The extra patch is in the kernel_patch directory.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2016-05-04 23:21:51 +08:00
Peng Tao 402a930af0 Merge pull request #85 from bergwolf/strdup
fix a few strdup memory leaks
2016-04-29 15:37:57 +08:00
Peng Tao 4475e2db1b fix possible memory leak
We are overriding container->image when passed container->scsiaddr. Make
sure we also free its memory if caller also passes the image field.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2016-04-29 15:36:28 +08:00
Peng Tao 2c12120713 fix two strdup memory leak
Signed-off-by: Peng Tao <bergwolf@gmail.com>
2016-04-29 15:36:14 +08:00
Gao feng 84207a3f97 Merge pull request #84 from laijs/allow-container_setup_modules-failed
Allow container_setup_modules() failed
2016-04-29 00:43:50 -05:00
Lai Jiangshan ab1c293818 extend the stack for hyper_container_init()
container_setup_modules() needs a large stack

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-27 21:46:03 +08:00
Lai Jiangshan 3fbba94a0f ignore error of setup modules
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-27 20:22:42 +08:00
Gao feng a9b7fed072 Merge pull request #81 from laijs/sync-time
sync hardware time to system time when start pod
2016-04-26 21:36:40 -05:00
Gao feng ad196e2fe3 Merge pull request #83 from bergwolf/xfs
xfs needs nouuid mount option
2016-04-25 21:09:35 -05:00
Peng Tao 0c3b80fdbd xfs needs nouuid mount option
Otherwise devicemapper/rbd mount might fail due to device UUID
conflicts on snapshot/clone devices.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2016-04-25 22:08:43 +08:00
Lai Jiangshan c835eb9dfe sync hardware time to system time when start pod
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-25 18:17:06 +08:00
Gao feng 99319c29a6 Merge pull request #79 from gao-feng/module
Add useful modules for hyper container
2016-04-22 20:43:38 -05:00
Gao feng 354c4f44b6 Add useful modules for hyper container
Add cgroup, netfilter, tun, veth and rtc driver.

Note: In some case, kernel will try to use userspace modprobe to
load module, so make sure init mntns has modprobe and modules.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-20 17:46:32 +08:00
Gao feng 048ee7ba27 Merge pull request #75 from gao-feng/volume
fix fail to populate volume created by sharefs
2016-04-19 23:37:30 -05:00
Xu Wang 9eef10d3c3 Merge pull request #78 from laijs/hyperd-address
update the github address of the hypercontainer
2016-04-19 00:13:50 +08:00
Lai Jiangshan ecdc3cd339 update the github address of the hypercontainer
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-19 00:07:24 +08:00
Xu Wang 4f5b747c2b Merge pull request #76 from bergwolf/setup_dns
recreate /etc/resolv.conf iff specified in pod spec
2016-04-18 18:28:25 +08:00
Peng Tao a0bc0851d6 recreate /etc/resolv.conf iif specified in pod spec
hyperd would inject a default DNS server if user did not specify
it in pod spec. If we recreate resolv.conf here, the injected file
will be lost.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2016-04-17 17:37:52 +08:00
Gao feng c68c7b76d1 fix fail to populate volume created by sharefs
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-16 13:46:13 +08:00
Gao feng 9590958aae Merge pull request #70 from laijs/fix-exec-part2-update-API-between-runv-and-hyperstart
Fix exec part2 update api between runv and hyperstart
2016-04-07 21:03:54 -05:00
Lai Jiangshan d3199fcc60 remove defautl setting on tty when exec
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-07 16:45:56 +08:00
Lai Jiangshan 4b45b28122 use VmProcess and hyper_parse_process() for exec
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-07 15:11:38 +08:00
Lai Jiangshan e458707966 add hyper_parse_process() for parsing VmProcess
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-07 14:26:13 +08:00
Gao feng 3554b8ef0b Merge pull request #69 from laijs/fix-exec-part1-cleanup
Fix exec part1 cleanup
2016-04-07 00:44:25 -05:00
Lai Jiangshan 48e7b27737 rename container_parse_cmd() to container_parse_argv()
and take struct hyper_exec as its first argument.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-07 12:17:50 +08:00
Lai Jiangshan 1cff207e67 kill all exec rather than only container in hyper_term_all()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-06 15:03:52 +08:00
Lai Jiangshan aa50e5812b move envs to struct hyper_exec
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-06 14:59:08 +08:00
Lai Jiangshan 64cbfd2a0b move workdir to struct hyper_exec
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-06 14:19:15 +08:00
Lai Jiangshan e487303205 rename container_free_cmd() to container_cleanup_exec()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-06 13:56:11 +08:00
Lai Jiangshan 5a91148a37 remove unused var path
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-06 12:52:25 +08:00
Lai Jiangshan 6a56562120 require exec->seq be set, we can't handle zero seq well
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-06 12:06:04 +08:00
Lai Jiangshan 8803fa8ccb move symlink of devices to container_setup_mount()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-06 10:35:50 +08:00
Lai Jiangshan 90998a9b21 Merge pull request #67 from bergwolf/no-init
recreate docker init layer files
2016-04-05 10:56:17 +08:00
Peng Tao 5e945d507e recreate docker init layer files
So that it is possible for the container creation code to skip
the init layer all together.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
2016-04-05 03:09:53 +08:00
Lai Jiangshan c1023f414f Merge pull request #68 from gao-feng/copy
Copy
2016-04-04 23:58:21 +08:00
Gao feng e737392fc4 copy: symlink sh and tar to busybox
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-04 23:22:42 +08:00
Gao feng 01a09c9b8f copy: remove .oldroot prefix for busybox path
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-04 23:20:56 +08:00
Gao feng a524b04f8c copy: return error when exec copy failed
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-04 23:20:23 +08:00
Gao feng 2332d39620 Merge pull request #66 from laijs/setup-rootfs-before-chroot
Setup mounts&rootfs before chroot
2016-04-04 10:18:19 -05:00
Lai Jiangshan bc28dfedf8 remove prefix from hyper_find_sd()
we always use the intial /sys, so we don't need prefix

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-03 22:47:09 +08:00
Lai Jiangshan 09c0a1b41b remove oldroot
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-03 22:41:27 +08:00
Lai Jiangshan b441c1bffe do container_setup_dns() before move the rootfs
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-03 19:09:11 +08:00
Lai Jiangshan 5be2a71a84 do container_setup_volume() before move the rootfs
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-03 16:52:14 +08:00
Lai Jiangshan 8766f77f24 do container_setup_mount() before move the rootfs
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-03 16:34:08 +08:00
Lai Jiangshan e4beaad672 Merge pull request #65 from gao-feng/nondocker
create volume directory for non docker volume
2016-04-03 13:39:42 +08:00
Gao feng 7f6056fc4c create volume directory for non docker volume
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-03 12:26:24 +08:00
Lai Jiangshan 5ceb9b8906 Merge pull request #64 from gao-feng/volume
don't copy data to volume if volume alreay has data
2016-04-02 22:09:35 +08:00
Gao feng 2ace93e881 don't copy data to volume if volume alreay has data
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-02 20:22:51 +08:00
Gao feng abd52a4ae2 Merge pull request #63 from laijs/remove-oldroot-from-mount-source
Remove '/.oldroot' from mount source
2016-04-02 05:22:59 -05:00
Lai Jiangshan 76bccbd261 remove "/.oldroot" from mount source
before patch:
root@test-container-multi:/# mount
/dev/sdb on / type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/.oldroot/dev/sda on /var/log type ext4 (rw,relatime,stripe=16,data=ordered)

after patch:
root@test-container-multi:/# mount
/dev/sdb on / type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=128,noquota)
/dev/sda on /var/log type ext4 (rw,relatime,stripe=16,data=ordered)

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-02 17:52:25 +08:00
Lai Jiangshan 8f70de4d49 change the order of basic mount and volume mount
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-02 17:46:51 +08:00
Lai Jiangshan ea196f786d move mount of fsmap into container_setup_volume()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-02 17:41:55 +08:00
Gao feng ced3b9dc53 Merge pull request #62 from laijs/mkdir
print mkdir info in correct order
2016-04-02 01:04:35 -05:00
Gao feng 5ca0595e4f Merge pull request #61 from laijs/ptys
fix symlink leek
2016-04-02 01:04:19 -05:00
Gao feng 53cd58a121 Merge pull request #60 from laijs/msmove
Set the rootfs of the namespace to be the rootfs of the container
2016-04-01 23:05:40 -05:00
Lai Jiangshan 0a86f73869 Set the rootfs of the namespace to be the rootfs of the container
we use MS_MOVE to move the container rootfs to /, so that the rootfs
of the namespace and the rootfs of the container are the same.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-02 11:54:14 +08:00
Lai Jiangshan 12ba0a42b2 print mkdir info in correct order
and only print it when it is needed to be maked.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-02 11:37:06 +08:00
Lai Jiangshan 1ad3ffcf63 close ptymaster before exec
ptymaster is dup-ed without close-on-exec, we need to colse it.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-02 11:29:15 +08:00
Lai Jiangshan 5f9a7ee0a2 reopen slave ptyfd for correcting the symlink path of the /dev/fd/1
before patch:
root@ubuntu-4562002641:/# readlink /dev/fd/1
/tmp/hyper/656f914cd9c030214bf95aff8f3bf418c1c277f5b82a661a27a174c9c8ce901b/devpts/3

after patch:
root@ubuntu-5512501784:/# readlink /dev/fd/1
/dev/pts/1

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-02 11:10:48 +08:00
Gao feng b0c0255148 Merge pull request #58 from gao-feng/initialize
support to initialize container environment
2016-04-01 21:48:51 -05:00
Gao feng 6b67c6a296 Merge pull request #59 from laijs/mount-rootfs
ensure the container see the mount point of the rootfs
2016-04-01 05:54:48 -05:00
Lai Jiangshan 0017a6110f ensure the container see the mount point of the rootfs
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-04-01 18:28:32 +08:00
Gao feng 6bbb9ac512 support to initialize container environment
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-04-01 16:48:26 +08:00
Xu Wang 6feb864e30 Merge pull request #57 from feiskyer/fix-cache
Do not cache for shared volumes
2016-03-29 11:34:50 +08:00
feisky 6ff04bf83d Do not cache for shared volumes 2016-03-28 17:45:00 +08:00
Lai Jiangshan 80778ddd25 Merge pull request #56 from laijs/pipe2
convert hyper_socketpair() to pipe2
2016-03-28 08:15:03 +08:00
Lai Jiangshan c455e8bc75 convert hyper_socketpair() to pipe2
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-26 18:23:03 +08:00
feisky 411cffdeec Merge pull request #55 from laijs/env
fix up default environment
2016-03-26 12:12:01 +08:00
Lai Jiangshan 04689c4138 set HOSTNAME environment
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-26 12:03:15 +08:00
Lai Jiangshan 50928fc1ef set/unset TERM environment based on tty config
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-26 11:44:37 +08:00
Lai Jiangshan 20c34a4312 set HOME environment
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-26 11:39:36 +08:00
Gao feng fdd2634721 Merge pull request #54 from liusdu/typo
fix a tiny typo to avoid compile error
2016-03-19 14:23:00 +00:00
Liu Hua b043ac88e1 fix a tiny typo to avoid compile error
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
2016-03-19 22:03:28 +08:00
Gao feng 5c18914f2a Merge pull request #53 from laijs/handle-eof
Handle eof
2016-03-18 22:25:14 -05:00
Lai Jiangshan a0e1ecb2ba handle eof request of stdin
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-19 10:28:19 +08:00
Lai Jiangshan 5279ef3f96 send eof of stdout back to runv ony when release_exec()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-19 10:27:42 +08:00
feisky 36fb6e6877 Merge pull request #52 from gao-feng/tty
request to setup tty for exec by default
2016-03-15 12:02:54 +08:00
Gao feng 6632db44ae request to setup tty for exec by default
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-03-15 11:36:11 +08:00
feisky 613a5a19db Merge pull request #51 from laijs/pipes-stdio
use pipes for stdio when non tty
2016-03-10 17:13:32 +08:00
Lai Jiangshan 21d63485b1 use pipes for stdio when non tty
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-10 00:14:03 +08:00
Lai Jiangshan eaae1ae3fb split exec.e into exec.stdinev and exec.stdoutev
and rename exec.errev to exec.stderrev
and make stdinev.fd stdoutev.fd stderrev.fd are valid but different
and register all these event

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-09 23:53:59 +08:00
Lai Jiangshan 333263b344 pass @exec to pts_hup()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-09 16:07:53 +08:00
Lai Jiangshan 50db29c634 add stdinfd/stdoutfd and rename errfd to stderrfd
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-09 16:01:17 +08:00
Lai Jiangshan fe5c6c29e1 use e->errfd directly to create stderr
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-09 15:46:04 +08:00
Lai Jiangshan 34d842901d always setup exec->errfd
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-09 15:45:48 +08:00
Lai Jiangshan a94833c482 open /dev/null for ptyfd in hyper_setup_exec_tty() when seq=0
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-09 15:45:37 +08:00
Gao feng 0676ed3227 Merge pull request #50 from laijs/enable-non-tty-stdio
Enable non tty stdio
2016-03-09 10:42:48 +08:00
Lai Jiangshan e12e480f79 change VmContainer's stdio's protocal
VmContainer.Tty: allocate tty or not
VmContainer.Stdio: Stdio sequence number
VmContainer.Stderr: Stderr sequence number if stderr is not share with
stdout (currently used when VmContainer.Tty is false)

And new stdio allocation code which respects the VmContainer.Tty.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-08 21:03:34 +08:00
Lai Jiangshan 3fa27e7464 handle eof for the stdio handling
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-08 21:02:42 +08:00
Lai Jiangshan 013cbb7e1a Merge pull request #49 from laijs/pause
pause() in the pod_init loop
2016-03-07 23:22:52 +08:00
Lai Jiangshan 97aee2acb0 pause() in the pod_init loop
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-07 23:00:17 +08:00
Gao feng 43c2336d7f Merge pull request #48 from laijs/sigchld
Simplify SIGCHLD handling and make it exclusive with event handling
2016-03-07 22:50:44 +08:00
Lai Jiangshan 220677d76d simplify SIGCHLD handling of hyper_init
It uses epoll_pwait() instead of epoll_wait(), and ensures that
the SIGCHLD handling and the events handling are exclusive.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-07 21:42:25 +08:00
Lai Jiangshan 0f396470ff simplify SIGCHLD handling of pod_init
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-07 21:38:52 +08:00
Xu Wang 94266c5111 Merge pull request #47 from laijs/no-nonblock-stderr
remove O_NONBLOCK from stderr
2016-03-06 07:29:56 +08:00
Lai Jiangshan 0b3370f6fa remove O_NONBLOCK from stderr
step1: start a container without tty
	hyper run ubuntu
step2: get the fdinfo of the stderr
	cat /proc/self/fdinfo/2
	pos:	0
	flags:	04001
	mnt_id:	8
it shows that the stderr has the O_NONBLOCK flags,
we should remove it.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-03-05 21:49:38 +08:00
Lai Jiangshan c5abeccb65 Merge pull request #46 from laijs/missing-exit
add missing exit(0) to hyper_cmd_online_cpu_mem()
2016-02-29 23:00:12 +08:00
Lai Jiangshan aa7772b36c add missing exit(0) to hyper_cmd_online_cpu_mem()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-02-29 22:59:05 +08:00
Lai Jiangshan f47d84cf24 Merge pull request #45 from gao-feng/fix-free
free stack after cloned children finished
2016-02-29 18:58:51 +08:00
Gao feng d97485cfc0 free stack after cloned children finished
avoid children using the freed memory.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-02-26 14:53:40 +08:00
Lai Jiangshan 4fc4ac0c46 Merge pull request #44 from laijs/online-cpu-mem
add ONLINECPUMEM command
2016-02-22 10:04:34 +08:00
Lai Jiangshan bd41fcfbe6 add ONLINECPUMEM command
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-02-19 13:31:07 +08:00
Gao feng bd9623c892 Merge pull request #43 from gnawux/release-0.5
release hyper/runv 0.5
2016-02-05 15:46:51 +08:00
Xu Wang 00e65b239c release hyper/runv 0.5
Signed-off-by: Xu Wang <gnawux@gmail.com>
2016-02-05 15:42:36 +08:00
Lai Jiangshan b654a0fbd3 Merge pull request #42 from gao-feng/free
fix possible access memory after free
2016-02-01 10:56:40 +08:00
Gao feng 2f757d249d Merge pull request #41 from gnawux/resize_cbfs
new kernel is bigger, increase the cbfs rom size
2016-01-31 21:22:45 +08:00
Gao feng db33f31dc1 fix possible access memory after free
For tasks created by clone_VM, they share the memory with parent,
so when parent frees the stack, children may still access to this
stack. so don't free stack when children is still using the stack.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-01-31 19:24:07 +08:00
Wang Xu 661dcdda07 new kernel is bigger, increase the cbfs rom size
Signed-off-by: Wang Xu <gnawux@gmail.com>
2016-01-30 23:42:06 +08:00
Gao feng 22a65f7666 Merge pull request #40 from laijs/hot-add-cpu-mem
enable hot adding cpu/mem
2016-01-28 15:51:17 +08:00
Lai Jiangshan 1ce35da941 enable hot adding cpu/mem
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-01-28 15:48:43 +08:00
Xu Wang e6cffd9add Merge pull request #39 from laijs/escape
handle all escaped character correctly
2016-01-16 08:04:50 +08:00
Lai Jiangshan 213a00ec5e handle all escaped character correctly
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-01-15 22:36:12 +08:00
Lai Jiangshan c03c057a42 Merge pull request #37 from gao-feng/escape
handle escaped characters
2016-01-15 21:59:44 +08:00
Gao feng 73849713e8 handle escaped characters
./hyper run --rm ubuntu echo xxxx\>\"\\aadasd\"\>\<\>\<\<\<\\\\\\\"\as
POD id is pod-nvpvjBScdB
xxxx>"\aadasd"><><<<\\\"as

echo xxxx\>\"\\aadasd\"\>\<\>\<\<\<\\\\\\\"\as
xxxx>"\aadasd"><><<<\\\"as

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-01-14 11:12:33 +08:00
Lai Jiangshan 0610a4e156 Merge pull request #31 from gao-feng/exit
send out exec exit code
2016-01-07 16:44:17 +08:00
Gao feng 29efaadf0a send out exec exit code
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-01-06 00:12:30 +08:00
feisky 02ba85f8e0 Merge pull request #36 from gao-feng/scsi
find scsi disk device if scsi addr is given
2015-12-25 10:36:11 +08:00
Gao feng d563b3ecb0 Merge pull request #34 from wcwxyz/master
Use configure script to check setns function
2015-12-24 16:05:37 +08:00
Gao feng ce0ab6b836 find scsi disk device if scsi addr is given
scsi disk name is not consistent with scsi addr. find the
device through scsi addr.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-12-24 15:59:05 +08:00
feisky feedb0808b Merge pull request #35 from gao-feng/close
do not close pipe in write side
2015-12-24 10:42:05 +08:00
Gao feng c14737f39c do not close pipe in write side
hyper_container_stage0 shares fd table with init, right now stage0
may close pipe before init read the pipe. this will cause container
fail to start.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-12-23 17:07:07 +08:00
WANG Chao 4b6375a4a4 Use configure script to check setns function
I happen to find out on centos6.7, glibc-headers does have SYS_setns
defined, but previous release doesn't.

It's better to use configure script to check setns function.

Signed-off-by: WANG Chao <wcwxyz@gmail.com>
2015-12-22 15:58:45 +08:00
Lai Jiangshan bfa1af2101 Merge pull request #33 from gao-feng/tty
some update
2015-12-11 16:54:44 +08:00
Gao feng a866e257fd update to v0.3
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-12-10 21:00:10 +08:00
Gao feng d34656475e kill process in destroy pod
hyper send destroy pod to shutdown vm, we should
give process a chance to handle TERM signal.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-12-10 15:13:12 +08:00
Gao feng 2b1edeceb4 introduce hyper_send_msg_block
the control serial port is opened as unblock fd, set
is as block fd to make sure sending successfully.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-12-10 14:57:16 +08:00
Gao feng f49d1247d2 Merge pull request #32 from wcwxyz/master
define setns syscall wrapper to fix build issue
2015-12-07 10:29:15 +08:00
WANG Chao ee697391d6 define setns syscall wrapper to fix build issue
For example on centos6.x, glibc doesn't contain setns syscall wrapper,
but kernel has setns. We can write a wrapper to simulate the glibc
behavior to fix compile issue.

NOTE: In such case, we will need kernel-headers to get syscall number.

Signed-off-by: WANG Chao <wcwxyz@gmail.com>
2015-12-03 15:50:15 +08:00
Xu Wang 93c02c012f Merge pull request #30 from gao-feng/finish
works fine, this could accelerate hyper build and other replace cases
2015-11-24 11:03:14 +08:00
Gao feng 545258bd26 send out ack if pod already finished
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-24 10:17:40 +08:00
Lai Jiangshan 9611ecf356 Merge pull request #28 from gao-feng/cleanup
Cleanup
2015-11-19 12:46:13 +08:00
Gao feng 0887e9a6de support kill container
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-18 18:50:07 +08:00
Gao feng a2086298f6 rename FINISH to PODFINISHED
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-16 15:13:57 +08:00
Gao feng b7c88467e2 Add remains when start container successfully
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-16 12:10:01 +08:00
Gao feng 0c997dbe85 use list to store containers
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-13 16:32:12 +08:00
Gao feng 6d3265a7fb free tty of winsize is parse failed
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-13 14:44:36 +08:00
Gao feng a46092a90a free allocated memory in parse_container
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-13 11:59:43 +08:00
Gao feng 25da342f75 introduce hyper_free_container
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-13 10:56:51 +08:00
Gao feng c3160aea0a refactor parsing json
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-12 22:42:15 +08:00
Gao feng 7bbc240cae Merge pull request #27 from gao-feng/restartPolicy
remove the codes of restart pod
2015-11-12 16:16:30 +08:00
Gao feng 1958e11f45 remove the codes of restart pod
hyper had implemented this function, these codes are useless.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-12 16:04:17 +08:00
Gao feng 738a11dcdc initialize container in parse_new_container
fix the possible free incorrect memory.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-12 16:02:28 +08:00
Lai Jiangshan 280bc617d0 Merge pull request #24 from gao-feng/error
add the check of memory allocation
2015-11-12 15:08:00 +08:00
Gao feng 252def6bab Merge pull request #26 from laijs/dyncontainers
add dynamic containers and fix bugs.
2015-11-12 14:41:37 +08:00
Lai Jiangshan 4361f071e8 move newcontainers to dyn_containers list and fix realloc bug
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-11-12 14:14:25 +08:00
Lai Jiangshan 7ef8099916 split hyper_cleanup_container()
as hyper_cleanup_container() and hyper_cleanup_containers().

Also fix the bug that the iterator "i" is corruption.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-11-11 09:52:22 +08:00
Gao feng 1558b44495 add the check of memory allocation
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-09 16:44:42 +08:00
Gao feng 0c42ea97a4 Merge pull request #23 from gao-feng/compile
export hyper_parse_new_container
2015-11-06 21:17:24 +08:00
Gao feng 51f2a45217 export hyper_parse_new_container
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-06 16:38:54 +08:00
Gao feng 3b0ff1d7ca Merge pull request #21 from laijs/new-container
New container
2015-11-05 15:14:46 +08:00
Lai Jiangshan 62dea1454d enable inserting new container
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-11-05 11:57:30 +08:00
Gao feng b5f8137499 Merge pull request #19 from gao-feng/exec
send eof message to hyper before shutdown vm
2015-11-03 15:26:30 +08:00
Gao feng e64268427d Merge pull request #20 from gao-feng/mount
mount /dev/shm by default
2015-11-03 15:26:09 +08:00
Gao feng 99ee15c731 send eof message to hyper before shutdown vm
When hyperstart received destory-vm message, some execs are still
running, send eof message immediately.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-11-03 15:17:37 +08:00
Lai Jiangshan dfa392edb7 start the container stage0 one by one
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-11-02 15:13:27 +08:00
Lai Jiangshan 7075847ef4 rename pod->tag to pod->share_tag
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-11-02 14:16:34 +08:00
Gao feng 19da0a2068 add mount option for filesystems
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-29 10:06:53 +08:00
Gao feng 180339f16b Mount /dev/shm by default
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-29 10:05:19 +08:00
Gao feng c86afd1a5c rename hyper_send_exec_eof
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-24 18:34:28 +08:00
Lai Jiangshan 910a42d647 Merge pull request #18 from gao-feng/tty
do not close ptyfd after set window size
2015-10-24 08:26:04 +08:00
Gao feng 18abe7d9e1 do not cleanup exec in cleanup pod
Let pts loop or signal loop do the cleanup job. fix the
possible double free of exec.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng ae5338bde5 do not remove lo device in cleanup net
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng 7843001aa7 initialize errev fd
it can not be 0, 0 is an useful fd, this will cause weird
closing of ptmx fd.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng cff19ec212 remove pts event from epoll when get hup event
fix the multi hup event problem.
seams like close event fd doesn't frobid hup event being triggered
again.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng c126e40795 use reference to protect exec structure
stdout, stderr and signal loop will try to access exec struct.
right now, we don't have reference of exec for stderr handler.

so in stderr epoll handler, it may access to the already released
exec resource.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng 11c4d7311b Dont accept input when cmd alreay exited
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng 1f2b1f5880 watch up pty fd before exec cmd
exec cmd may exit before hyper init watching it's ptmx fd,
so the hup event of ptmx may miss, this will cause the eof
message fail to send out.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng 14f9ba5c3f fix incorrect cleanup when exec failed
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Gao feng 26183926a3 do not close ptyfd after set window size
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-23 23:27:53 +08:00
Lai Jiangshan a7a3c52c88 Merge pull request #17 from gao-feng/sysctl
support configure sysctl for container
2015-10-22 18:51:33 +08:00
Gao feng 350997b03c support configure sysctl for container
{
	"id": "test-container-sysctl",
	"containers" : [{
	    "name": "ubuntu",
	    "image": "ubuntu:latest",
	    "workdir": "/",
	    "command": ["/bin/bash"],
	    "sysctl":{"net.ipv4.ip_forward": "1", "net.core.somaxconn": "256"}
	}],
	"resource": {
	    "vcpu": 1,
	    "memory": 512
	},
	"tty": true
}

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-19 17:03:28 +08:00
Lai Jiangshan 48c6e2248a Merge pull request #15 from gao-feng/error-report
Error report
2015-10-19 10:58:07 +08:00
Gao feng 08fcf381e8 remove useless code
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-10 23:20:26 +08:00
Gao feng f3f78303b1 cleanup pod after nobody use pod data
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-10 20:49:20 +08:00
Gao feng 555bc46d14 remove pipe between pod and hyper init
Get rid of pipe by stopping pod in hyper init.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-10 18:04:07 +08:00
Gao feng b14f68378d fix incorrect path of link file
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-10 18:04:05 +08:00
Gao feng 8553460afe return fail if start container failed
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-10-10 18:04:02 +08:00
Xu Wang 16cf97584c Merge pull request #13 from gao-feng/stderr
add support of separate stderr output of container
2015-10-08 18:11:00 +08:00
Wang Xu a5680759eb add support of separate stderr output of container
this patch add a pipe besides the pty for container, and the stderr will be
sent from the stderr session if the session provided in spec.

this intend to support log the stdout and stderr separately.

Signed-off-by: Wang Xu <gnawux@gmail.com>
2015-10-08 17:26:05 +08:00
Gao feng b6e073d03c Merge pull request #14 from laijs/remove-dvm
rename the ununsed SETDVM to RESERVED
2015-10-08 16:23:24 +08:00
Lai Jiangshan d7752ebd8b rename the ununsed SETDVM to RESERVED
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-10-08 15:59:21 +08:00
Xu Wang fdc9364062 Merge pull request #11 from gnawux/fix_symlink
add symlink /dev/{stdin,stdout,stderr} to /proc/self/fd/{0,1,2}
2015-10-04 08:26:55 +08:00
Wang Xu da47929b6a add symlink /dev/{stdin,stdout,stderr} to /proc/self/fd/{0,1,2}
This is what docker does, and will fix the other part of the issue of
official nginx image problems

Test result:

```
gnawux@sonic:~/go/src/github.com/hyperhq/hyper$ ./hyper run nginx
POD id is pod-SwBxHnRdKH
192.168.123.1 - - [03/Oct/2015:07:06:27 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.35.0" "-"
```

The curl in another term:

```
gnawux@sonic:~/c/hyperstart/build$ curl http://192.168.123.7/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
```

Signed-off-by: Wang Xu <gnawux@gmail.com>
2015-10-03 15:11:35 +08:00
Gao feng 3f663e7a4e Merge pull request #10 from gnawux/cbfs_cmdline
add cmdline to cbfs
2015-10-01 18:46:36 +08:00
Wang Xu 3453f63787 add cmdline to cbfs
Signed-off-by: Wang Xu <gnawux@gmail.com>
2015-10-01 02:47:29 +08:00
feisky 8cd46388e5 Merge pull request #8 from gao-feng/pod
update hyperstart
2015-09-29 10:24:53 +08:00
Gao feng 5f819dc68a close slaver tty fd for container
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-29 10:06:36 +08:00
Gao feng 14aa9eaa39 reclaim process resource in pod init
The parent process of Some tasks may be pod init.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-29 00:04:47 +08:00
Gao feng c0585278d0 remove useless clone flag
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-29 00:04:34 +08:00
feisky d9a36a889e Merge pull request #7 from gao-feng/tuncate
tuncate file in write file command
2015-09-28 17:39:46 +08:00
Gao feng 788e80ce39 tuncate file in write file command
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-28 17:30:41 +08:00
Lai Jiangshan 68b31dddd5 Merge pull request #6 from gao-feng/read-write
Introduce Read write command
2015-09-25 15:30:33 +08:00
Gao feng f0d9fc7bce fix possible memory leak
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-25 09:17:45 +08:00
Gao feng 684e85cc5e recyle resources of process which created by clone
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-24 16:58:42 +08:00
Gao feng d45be919cd change socketpair to pipe
If one pair of pipe created by socketpair closed, the other side
will receice error, so other side cannot know the exec result of
peer.

Use pipe to replace socketpair.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-24 14:38:46 +08:00
Gao feng 5c3bd1b19f initialize ptyfd and eventfd for exec
initialize them to -1

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-24 11:02:45 +08:00
Gao feng 600e8dd3c8 release exec immediately if exec has no tty
Only signal handler operates the exex struct, we
can release exec immediately

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-24 10:55:57 +08:00
Gao feng 08764d5bbc fix incorrect logic of hyper_send_type_block
It means set fd block first and send out the type.
And fix the access to exec consurrently, hyper init
should be blocked until do_exec_cmd processes the
exec struct.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-24 10:34:12 +08:00
Gao feng 749387bbfa fix possible missing eof data
It happend that pts_loop reads all of the data before the,
SIGCHLD signal being handled, so only hup handler will be triggered,
move the sending eof message to hup handler.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-23 23:07:22 +08:00
Gao feng 88bb908c76 do not handle hup event if get in event
Should handle in event to get reamin data before close fd in hup.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-23 17:01:20 +08:00
Gao feng d260dda29e remove debug message
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-23 10:56:49 +08:00
Gao feng a8362c1a70 hold the fd of container pts device in hyper init
1, Hold the the file description of pts device and ptmx in hyper-init process
2, Dup fd to the stdio of Exec cmd
3, Exec cmd exited, no EPOLLHUP event since the file is still open
4, Try to read ptmx fd before close pts fd
4, signal handler get signal SIGCHLD, close the pts fd to trigger EPOLLHUP event
5, EPOLLHUP event is received, send eof message to ttyfd. release exec.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-23 10:56:49 +08:00
Gao feng 87fa294a42 handle pts epoll hup event
hup means peer closes the pipe, and the exec will exit,
send out all of the outputs of exec.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-23 10:56:37 +08:00
Gao feng 330c46cdb2 enter container namespace with opened ns fd
After process exit,the path of pid ns will disappear,
open it first to prohibit ns being released.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-21 10:52:58 +08:00
Gao feng 27f4b56e71 implement hyper_cmd_read_file
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-17 20:28:31 +08:00
Gao feng 2262bc18fe accept read raw data from write message
It's difficult to encode the json with special characters such as '"', '>'...
encoding and unicoding these characters will change the length of json message,
it's a pain to get bytes contains these characters from json.

This patch allows to read the bytes contains special character outside the json.
for example:
{"container":"c5f67934326d2ecef59fee62148bc9237e2481cd803cc0760a6406da15f4ee60","file":"/tmp/aaa"}sssssss

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-17 16:18:32 +08:00
Gao feng bc0e688f96 implemet hyper_cmd_write_file
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-17 00:44:54 +08:00
Gao feng 2fb02c57b6 set cloexec flag on socket pair
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-16 23:39:01 +08:00
Gao feng bf0f360935 run exec in right pid namespace
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-16 23:19:56 +08:00
Gao feng 6976865176 cleanup
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-16 20:14:48 +08:00
Gao feng c862b89079 running contianers in the pid ns of pod init
manpage of setns says:

>CLONE_NEWPID behaves somewhat differently from the other nstype values: reassociating the calling thread with a PID namespace changes only the PID namespace that child processes of the  caller  will
>be created in; it does not change the PID namespace of the caller itself.  Reassociating with a PID namespace is allowed only if the PID namespace specified by fd is a descendant (child, grandchild,
>etc.)  of the PID namespace of the caller.  For further details on PID namespaces, see pid_namespaces(7).

so clone a temporary process to enter pid ns, and then create containers. and join them to the other nss of pod init.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-16 18:54:56 +08:00
Gao feng 6a15977238 create container process in hyper init
Move most of functions from pod init to hyper init.
this makes logic more clearer

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-16 16:47:43 +08:00
Gao feng 7d6468f70b introduce hyper_parse_read_file
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-15 23:25:25 +08:00
Gao feng ed9a351518 introduce hyper_parse_write_file
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-15 23:22:38 +08:00
Gao feng d4b3e0ad62 introduce WRITE/READFILE command
write data to files or read data from files in contianer.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-09-15 20:11:16 +08:00
Thibault BRONCHAIN 1bd2d3d992 Merge pull request #4 from stigkj/patch-1
Fix spelling
2015-09-02 09:16:18 +08:00
Stig Kleppe-Jørgensen ce452d5759 Fix spelling 2015-09-01 22:43:44 +02:00
Gao feng 56cb24bd0d Merge pull request #3 from gao-feng/fix
fix incorrectly writting to resolv.conf
2015-09-01 17:12:40 +08:00
Gao feng c7b46b71a0 fix incorrectly writting to resolv.conf
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-08-28 20:46:33 +08:00
Lai Jiangshan e7e6b98958 Merge pull request #2 from gao-feng/dns
support setting up dns for container
2015-08-28 18:04:10 +08:00
Gao feng 2f27b48f7b setup dns for container
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-08-27 22:46:14 +08:00
Gao feng 04a501edb7 parse dns from pod file
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-08-27 22:42:57 +08:00
Gao feng 01f07fb952 remove channel in pod
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2015-08-27 22:42:57 +08:00
Gao feng 6680827faf send kill signal if term is ignored by container process
Fix the bug that stoppod is blocked.

Signed-off-by: Gao feng <feng@hyper.sh>
2015-08-13 16:52:36 +08:00
Gao feng 7699c38b99 ignore cbfs rom
Signed-off-by: Gao feng <feng@hyper.sh>
2015-08-13 16:52:26 +08:00
125 changed files with 4517 additions and 1479 deletions
+1
View File
@@ -10,6 +10,7 @@
init
build/hyper_daemon
build/hyper-initrd.img
build/cbfs.rom
build/root/*
build/*iso
build/daemon
+6 -6
View File
@@ -1,21 +1,21 @@
# The init Task for Hyper
# The init Task for HyperContainer
You can get binary installer of Hyper and HyperStart through [The Hyper Page](https://github.com/hyperhq/hyper)
You can get the binary installer of HyperContainer and HyperStart through [The Hyper Page](https://github.com/hyperhq/hyperd)
## Build from source
clone this repo, and make sure have build-essentials installed. Go into the working copy and
clone this repo, and make sure you have build-essentials installed. Go into the working copy and
> ./autogen.sh
> ./configure
> make
Then you can find `hyper-initrd.img` in build directory, together with a pre-build kernel.
Then you can find `hyper-initrd.img` in the build directory, together with a pre-built kernel.
If you want to get the boot disk file for VirtaulBox, please reconfigure with flag --with-vbox,
If you want to get the boot disk file for VirtualBox, please reconfigure with flag --with-vbox,
> ./configure --with-vbox
> make
Then you can find `hyper-vbox-bootimage.iso` in build directory, booting from this iso will
Then you can find `hyper-vbox-bootimage.iso` in the build directory. Booting from this iso will
bring you to the hyper world.
Executable
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+491 -139
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,43 @@
From 084b4a5aa4b90975f7ac6b4714a6b449430ef4c4 Mon Sep 17 00:00:00 2001
From: Peng Tao <bergwolf@gmail.com>
Date: Wed, 4 May 2016 12:01:22 +0800
Subject: [PATCH] HACK: 9P: always use cached inode to fill in v9fs_vfs_getattr
So that if in cache=none mode, we don't have to lookup server that
might not support open-unlink-fstat operation.
Signed-off-by: Peng Tao <bergwolf@gmail.com>
---
fs/9p/vfs_inode.c | 2 +-
fs/9p/vfs_inode_dotl.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 5110785..43ebb31 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1059,7 +1059,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
v9ses = v9fs_dentry2v9ses(dentry);
- if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
+ if (!d_really_is_negative(dentry) || v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
generic_fillattr(d_inode(dentry), stat);
return 0;
}
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index cb899af..b1e4205 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -479,7 +479,7 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
v9ses = v9fs_dentry2v9ses(dentry);
- if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
+ if (!d_really_is_negative(dentry) || v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
generic_fillattr(d_inode(dentry), stat);
return 0;
}
--
2.5.0
+2
View File
@@ -0,0 +1,2 @@
# v4.4.7+
084b4a5aa4b90975f7ac6b4714a6b449430ef4c4
+6 -2
View File
@@ -1,9 +1,11 @@
#!/bin/bash
rm -rf root
mkdir root
mkdir -p root/lib
cp ../src/init ./root
cp busybox ./root
cp modules -R ./root/lib/
ldd ./root/init | while read line
do
@@ -36,9 +38,11 @@ if [ "$1"x = "cbfs"x ]; then
mkdir .cbfs
dd if=/dev/zero of=.cbfs/boot.bin bs=4096 count=1
cbfstool .cbfs/cbfs.rom create -s 4096k -B .cbfs/boot.bin -m x86 0x1000
cbfstool .cbfs/cbfs.rom create -s 8128k -B .cbfs/boot.bin -m x86 0x1000
cbfstool .cbfs/cbfs.rom add -f kernel -n vmlinuz -t raw
cbfstool .cbfs/cbfs.rom add -f hyper-initrd.img -n initrd -t raw
echo 'console=ttyS0 panic=1 no_timer_check' > .cbfs/cmdline
cbfstool .cbfs/cbfs.rom add -f .cbfs/cmdline -n cmdline -t raw
cp .cbfs/cbfs.rom ./
rm -rf .cbfs
exit 0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+107
View File
@@ -0,0 +1,107 @@
# Aliases extracted from modules themselves.
alias devname:net/tun tun
alias char-major-10-200 tun
alias rtnl-link-veth veth
alias net-pf-16-proto-12 nfnetlink
alias nfnetlink-subsys-7 nfnetlink_acct
alias nfnetlink-subsys-3 nfnetlink_queue
alias nf-logger-7-1 nfnetlink_log
alias nf-logger-10-1 nfnetlink_log
alias nf-logger-2-1 nfnetlink_log
alias nfnetlink-subsys-4 nfnetlink_log
alias nfnetlink-subsys-2 nf_conntrack_netlink
alias nfnetlink-subsys-1 nf_conntrack_netlink
alias ip_conntrack_netlink nf_conntrack_netlink
alias ip6t_tcp xt_tcpudp
alias ip6t_udp xt_tcpudp
alias ipt_tcp xt_tcpudp
alias ipt_udp xt_tcpudp
alias xt_udp xt_tcpudp
alias xt_tcp xt_tcpudp
alias arpt_MARK xt_mark
alias ip6t_MARK xt_mark
alias ipt_MARK xt_mark
alias ip6t_mark xt_mark
alias ipt_mark xt_mark
alias ip6t_connmark xt_connmark
alias ipt_connmark xt_connmark
alias ip6t_CONNMARK xt_connmark
alias ipt_CONNMARK xt_connmark
alias ip6t_SET xt_set
alias ipt_SET xt_set
alias ip6t_set xt_set
alias ipt_set xt_set
alias xt_SET xt_set
alias ip6t_DNAT xt_nat
alias ip6t_SNAT xt_nat
alias ipt_DNAT xt_nat
alias ipt_SNAT xt_nat
alias ip6t_CHECKSUM xt_CHECKSUM
alias ipt_CHECKSUM xt_CHECKSUM
alias arpt_CLASSIFY xt_CLASSIFY
alias ip6t_CLASSIFY xt_CLASSIFY
alias ipt_CLASSIFY xt_CLASSIFY
alias ip6t_HMARK xt_HMARK
alias ipt_HMARK xt_HMARK
alias ipt_NETMAP xt_NETMAP
alias ip6t_NETMAP xt_NETMAP
alias ipt_REDIRECT xt_REDIRECT
alias ip6t_REDIRECT xt_REDIRECT
alias ip6t_TCPMSS xt_TCPMSS
alias ipt_TCPMSS xt_TCPMSS
alias ip6t_addrtype xt_addrtype
alias ipt_addrtype xt_addrtype
alias ip6t_connbytes xt_connbytes
alias ipt_connbytes xt_connbytes
alias ip6t_connlimit xt_connlimit
alias ipt_connlimit xt_connlimit
alias ip6t_conntrack xt_conntrack
alias ipt_conntrack xt_conntrack
alias ip6t_ipvs xt_ipvs
alias ipt_ipvs xt_ipvs
alias ip6t_length xt_length
alias ipt_length xt_length
alias ip6t_mac xt_mac
alias ipt_mac xt_mac
alias ip6t_nfacct xt_nfacct
alias ipt_nfacct xt_nfacct
alias ip6t_cgroup xt_cgroup
alias ipt_cgroup xt_cgroup
alias ip6t_pkttype xt_pkttype
alias ipt_pkttype xt_pkttype
alias ip6t_recent xt_recent
alias ipt_recent xt_recent
alias ip6t_socket xt_socket
alias ipt_socket xt_socket
alias ip6t_state xt_state
alias ipt_state xt_state
alias ip6t_statistic xt_statistic
alias ipt_statistic xt_statistic
alias ip6t_string xt_string
alias ipt_string xt_string
alias ip6t_tcpmss xt_tcpmss
alias ipt_tcpmss xt_tcpmss
alias ip6t_time xt_time
alias ipt_time xt_time
alias ip6t_u32 xt_u32
alias ipt_u32 xt_u32
alias nfnetlink-subsys-6 ip_set
alias ip_set_bitmap:ip ip_set_bitmap_ip
alias ip_set_bitmap:ip,mac ip_set_bitmap_ipmac
alias ip_set_bitmap:port ip_set_bitmap_port
alias ip_set_hash:ip ip_set_hash_ip
alias ip_set_hash:ip,mark ip_set_hash_ipmark
alias ip_set_hash:ip,port ip_set_hash_ipport
alias ip_set_hash:ip,port,ip ip_set_hash_ipportip
alias ip_set_hash:ip,port,net ip_set_hash_ipportnet
alias ip_set_hash:mac ip_set_hash_mac
alias ip_set_hash:net ip_set_hash_net
alias ip_set_hash:net,port ip_set_hash_netport
alias ip_set_hash:net,iface ip_set_hash_netiface
alias ip_set_hash:net,net ip_set_hash_netnet
alias ip_set_hash:net,port,net ip_set_hash_netportnet
alias ip_set_list:set ip_set_list_set
alias ip_conntrack nf_conntrack_ipv4
alias nf_conntrack-2 nf_conntrack_ipv4
alias nf-nat-2 nf_nat_ipv4
alias nf-logger-2-0 nf_log_ipv4
Binary file not shown.
@@ -0,0 +1,75 @@
kernel/fs/binfmt_misc.ko
kernel/fs/binfmt_script.ko
kernel/fs/mbcache.ko
kernel/fs/9p/9p.ko
kernel/fs/exportfs/exportfs.ko
kernel/fs/ext4/ext4.ko
kernel/fs/jbd2/jbd2.ko
kernel/fs/nls/nls_base.ko
kernel/fs/xfs/xfs.ko
kernel/crypto/crypto.ko
kernel/crypto/crypto_wq.ko
kernel/crypto/crypto_algapi.ko
kernel/crypto/aead.ko
kernel/crypto/crypto_blkcipher.ko
kernel/crypto/chainiv.ko
kernel/crypto/eseqiv.ko
kernel/crypto/crypto_hash.ko
kernel/crypto/pcompress.ko
kernel/crypto/akcipher.ko
kernel/crypto/cryptomgr.ko
kernel/crypto/hmac.ko
kernel/crypto/crypto_null.ko
kernel/crypto/sha256_generic.ko
kernel/crypto/aes_generic.ko
kernel/crypto/crc32c_generic.ko
kernel/crypto/crct10dif_common.ko
kernel/crypto/crct10dif_generic.ko
kernel/crypto/rng.ko
kernel/crypto/drbg.ko
kernel/crypto/jitterentropy_rng.ko
kernel/block/cfq-iosched.ko
kernel/drivers/acpi/fan.ko
kernel/drivers/acpi/processor.ko
kernel/drivers/acpi/thermal.ko
kernel/drivers/base/firmware_class.ko
kernel/drivers/block/brd.ko
kernel/drivers/block/loop.ko
kernel/drivers/block/virtio_blk.ko
kernel/drivers/block/xen-blkfront.ko
kernel/drivers/char/virtio_console.ko
kernel/drivers/input/input-core.ko
kernel/drivers/misc/eeprom/eeprom_93cx6.ko
kernel/drivers/net/virtio_net.ko
kernel/drivers/net/xen-netfront.ko
kernel/drivers/pci/pci-stub.ko
kernel/drivers/pci/xen-pcifront.ko
kernel/drivers/rtc/rtc-cmos.ko
kernel/drivers/scsi/scsi_mod.ko
kernel/drivers/scsi/virtio_scsi.ko
kernel/drivers/scsi/sd_mod.ko
kernel/drivers/scsi/sg.ko
kernel/drivers/thermal/thermal_sys.ko
kernel/drivers/tty/serial/serial_core.ko
kernel/drivers/tty/serial/8250/8250.ko
kernel/drivers/tty/serial/8250/8250_base.ko
kernel/drivers/tty/serial/8250/8250_pci.ko
kernel/drivers/virtio/virtio.ko
kernel/drivers/virtio/virtio_ring.ko
kernel/drivers/virtio/virtio_mmio.ko
kernel/drivers/virtio/virtio_pci.ko
kernel/drivers/virtio/virtio_balloon.ko
kernel/drivers/xen/xenbus/xenbus_probe_frontend.ko
kernel/net/9p/9pnet.ko
kernel/net/9p/9pnet_virtio.ko
kernel/net/ipv4/tcp_cubic.ko
kernel/net/ipv6/ipv6.ko
kernel/net/ipv6/inet6_hashtables.ko
kernel/net/packet/af_packet.ko
kernel/net/unix/unix.ko
kernel/lib/bitrev.ko
kernel/lib/crc16.ko
kernel/lib/crc-t10dif.ko
kernel/lib/crc32.ko
kernel/lib/libcrc32c.ko
kernel/lib/zlib_inflate/zlib_inflate.ko

Some files were not shown because too many files have changed in this diff Show More