add ONLINECPUMEM command

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-02-19 13:26:14 +08:00
parent bd9623c892
commit bd41fcfbe6
2 changed files with 15 additions and 2 deletions
+1
View File
@@ -29,6 +29,7 @@ enum {
READFILE,
NEWCONTAINER,
KILLCONTAINER,
ONLINECPUMEM,
};
enum {
+14 -2
View File
@@ -990,6 +990,17 @@ out:
return ret;
}
static void hyper_cmd_online_cpu_mem()
{
int pid = fork();
if (pid < 0) {
perror("fail to fork online process");
} else if (pid == 0) {
online_cpu();
online_memory();
}
}
static void hyper_cleanup_hostname(struct hyper_pod *pod)
{
free(pod->hostname);
@@ -1156,8 +1167,6 @@ static int hyper_channel_handle(struct hyper_event *de, uint32_t len)
pod->type = type;
switch (type) {
case STARTPOD:
online_cpu();
online_memory();
ret = hyper_start_pod((char *)buf->data + 8, len - 8);
hyper_print_uptime();
break;
@@ -1193,6 +1202,9 @@ static int hyper_channel_handle(struct hyper_event *de, uint32_t len)
case KILLCONTAINER:
ret = hyper_kill_container((char *)buf->data + 8, len - 8);
break;
case ONLINECPUMEM:
hyper_cmd_online_cpu_mem();
break;
default:
ret = -1;
break;