Commit Graph

110 Commits

Author SHA1 Message Date
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