mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-10 01:17:40 +03:00
F #4952: Add IPv6 support for oned
This commit is contained in:
parent
7cbceb043b
commit
4429031117
@ -43,15 +43,15 @@ class RequestManager : public ActionListener
|
||||
public:
|
||||
|
||||
RequestManager(
|
||||
int _port,
|
||||
const string& _port,
|
||||
int _max_conn,
|
||||
int _max_conn_backlog,
|
||||
int _keepalive_timeout,
|
||||
int _keepalive_max_conn,
|
||||
int _timeout,
|
||||
const string _xml_log_file,
|
||||
const string call_log_format,
|
||||
const string _listen_address,
|
||||
const string& _xml_log_file,
|
||||
const string& call_log_format,
|
||||
const string& _listen_address,
|
||||
int message_size);
|
||||
|
||||
~RequestManager(){};
|
||||
@ -105,7 +105,7 @@ private:
|
||||
/**
|
||||
* Port number where the connection will be open
|
||||
*/
|
||||
int port;
|
||||
string port;
|
||||
|
||||
/*
|
||||
* FD for the XML server socket
|
||||
|
@ -964,7 +964,6 @@ public:
|
||||
*/
|
||||
void clear_template_monitor_error();
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Timers & Requirements
|
||||
// ------------------------------------------------------------------------
|
||||
@ -993,7 +992,7 @@ public:
|
||||
* @param disk
|
||||
* @param pci_dev
|
||||
*/
|
||||
void get_requirements (int& cpu, int& memory, int& disk,
|
||||
void get_requirements(int& cpu, int& memory, int& disk,
|
||||
vector<VectorAttribute *>& pci_dev);
|
||||
|
||||
/**
|
||||
@ -1013,7 +1012,7 @@ public:
|
||||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
int check_resize (float cpu, int memory, int vcpu, string& error_str);
|
||||
int check_resize(float cpu, int memory, int vcpu, string& error_str);
|
||||
|
||||
/**
|
||||
* Resize the VM capacity
|
||||
@ -1024,7 +1023,7 @@ public:
|
||||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
int resize (float cpu, int memory, int vcpu, string& error_str);
|
||||
int resize(float cpu, int memory, int vcpu, string& error_str);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Virtual Machine Disks
|
||||
@ -1132,7 +1131,7 @@ public:
|
||||
* @param password Password to encrypt the token, if it is set
|
||||
* @return -1 in case of error, 0 if the VM has no context, 1 on success
|
||||
*/
|
||||
int generate_context(string &files, int &disk_id, const string& password);
|
||||
int generate_context(string &files, int &disk_id, const string& password);
|
||||
|
||||
/**
|
||||
* Returns the CREATED_BY template attribute, or the uid if it does not exist
|
||||
|
@ -370,8 +370,8 @@ void Nebula::start(bool bootstrap_only)
|
||||
//XML Library
|
||||
xmlCleanupParser();
|
||||
|
||||
NebulaLog::log("ONE", Log::INFO, "Database bootstrap finalized, exiting.\n");
|
||||
|
||||
NebulaLog::log("ONE", Log::INFO,
|
||||
"Database bootstrap finalized, exiting.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -918,7 +918,7 @@ void Nebula::start(bool bootstrap_only)
|
||||
// ---- Request Manager ----
|
||||
try
|
||||
{
|
||||
int rm_port = 0;
|
||||
string rm_port;
|
||||
int max_conn;
|
||||
int max_conn_backlog;
|
||||
int keepalive_timeout;
|
||||
|
@ -54,9 +54,8 @@
|
||||
|
||||
#include <sys/signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
@ -64,15 +63,15 @@
|
||||
|
||||
|
||||
RequestManager::RequestManager(
|
||||
int _port,
|
||||
const string& _port,
|
||||
int _max_conn,
|
||||
int _max_conn_backlog,
|
||||
int _keepalive_timeout,
|
||||
int _keepalive_max_conn,
|
||||
int _timeout,
|
||||
const string _xml_log_file,
|
||||
const string call_log_format,
|
||||
const string _listen_address,
|
||||
const string& _xml_log_file,
|
||||
const string& call_log_format,
|
||||
const string& _listen_address,
|
||||
int message_size):
|
||||
port(_port),
|
||||
socket_fd(-1),
|
||||
@ -167,11 +166,29 @@ extern "C" void * rm_xml_server_loop(void *arg)
|
||||
|
||||
int RequestManager::setup_socket()
|
||||
{
|
||||
int rc;
|
||||
int yes = 1;
|
||||
struct sockaddr_in rm_addr;
|
||||
int rc;
|
||||
int yes = 1;
|
||||
|
||||
socket_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
struct addrinfo hints = {0};
|
||||
struct addrinfo * result;
|
||||
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
|
||||
rc = getaddrinfo(listen_address.c_str(), port.c_str(), &hints, &result);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Cannot open server socket: " << gai_strerror(rc);
|
||||
NebulaLog::log("ReM",Log::ERROR,oss);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
socket_fd = socket(result->ai_family, result->ai_socktype, 0);
|
||||
|
||||
if ( socket_fd == -1 )
|
||||
{
|
||||
@ -180,6 +197,8 @@ int RequestManager::setup_socket()
|
||||
oss << "Cannot open server socket: " << strerror(errno);
|
||||
NebulaLog::log("ReM",Log::ERROR,oss);
|
||||
|
||||
freeaddrinfo(result);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -194,35 +213,24 @@ int RequestManager::setup_socket()
|
||||
|
||||
close(socket_fd);
|
||||
|
||||
freeaddrinfo(result);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
fcntl(socket_fd,F_SETFD,FD_CLOEXEC); // Close socket in MADs
|
||||
|
||||
rm_addr.sin_family = AF_INET;
|
||||
rm_addr.sin_port = htons(port);
|
||||
rc = bind(socket_fd, result->ai_addr, result->ai_addrlen);
|
||||
|
||||
rc = inet_aton(listen_address.c_str(), &rm_addr.sin_addr);
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Invalid listen address: " << listen_address;
|
||||
NebulaLog::log("ReM",Log::ERROR,oss);
|
||||
|
||||
close(socket_fd);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = bind(socket_fd,(struct sockaddr *) &(rm_addr),sizeof(struct sockaddr));
|
||||
freeaddrinfo(result);
|
||||
|
||||
if ( rc == -1)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "Cannot bind to " << listen_address << ":" << port << " : " << strerror(errno);
|
||||
oss << "Cannot bind to " << listen_address << ":" << port << " : "
|
||||
<< strerror(errno);
|
||||
|
||||
NebulaLog::log("ReM",Log::ERROR,oss);
|
||||
|
||||
close(socket_fd);
|
||||
|
Loading…
Reference in New Issue
Block a user