sync openeuler
Signed-off-by: Grooooot <isula@huawei.com>
This commit is contained in:
parent
d282adb9f7
commit
ce0b21b32a
@ -1,5 +1,5 @@
|
||||
%global _version 1.1.9
|
||||
%global _release 20200121.100120.gite61a5e35
|
||||
%global _release 20200206.104209.gitd282adb9
|
||||
%global is_systemd 1
|
||||
%global debug_package %{nil}
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ static void send_msg_to_syslog(int argc, const char **argv)
|
||||
for (; target_command[i] != NULL; i++) {
|
||||
if (strcmp(argv[1], target_command[i]) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
|
||||
@ -134,7 +134,7 @@ struct command g_commands[] = {
|
||||
"wait", cmd_wait_main, g_cmd_wait_desc, NULL, &g_cmd_wait_args
|
||||
},
|
||||
{
|
||||
// `wait` sub-command
|
||||
// `logs` sub-command
|
||||
"logs", cmd_logs_main, g_cmd_logs_desc, NULL, &g_cmd_logs_args
|
||||
},
|
||||
#endif
|
||||
|
||||
@ -156,6 +156,7 @@ int service_arguments_init(struct service_arguments *args)
|
||||
|
||||
args->default_ulimit = NULL;
|
||||
args->default_ulimit_len = 0;
|
||||
args->json_confs->websocket_server_listening_port = DEFAULT_WEBSOCKET_SERVER_LISTENING_PORT;
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
||||
@ -57,6 +57,7 @@ struct service_arguments {
|
||||
/* default configs */
|
||||
host_config_ulimits_element **default_ulimit;
|
||||
size_t default_ulimit_len;
|
||||
unsigned int websocket_server_listening_port;
|
||||
|
||||
// remaining arguments
|
||||
char * const *argv;
|
||||
|
||||
@ -228,6 +228,27 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int check_websocket_server_listening_port(const struct service_arguments *args)
|
||||
{
|
||||
#define MIN_REGISTER_PORT 1024
|
||||
#define MAX_REGISTER_PORT 49151
|
||||
int ret = 0;
|
||||
|
||||
if (args->json_confs->websocket_server_listening_port < MIN_REGISTER_PORT ||
|
||||
args->json_confs->websocket_server_listening_port > MAX_REGISTER_PORT) {
|
||||
COMMAND_ERROR("Invalid websocket server listening port: '%d' (range: %d-%d)",
|
||||
args->json_confs->websocket_server_listening_port,
|
||||
MIN_REGISTER_PORT, MAX_REGISTER_PORT);
|
||||
ERROR("Invalid websocket server listening port: '%d' (range: %d-%d)",
|
||||
args->json_confs->websocket_server_listening_port,
|
||||
MIN_REGISTER_PORT, MAX_REGISTER_PORT);
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int check_args(struct service_arguments *args)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -291,6 +312,11 @@ int check_args(struct service_arguments *args)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (check_websocket_server_listening_port(args) != 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -99,7 +99,10 @@ int update_default_ulimit(struct service_arguments *args);
|
||||
{ CMD_OPT_TYPE_STRING_DUP, false, "tlskey", 0, &(cmdargs)->json_confs->tls_config->key_file, \
|
||||
"Path to TLS key file (default \"/root/.iSulad/key.pem\")", NULL }, \
|
||||
{ CMD_OPT_TYPE_CALLBACK, false, "default-ulimit", 0, &(cmdargs)->default_ulimit, \
|
||||
"Default ulimits for containers (default [])", command_default_ulimit_append }
|
||||
"Default ulimits for containers (default [])", command_default_ulimit_append }, \
|
||||
{ CMD_OPT_TYPE_CALLBACK, false, "websocket-server-listening-port", 0, \
|
||||
&(cmdargs)->json_confs->websocket_server_listening_port, \
|
||||
"CRI websocket streaming service listening port (default 10350)", command_convert_uint }
|
||||
|
||||
#endif /* __COMMAND_H */
|
||||
|
||||
|
||||
@ -1256,6 +1256,28 @@ out:
|
||||
return plugins;
|
||||
}
|
||||
|
||||
/* conf get websocket server listening port */
|
||||
int32_t conf_get_websocket_server_listening_port()
|
||||
{
|
||||
int32_t port = 0;
|
||||
struct service_arguments *conf = NULL;
|
||||
|
||||
if (isulad_server_conf_rdlock() != 0) {
|
||||
return port;
|
||||
}
|
||||
|
||||
conf = conf_get_server_conf();
|
||||
if (conf == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
port = conf->json_confs->websocket_server_listening_port;
|
||||
|
||||
out:
|
||||
(void)isulad_server_conf_unlock();
|
||||
return port;
|
||||
}
|
||||
|
||||
/* save args to conf */
|
||||
int save_args_to_conf(struct service_arguments *args)
|
||||
{
|
||||
@ -1794,6 +1816,10 @@ int merge_json_confs_into_global(struct service_arguments *args)
|
||||
args->json_confs->image_layer_check = tmp_json_confs->image_layer_check;
|
||||
}
|
||||
|
||||
if (tmp_json_confs->websocket_server_listening_port) {
|
||||
args->json_confs->websocket_server_listening_port = tmp_json_confs->websocket_server_listening_port;
|
||||
}
|
||||
|
||||
override_bool_pointer_value(&args->json_confs->use_decrypted_key, &tmp_json_confs->use_decrypted_key);
|
||||
|
||||
if (tmp_json_confs->insecure_skip_verify_enforce) {
|
||||
|
||||
@ -47,6 +47,7 @@ char *conf_get_isulad_log_gather_fifo_path();
|
||||
char *conf_get_isulad_log_file();
|
||||
char *conf_get_engine_log_file();
|
||||
char *conf_get_enable_plugins();
|
||||
int32_t conf_get_websocket_server_listening_port();
|
||||
|
||||
int save_args_to_conf(struct service_arguments *args);
|
||||
|
||||
|
||||
@ -59,5 +59,7 @@
|
||||
|
||||
#define MAX_MSG_BUFFER_SIZE (32 * 1024)
|
||||
|
||||
#define DEFAULT_WEBSOCKET_SERVER_LISTENING_PORT 10350
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -118,6 +118,9 @@
|
||||
"cgroup-parent": {
|
||||
"type": "string"
|
||||
},
|
||||
"websocket-server-listening-port": {
|
||||
"type": "int32"
|
||||
},
|
||||
"default-ulimits": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
|
||||
@ -22,6 +22,16 @@ History: 2019-06-17
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with libocispec. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, you may create a larger work that contains
|
||||
# part or all of the libocispec parser skeleton and distribute that work
|
||||
# under terms of your choice, so long as that work isn't itself a
|
||||
# parser generator using the skeleton or a modified version thereof
|
||||
# as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
# the parser skeleton itself, you may (at your option) remove this
|
||||
# special exception, which will cause the skeleton and the resulting
|
||||
# libocispec output files to be licensed under the GNU General Public
|
||||
# License without this special exception.
|
||||
|
||||
CODE = '''// Auto generated file. Do not edit!
|
||||
# define _GNU_SOURCE
|
||||
|
||||
@ -23,6 +23,15 @@ History: 2019-06-17
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with libocispec. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, you may create a larger work that contains
|
||||
# part or all of the libocispec parser skeleton and distribute that work
|
||||
# under terms of your choice, so long as that work isn't itself a
|
||||
# parser generator using the skeleton or a modified version thereof
|
||||
# as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
# the parser skeleton itself, you may (at your option) remove this
|
||||
# special exception, which will cause the skeleton and the resulting
|
||||
# libocispec output files to be licensed under the GNU General Public
|
||||
# License without this special exception.
|
||||
#!/usr/bin/python -Es
|
||||
|
||||
"""
|
||||
|
||||
@ -22,6 +22,16 @@ History: 2019-06-17
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with libocispec. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, you may create a larger work that contains
|
||||
# part or all of the libocispec parser skeleton and distribute that work
|
||||
# under terms of your choice, so long as that work isn't itself a
|
||||
# parser generator using the skeleton or a modified version thereof
|
||||
# as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
# the parser skeleton itself, you may (at your option) remove this
|
||||
# special exception, which will cause the skeleton and the resulting
|
||||
# libocispec output files to be licensed under the GNU General Public
|
||||
# License without this special exception.
|
||||
|
||||
import traceback
|
||||
import os
|
||||
|
||||
@ -23,6 +23,16 @@ History: 2019-06-17
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with libocispec. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, you may create a larger work that contains
|
||||
# part or all of the libocispec parser skeleton and distribute that work
|
||||
# under terms of your choice, so long as that work isn't itself a
|
||||
# parser generator using the skeleton or a modified version thereof
|
||||
# as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
# the parser skeleton itself, you may (at your option) remove this
|
||||
# special exception, which will cause the skeleton and the resulting
|
||||
# libocispec output files to be licensed under the GNU General Public
|
||||
# License without this special exception.
|
||||
#
|
||||
#!/usr/bin/python -Es
|
||||
import helpers
|
||||
|
||||
|
||||
@ -23,6 +23,15 @@ History: 2019-06-17
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with libocispec. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, you may create a larger work that contains
|
||||
# part or all of the libocispec parser skeleton and distribute that work
|
||||
# under terms of your choice, so long as that work isn't itself a
|
||||
# parser generator using the skeleton or a modified version thereof
|
||||
# as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
# the parser skeleton itself, you may (at your option) remove this
|
||||
# special exception, which will cause the skeleton and the resulting
|
||||
# libocispec output files to be licensed under the GNU General Public
|
||||
# License without this special exception.
|
||||
#!/usr/bin/python -Es
|
||||
import os
|
||||
import sys
|
||||
|
||||
@ -19,6 +19,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with libocispec. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, you may create a larger work that contains
|
||||
# part or all of the libocispec parser skeleton and distribute that work
|
||||
# under terms of your choice, so long as that work isn't itself a
|
||||
# parser generator using the skeleton or a modified version thereof
|
||||
# as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
# the parser skeleton itself, you may (at your option) remove this
|
||||
# special exception, which will cause the skeleton and the resulting
|
||||
# libocispec output files to be licensed under the GNU General Public
|
||||
# License without this special exception.
|
||||
import helpers
|
||||
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "utils.h"
|
||||
#include "request_cache.h"
|
||||
#include "constants.h"
|
||||
#include "isulad_config.h"
|
||||
|
||||
struct lws_context *WebsocketServer::m_context = nullptr;
|
||||
std::atomic<WebsocketServer *> WebsocketServer::m_instance;
|
||||
@ -385,6 +386,12 @@ void WebsocketServer::ServiceWorkThread(int threadid)
|
||||
|
||||
void WebsocketServer::Start(Errors &err)
|
||||
{
|
||||
m_listenPort = conf_get_websocket_server_listening_port();
|
||||
if (m_listenPort == 0) {
|
||||
err.SetError("Failed to get websocket server listening port from daemon config");
|
||||
return;
|
||||
}
|
||||
|
||||
if (CreateContext() < 0) {
|
||||
err.SetError("Websocket server start failed!, please check your network status"
|
||||
"(eg: port " + std::to_string(m_listenPort) + "is occupied)");
|
||||
|
||||
@ -116,7 +116,7 @@ private:
|
||||
RouteCallbackRegister m_handler;
|
||||
static std::map<struct lws *, session_data> m_wsis;
|
||||
url::URLDatum m_url;
|
||||
int m_listenPort = 10251;
|
||||
int m_listenPort;
|
||||
};
|
||||
|
||||
ssize_t WsWriteToClient(void *context, const void *data, size_t len);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user