2008-06-17 20:27:32 +04:00
/* -------------------------------------------------------------------------- */
2024-07-29 15:25:20 +03:00
/* Copyright 2002-2024, OpenNebula Project, OpenNebula Systems */
2008-06-17 20:27:32 +04:00
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
# ifndef NEBULA_H_
# define NEBULA_H_
2021-05-04 12:38:25 +03:00
# include "NebulaService.h"
2020-03-04 18:05:57 +03:00
# include "OpenNebulaTemplate.h"
2019-12-10 13:45:15 +03:00
# include "SystemDB.h"
2008-06-17 20:27:32 +04:00
2012-11-26 15:48:10 +04:00
# include "DefaultQuotas.h"
2019-12-10 13:45:15 +03:00
# include "UserPool.h"
2021-04-20 14:40:44 +03:00
# include "Zone.h"
2012-11-19 18:19:09 +04:00
2019-12-10 13:45:15 +03:00
class LogDB ;
class FedLogDB ;
class User ;
2023-07-03 19:15:52 +03:00
class BackupJobPool ;
2019-12-10 13:45:15 +03:00
class ClusterPool ;
class DatastorePool ;
class DocumentPool ;
class GroupPool ;
class HookPool ;
class HostPool ;
class ImagePool ;
class MarketPlacePool ;
class MarketPlaceAppPool ;
2023-07-03 19:15:52 +03:00
class ScheduledActionPool ;
2019-12-10 13:45:15 +03:00
class SecurityGroupPool ;
class VdcPool ;
class VMGroupPool ;
class VMTemplatePool ;
class VNTemplatePool ;
class VirtualMachinePool ;
class VirtualNetworkPool ;
class VirtualRouterPool ;
class ZonePool ;
class AclManager ;
class AuthManager ;
class DispatchManager ;
class FedReplicaManager ;
class HookLog ;
class HookManager ;
class ImageManager ;
class InformationManager ;
class IPAMManager ;
class LifeCycleManager ;
class MarketPlaceManager ;
class RaftManager ;
class RequestManager ;
2023-07-03 19:15:52 +03:00
class ScheduledActionManager ;
2019-12-10 13:45:15 +03:00
class TransferManager ;
class VirtualMachineManager ;
2012-11-30 05:59:26 +04:00
/**
* This is the main class for the OpenNebula daemon oned . It stores references
* to the main modules and data pools . It also includes functions to bootstrap
* the system and start all its components .
*/
2021-05-04 12:38:25 +03:00
class Nebula : public NebulaService
2008-06-17 20:27:32 +04:00
{
public :
2010-04-11 00:19:49 +04:00
static Nebula & instance ( )
2008-06-17 20:27:32 +04:00
{
2021-05-04 12:38:25 +03:00
return static_cast < Nebula & > ( NebulaService : : instance ( ) ) ;
2008-06-17 20:27:32 +04:00
} ;
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
// --------------------------------------------------------------
// Pool Accessors
2010-04-11 00:19:49 +04:00
// --------------------------------------------------------------
2020-07-05 23:01:32 +03:00
LogDB * get_logdb ( ) const
2017-04-21 17:52:54 +03:00
{
return logdb ;
} ;
2010-04-11 00:19:49 +04:00
2020-07-05 23:01:32 +03:00
VirtualMachinePool * get_vmpool ( ) const
2008-06-17 20:27:32 +04:00
{
return vmpool ;
2010-04-11 00:19:49 +04:00
} ;
2008-06-17 20:27:32 +04:00
2020-07-05 23:01:32 +03:00
HostPool * get_hpool ( ) const
2008-06-17 20:27:32 +04:00
{
return hpool ;
2010-04-11 00:19:49 +04:00
} ;
2020-07-05 23:01:32 +03:00
VirtualNetworkPool * get_vnpool ( ) const
2008-11-13 19:21:17 +03:00
{
return vnpool ;
} ;
2010-04-11 00:19:49 +04:00
2020-07-05 23:01:32 +03:00
UserPool * get_upool ( ) const
2009-07-09 18:34:34 +04:00
{
return upool ;
} ;
2008-06-17 20:27:32 +04:00
2020-07-05 23:01:32 +03:00
ImagePool * get_ipool ( ) const
2010-06-25 15:24:54 +04:00
{
return ipool ;
} ;
2020-07-05 23:01:32 +03:00
GroupPool * get_gpool ( ) const
2011-05-10 20:45:15 +04:00
{
return gpool ;
} ;
2020-07-05 23:01:32 +03:00
VMTemplatePool * get_tpool ( ) const
2011-03-30 21:03:49 +04:00
{
return tpool ;
} ;
2020-07-05 23:01:32 +03:00
DatastorePool * get_dspool ( ) const
2012-02-09 20:56:47 +04:00
{
return dspool ;
} ;
2020-07-05 23:01:32 +03:00
ClusterPool * get_clpool ( ) const
2012-02-24 18:53:53 +04:00
{
return clpool ;
} ;
2020-07-05 23:01:32 +03:00
DocumentPool * get_docpool ( ) const
2012-06-08 17:41:59 +04:00
{
return docpool ;
} ;
2020-07-05 23:01:32 +03:00
ZonePool * get_zonepool ( ) const
2013-12-12 22:08:59 +04:00
{
return zonepool ;
} ;
2020-07-05 23:01:32 +03:00
SecurityGroupPool * get_secgrouppool ( ) const
2014-09-08 13:50:25 +04:00
{
return secgrouppool ;
} ;
2020-07-05 23:01:32 +03:00
VdcPool * get_vdcpool ( ) const
2014-12-19 19:30:00 +03:00
{
return vdcpool ;
} ;
2020-07-05 23:01:32 +03:00
VirtualRouterPool * get_vrouterpool ( ) const
2015-11-30 18:50:23 +03:00
{
return vrouterpool ;
} ;
2020-07-05 23:01:32 +03:00
MarketPlacePool * get_marketpool ( ) const
2015-12-06 01:52:28 +03:00
{
2015-12-11 17:53:19 +03:00
return marketpool ;
2015-12-06 01:52:28 +03:00
} ;
2015-12-11 17:53:19 +03:00
2020-07-05 23:01:32 +03:00
MarketPlaceAppPool * get_apppool ( ) const
2015-12-11 17:53:19 +03:00
{
return apppool ;
} ;
2020-07-05 23:01:32 +03:00
VMGroupPool * get_vmgrouppool ( ) const
2017-01-03 03:22:10 +03:00
{
return vmgrouppool ;
} ;
2020-07-05 23:01:32 +03:00
VNTemplatePool * get_vntpool ( ) const
2019-09-09 15:43:51 +03:00
{
2018-11-20 19:24:59 +03:00
return vntpool ;
}
2020-07-05 23:01:32 +03:00
HookPool * get_hkpool ( ) const
2019-09-09 15:43:51 +03:00
{
return hkpool ;
}
2023-07-03 19:15:52 +03:00
BackupJobPool * get_bjpool ( ) const
{
return bjpool ;
}
ScheduledActionPool * get_sapool ( ) const
{
return sapool ;
}
2008-06-17 20:27:32 +04:00
// --------------------------------------------------------------
// Manager Accessors
2010-04-11 00:19:49 +04:00
// --------------------------------------------------------------
2020-07-05 23:01:32 +03:00
VirtualMachineManager * get_vmm ( ) const
2008-06-17 20:27:32 +04:00
{
return vmm ;
} ;
2020-07-05 23:01:32 +03:00
LifeCycleManager * get_lcm ( ) const
2008-06-17 20:27:32 +04:00
{
return lcm ;
} ;
2010-04-11 00:19:49 +04:00
2020-07-05 23:01:32 +03:00
InformationManager * get_im ( ) const
2008-06-17 20:27:32 +04:00
{
return im ;
} ;
2020-07-05 23:01:32 +03:00
TransferManager * get_tm ( ) const
2008-06-17 20:27:32 +04:00
{
return tm ;
} ;
2020-07-05 23:01:32 +03:00
DispatchManager * get_dm ( ) const
2008-06-17 20:27:32 +04:00
{
return dm ;
} ;
2010-04-11 00:19:49 +04:00
2020-07-05 23:01:32 +03:00
HookManager * get_hm ( ) const
2009-04-04 03:34:33 +04:00
{
return hm ;
} ;
2010-04-11 00:19:49 +04:00
2020-07-05 23:01:32 +03:00
HookLog * get_hl ( ) const
2019-09-09 15:43:51 +03:00
{
return hl ;
} ;
2020-07-05 23:01:32 +03:00
AuthManager * get_authm ( ) const
2010-07-08 21:28:10 +04:00
{
return authm ;
} ;
2020-07-05 23:01:32 +03:00
ImageManager * get_imagem ( ) const
2011-03-22 20:21:09 +03:00
{
return imagem ;
} ;
2020-07-05 23:01:32 +03:00
AclManager * get_aclm ( ) const
2011-06-22 21:22:52 +04:00
{
return aclm ;
} ;
2020-07-05 23:01:32 +03:00
MarketPlaceManager * get_marketm ( ) const
2015-12-14 18:47:33 +03:00
{
return marketm ;
} ;
2020-07-05 23:01:32 +03:00
IPAMManager * get_ipamm ( ) const
2016-08-18 22:42:24 +03:00
{
return ipamm ;
} ;
2020-07-05 23:01:32 +03:00
RaftManager * get_raftm ( ) const
2017-04-25 18:15:31 +03:00
{
return raftm ;
} ;
2017-05-18 22:13:54 +03:00
2020-07-05 23:01:32 +03:00
FedReplicaManager * get_frm ( ) const
2017-05-18 22:13:54 +03:00
{
return frm ;
} ;
2020-07-05 23:01:32 +03:00
RequestManager * get_rm ( ) const
2019-09-09 15:43:51 +03:00
{
return rm ;
} ;
2023-07-03 19:15:52 +03:00
ScheduledActionManager * get_sam ( ) const
{
return sam ;
}
2008-06-17 20:27:32 +04:00
// --------------------------------------------------------------
// Environment & Configuration
2009-01-02 17:58:51 +03:00
// --------------------------------------------------------------
2010-04-11 00:19:49 +04:00
2013-10-20 17:11:13 +04:00
/**
*
*
*/
2020-07-05 23:01:32 +03:00
void get_ds_location ( std : : string & dsloc ) const ;
2013-10-20 17:11:13 +04:00
2009-01-02 17:58:51 +03:00
/**
* Returns the path of the log file for a VM , depending where OpenNebula is
* installed ,
* $ ONE_LOCATION / var / $ VM_ID / vm . log
* or
* / var / log / one / $ VM_ID . log
* @ return the log location for the VM .
*/
2020-07-05 23:01:32 +03:00
std : : string get_vm_log_filename ( int oid ) const ;
2010-04-11 00:19:49 +04:00
2012-12-24 05:41:17 +04:00
/**
* Returns the name of the host running oned
* @ return the name
*/
2020-07-05 23:01:32 +03:00
const std : : string & get_nebula_hostname ( ) const
2008-11-13 19:21:17 +03:00
{
return hostname ;
} ;
2010-04-11 00:19:49 +04:00
2012-12-24 05:41:17 +04:00
/**
* Starts all the modules and services for OpenNebula
*/
2013-10-08 17:09:30 +04:00
void start ( bool bootstrap_only = false ) ;
2010-04-11 00:19:49 +04:00
2013-10-05 23:34:55 +04:00
/**
* Initialize the database
*/
2016-01-04 13:29:20 +03:00
void bootstrap_db ( )
{
start ( true ) ;
}
2013-10-05 23:34:55 +04:00
2014-01-22 15:55:30 +04:00
// --------------------------------------------------------------
// Federation
// --------------------------------------------------------------
bool is_federation_enabled ( )
{
return federation_enabled ;
} ;
bool is_federation_master ( )
{
return federation_master ;
} ;
2014-01-22 21:54:48 +04:00
bool is_federation_slave ( )
{
return federation_enabled & & ! federation_master ;
} ;
2019-02-19 14:40:07 +03:00
bool is_cache ( )
{
return cache ;
} ;
2020-07-05 23:01:32 +03:00
int get_zone_id ( ) const
2014-01-22 15:55:30 +04:00
{
return zone_id ;
} ;
2020-07-05 23:01:32 +03:00
int get_server_id ( ) const
2017-04-21 17:52:54 +03:00
{
return server_id ;
} ;
2020-07-05 23:01:32 +03:00
const std : : string & get_master_oned ( ) const
2014-01-22 15:55:30 +04:00
{
return master_oned ;
} ;
2021-04-20 14:40:44 +03:00
void set_zone_state ( Zone : : ZoneState state )
{
zone_state = state ;
}
Zone : : ZoneState get_zone_state ( ) const
{
return zone_state ;
}
/**
* Update actual zone state from the DB
*/
void update_zone_state ( ) ;
2012-12-24 05:41:17 +04:00
// -----------------------------------------------------------------------
// Configuration attributes (read from oned.conf)
// -----------------------------------------------------------------------
/**
* Gets a configuration attribute for oned
* @ param name of the attribute
* @ param value of the attribute
*/
2016-02-04 15:10:42 +03:00
template < typename T >
2020-07-02 23:42:10 +03:00
void get_configuration_attribute ( const std : : string & name , T & value ) const
2014-08-11 19:22:15 +04:00
{
2021-05-04 12:38:25 +03:00
config - > get ( name , value ) ;
2014-08-11 19:22:15 +04:00
} ;
2017-03-13 01:39:45 +03:00
/**
* Gets a user - configurable attribute for oned . Users ( and groups ) may
* store oned attributes in the " OPENNEBULA " vector . This function gets
* the value querying first the user , then the group and finally oned . conf
2017-03-21 14:23:02 +03:00
* @ param uid of the user , if - 1 the user template is not considered
2017-03-13 01:39:45 +03:00
* @ param gid of the group
* @ param name of the attribute
* @ param value of the attribute
*
* @ return 0 on success - 1 otherwise
*/
template < typename T >
int get_configuration_attribute ( int uid , int gid , const std : : string & name ,
2024-06-03 12:40:24 +03:00
T & value ) const
2017-03-13 01:39:45 +03:00
{
2017-03-21 14:23:02 +03:00
if ( uid ! = - 1 )
2017-03-13 01:39:45 +03:00
{
2020-09-10 10:08:29 +03:00
auto user = upool - > get_ro ( uid ) ;
2017-03-21 14:23:02 +03:00
2020-09-10 10:08:29 +03:00
if ( ! user )
2017-03-21 14:23:02 +03:00
{
return - 1 ;
}
2017-03-13 01:39:45 +03:00
2020-09-10 10:08:29 +03:00
auto uconf = user - > get_template_attribute ( " OPENNEBULA " ) ;
2017-03-13 01:39:45 +03:00
2020-09-10 10:08:29 +03:00
if ( uconf ! = nullptr )
2017-03-13 01:39:45 +03:00
{
2017-03-21 14:23:02 +03:00
if ( uconf - > vector_value ( name , value ) = = 0 )
{
return 0 ;
}
2017-03-13 01:39:45 +03:00
}
2017-03-21 14:23:02 +03:00
}
2017-03-13 01:39:45 +03:00
2020-09-10 10:08:29 +03:00
auto group = gpool - > get_ro ( gid ) ;
2017-03-13 01:39:45 +03:00
2020-09-10 10:08:29 +03:00
if ( ! group )
2017-03-13 01:39:45 +03:00
{
return - 1 ;
}
2020-09-10 10:08:29 +03:00
auto gconf = group - > get_template_attribute ( " OPENNEBULA " ) ;
2017-03-13 01:39:45 +03:00
2020-09-10 10:08:29 +03:00
if ( gconf ! = nullptr )
2017-03-13 01:39:45 +03:00
{
if ( gconf - > vector_value ( name , value ) = = 0 )
{
return 0 ;
}
}
2021-05-04 12:38:25 +03:00
config - > get ( name , value ) ;
2017-03-13 01:39:45 +03:00
return 0 ;
}
2015-12-21 21:27:26 +03:00
/**
* Gets a DS configuration attribute
*/
2016-08-31 15:52:33 +03:00
int get_ds_conf_attribute ( const std : : string & ds_name ,
2024-06-03 12:40:24 +03:00
const VectorAttribute * & value ) const
2016-02-09 18:33:13 +03:00
{
return get_conf_attribute ( " DS_MAD_CONF " , ds_name , value ) ;
} ;
2015-12-21 21:27:26 +03:00
2018-09-20 14:07:05 +03:00
/**
* Gets a VN configuration attribute
*/
int get_vn_conf_attribute ( const std : : string & vn_name ,
2024-06-03 12:40:24 +03:00
const VectorAttribute * & value ) const
2018-09-20 14:07:05 +03:00
{
return get_conf_attribute ( " VN_MAD_CONF " , vn_name , value ) ;
}
2013-10-23 18:15:18 +04:00
/**
* Gets a TM configuration attribute
*/
2020-07-02 23:42:10 +03:00
int get_tm_conf_attribute ( const std : : string & tm_name ,
2024-06-03 12:40:24 +03:00
const VectorAttribute * & value ) const
2016-02-09 18:33:13 +03:00
{
return get_conf_attribute ( " TM_MAD_CONF " , tm_name , value ) ;
} ;
2013-10-23 18:15:18 +04:00
2016-02-03 18:03:22 +03:00
/**
* Gets a Market configuration attribute
*/
2020-07-02 23:42:10 +03:00
int get_market_conf_attribute ( const std : : string & mk_name ,
2024-06-03 12:40:24 +03:00
const VectorAttribute * & value ) const
2016-02-09 18:33:13 +03:00
{
return get_conf_attribute ( " MARKET_MAD_CONF " , mk_name , value ) ;
} ;
2016-02-03 18:03:22 +03:00
2016-06-29 18:17:18 +03:00
/**
* Gets an Auth driver configuration attribute
*/
2016-08-31 15:52:33 +03:00
template < typename T >
2020-07-02 23:42:10 +03:00
int get_auth_conf_attribute ( const std : : string & driver ,
2024-06-03 12:40:24 +03:00
const std : : string & attribute ,
T & value ) const
2016-06-29 18:17:18 +03:00
{
2016-08-31 15:52:33 +03:00
return get_conf_attribute ( " AUTH_MAD_CONF " , driver , attribute , value ) ;
2016-06-29 18:17:18 +03:00
} ;
2017-01-30 15:19:32 +03:00
/**
* Return the Authorization operation for a VM action
*
*/
2020-07-05 23:01:32 +03:00
AuthRequest : : Operation get_vm_auth_op ( VMActions : : Action action ) const
2017-01-30 15:19:32 +03:00
{
return nebula_configuration - > get_vm_auth_op ( action ) ;
}
2019-01-30 02:10:18 +03:00
/**
* Gets the database backend type
* @ return database backend type
*/
2020-07-02 23:42:10 +03:00
const std : : string & get_db_backend ( ) const
2019-01-30 02:10:18 +03:00
{
return db_backend_type ;
}
2012-12-24 05:41:17 +04:00
// -----------------------------------------------------------------------
// Default Quotas
// -----------------------------------------------------------------------
/**
* Get the default quotas for OpenNebula users
* @ return the default quotas
*/
2020-07-05 23:01:32 +03:00
const DefaultQuotas & get_default_user_quota ( ) const
2012-11-19 18:19:09 +04:00
{
return default_user_quota ;
} ;
2012-12-24 05:41:17 +04:00
/**
* Set the default quotas for OpenNebula users
* @ param tmpl template with the default quotas
* @ param error describes the error if any
*
* @ return 0 if success
*/
2020-07-02 23:42:10 +03:00
int set_default_user_quota ( Template * tmpl , std : : string & error )
2012-11-23 19:03:10 +04:00
{
2012-12-24 05:41:17 +04:00
int rc = default_user_quota . set ( tmpl , error ) ;
2012-11-26 21:14:12 +04:00
if ( rc = = 0 )
{
2012-11-30 05:59:26 +04:00
rc = default_user_quota . update ( ) ;
2012-11-26 21:14:12 +04:00
}
return rc ;
2012-11-23 19:03:10 +04:00
} ;
2012-12-24 05:41:17 +04:00
/**
* Get the default quotas for OpenNebula for groups
* @ return the default quotas
*/
2020-07-05 23:01:32 +03:00
const DefaultQuotas & get_default_group_quota ( ) const
2012-11-19 19:38:39 +04:00
{
return default_group_quota ;
} ;
2012-12-24 05:41:17 +04:00
/**
* Set the default quotas for OpenNebula groups
* @ param tmpl template with the default quotas
* @ param error describes the error if any
*
* @ return 0 if success
*/
2020-07-02 23:42:10 +03:00
int set_default_group_quota ( Template * tmpl , std : : string & error )
2012-11-23 19:03:10 +04:00
{
2012-12-24 05:41:17 +04:00
int rc = default_group_quota . set ( tmpl , error ) ;
2012-11-26 21:14:12 +04:00
if ( rc = = 0 )
{
2012-11-30 05:59:26 +04:00
rc = default_group_quota . update ( ) ;
2012-11-26 21:14:12 +04:00
}
return rc ;
2012-11-23 19:03:10 +04:00
} ;
2012-11-30 05:59:26 +04:00
// -----------------------------------------------------------------------
// System attributes
// -----------------------------------------------------------------------
/**
* Reads a System attribute from the DB
* @ param attr_name name of the attribute
* @ param cb Callback that will receive the attribute in XML
* @ return 0 on success
*/
2020-07-02 23:42:10 +03:00
int select_sys_attribute ( const std : : string & attr_name , std : : string & attr_xml )
2012-11-30 05:59:26 +04:00
{
return system_db - > select_sys_attribute ( attr_name , attr_xml ) ;
} ;
/**
* Writes a system attribute in the database .
* @ param db pointer to the db
* @ return 0 on success
*/
int insert_sys_attribute (
2024-06-03 12:40:24 +03:00
const std : : string & attr_name ,
const std : : string & xml_attr ,
std : : string & error_str )
2012-11-30 05:59:26 +04:00
{
return system_db - > insert_sys_attribute ( attr_name , xml_attr , error_str ) ;
} ;
/**
* Updates the system attribute in the database .
* @ param db pointer to the db
* @ return 0 on success
*/
int update_sys_attribute (
2024-06-03 12:40:24 +03:00
const std : : string & attr_name ,
const std : : string & xml_attr ,
std : : string & error_str )
2012-11-30 05:59:26 +04:00
{
return system_db - > update_sys_attribute ( attr_name , xml_attr , error_str ) ;
} ;
2010-04-11 00:19:49 +04:00
// -----------------------------------------------------------------------
2008-06-17 20:27:32 +04:00
//Constructors and = are private to only access the class through instance
// -----------------------------------------------------------------------
2010-04-11 00:19:49 +04:00
2023-02-02 14:48:43 +03:00
Nebula ( )
: nebula_configuration ( 0 )
, federation_enabled ( false )
, federation_master ( false )
, cache ( false )
, zone_id ( 0 )
, server_id ( - 1 )
, default_user_quota ( " DEFAULT_USER_QUOTAS " ,
" /DEFAULT_USER_QUOTAS/DATASTORE_QUOTA " ,
" /DEFAULT_USER_QUOTAS/NETWORK_QUOTA " ,
" /DEFAULT_USER_QUOTAS/IMAGE_QUOTA " ,
" /DEFAULT_USER_QUOTAS/VM_QUOTA " )
, default_group_quota ( " DEFAULT_GROUP_QUOTAS " ,
2024-06-03 12:40:24 +03:00
" /DEFAULT_GROUP_QUOTAS/DATASTORE_QUOTA " ,
" /DEFAULT_GROUP_QUOTAS/NETWORK_QUOTA " ,
" /DEFAULT_GROUP_QUOTAS/IMAGE_QUOTA " ,
" /DEFAULT_GROUP_QUOTAS/VM_QUOTA " )
2023-02-02 14:48:43 +03:00
, system_db ( 0 ) , db_backend_type ( " sqlite " ) , logdb ( 0 ) , fed_logdb ( 0 )
, vmpool ( 0 ) , hpool ( 0 ) , vnpool ( 0 ) , upool ( 0 ) , ipool ( 0 ) , gpool ( 0 ) , tpool ( 0 )
, dspool ( 0 ) , clpool ( 0 ) , docpool ( 0 ) , zonepool ( 0 ) , secgrouppool ( 0 )
, vdcpool ( 0 ) , vrouterpool ( 0 ) , marketpool ( 0 ) , apppool ( 0 ) , vmgrouppool ( 0 )
2023-07-03 19:15:52 +03:00
, vntpool ( 0 ) , hkpool ( 0 ) , bjpool ( 0 ) , sapool ( 0 )
, lcm ( 0 ) , vmm ( 0 ) , im ( 0 ) , tm ( 0 ) , dm ( 0 ) , rm ( 0 ) , hm ( 0 )
2023-02-02 14:48:43 +03:00
, hl ( 0 ) , authm ( 0 ) , aclm ( 0 ) , imagem ( 0 ) , marketm ( 0 ) , ipamm ( 0 ) , raftm ( 0 ) , frm ( 0 )
2023-07-03 19:15:52 +03:00
, sam ( 0 )
2009-01-02 17:58:51 +03:00
{
} ;
2010-04-11 00:19:49 +04:00
2019-12-10 13:45:15 +03:00
~ Nebula ( ) ;
2010-04-11 00:19:49 +04:00
2021-05-04 12:38:25 +03:00
private :
2023-02-02 14:48:43 +03:00
Nebula & operator = ( Nebula const & ) = delete ;
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
// ---------------------------------------------------------------
// Environment variables
// ---------------------------------------------------------------
2010-04-11 00:19:49 +04:00
2020-07-02 23:42:10 +03:00
std : : string hostname ;
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
// ---------------------------------------------------------------
// Configuration
// ---------------------------------------------------------------
2012-11-30 05:59:26 +04:00
OpenNebulaTemplate * nebula_configuration ;
2010-04-11 00:19:49 +04:00
2014-01-22 15:55:30 +04:00
// ---------------------------------------------------------------
2017-04-30 00:25:53 +03:00
// Federation - HA
2014-01-22 15:55:30 +04:00
// ---------------------------------------------------------------
2020-07-02 23:42:10 +03:00
bool federation_enabled ;
bool federation_master ;
bool cache ;
int zone_id ;
int server_id ;
std : : string master_oned ;
2021-04-20 14:40:44 +03:00
Zone : : ZoneState zone_state = Zone : : ENABLED ;
2014-01-22 15:55:30 +04:00
2012-11-19 18:19:09 +04:00
// ---------------------------------------------------------------
// Default quotas
// ---------------------------------------------------------------
2012-11-26 15:48:10 +04:00
DefaultQuotas default_user_quota ;
DefaultQuotas default_group_quota ;
2012-11-19 18:19:09 +04:00
2012-11-30 05:59:26 +04:00
// ---------------------------------------------------------------
// The system database
// ---------------------------------------------------------------
2020-07-02 23:42:10 +03:00
SystemDB * system_db ;
std : : string db_backend_type ;
2012-11-19 18:19:09 +04:00
2008-06-17 20:27:32 +04:00
// ---------------------------------------------------------------
// Nebula Pools
// ---------------------------------------------------------------
2010-04-11 00:19:49 +04:00
2017-04-21 17:52:54 +03:00
LogDB * logdb ;
2017-05-22 19:04:16 +03:00
FedLogDB * fed_logdb ;
2008-06-17 20:27:32 +04:00
VirtualMachinePool * vmpool ;
2008-11-13 19:21:17 +03:00
HostPool * hpool ;
VirtualNetworkPool * vnpool ;
2009-07-09 18:34:34 +04:00
UserPool * upool ;
2010-06-01 20:00:44 +04:00
ImagePool * ipool ;
2011-05-10 20:45:15 +04:00
GroupPool * gpool ;
2011-03-30 21:03:49 +04:00
VMTemplatePool * tpool ;
2012-02-09 20:56:47 +04:00
DatastorePool * dspool ;
2012-02-24 18:53:53 +04:00
ClusterPool * clpool ;
2012-06-08 17:41:59 +04:00
DocumentPool * docpool ;
2013-12-12 22:08:59 +04:00
ZonePool * zonepool ;
2014-09-08 13:50:25 +04:00
SecurityGroupPool * secgrouppool ;
2014-12-19 19:30:00 +03:00
VdcPool * vdcpool ;
2015-11-30 18:50:23 +03:00
VirtualRouterPool * vrouterpool ;
2015-12-11 17:53:19 +03:00
MarketPlacePool * marketpool ;
MarketPlaceAppPool * apppool ;
2017-01-03 03:22:10 +03:00
VMGroupPool * vmgrouppool ;
2018-11-20 19:24:59 +03:00
VNTemplatePool * vntpool ;
2019-09-09 15:43:51 +03:00
HookPool * hkpool ;
2023-07-03 19:15:52 +03:00
BackupJobPool * bjpool ;
ScheduledActionPool * sapool ;
2008-06-17 20:27:32 +04:00
// ---------------------------------------------------------------
// Nebula Managers
// ---------------------------------------------------------------
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
LifeCycleManager * lcm ;
VirtualMachineManager * vmm ;
InformationManager * im ;
TransferManager * tm ;
DispatchManager * dm ;
RequestManager * rm ;
2009-04-04 03:34:33 +04:00
HookManager * hm ;
2019-09-09 15:43:51 +03:00
HookLog * hl ;
2010-07-08 21:28:10 +04:00
AuthManager * authm ;
2011-06-22 21:22:52 +04:00
AclManager * aclm ;
2011-03-22 20:21:09 +03:00
ImageManager * imagem ;
2015-12-14 18:47:33 +03:00
MarketPlaceManager * marketm ;
2016-08-18 22:42:24 +03:00
IPAMManager * ipamm ;
2017-04-25 18:15:31 +03:00
RaftManager * raftm ;
2017-05-18 22:13:54 +03:00
FedReplicaManager * frm ;
2023-07-03 19:15:52 +03:00
ScheduledActionManager * sam ;
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
// ---------------------------------------------------------------
// Implementation functions
// ---------------------------------------------------------------
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
friend void nebula_signal_handler ( int sig ) ;
2016-02-03 18:03:22 +03:00
// ---------------------------------------------------------------
// Helper functions
// ---------------------------------------------------------------
/**
* Gets a Generic configuration attribute
* @ param key String that identifies the configuration parameter group name
* @ param name Name of the specific configuration parameter
* @ param value Value of the specific configuration parameter
* @ return a reference to the generated string
*/
int get_conf_attribute (
2024-06-03 12:40:24 +03:00
const std : : string & key ,
const std : : string & name ,
const VectorAttribute * & value ) const ;
2016-02-03 18:03:22 +03:00
2016-08-31 15:52:33 +03:00
/**
* Gets a Generic configuration attribute
* @ param key String that identifies the configuration parameter group name
* @ param name Name of the specific configuration parameter
* @ param value Value of the specific configuration parameter
* @ return a reference to the generated string
*/
template < typename T >
int get_conf_attribute (
2024-06-03 12:40:24 +03:00
const std : : string & key ,
const std : : string & name ,
const std : : string & vname ,
T & value ) const
2016-08-31 15:52:33 +03:00
{
const VectorAttribute * vattr ;
if ( get_conf_attribute ( key , name , vattr ) ! = 0 )
{
return - 1 ;
}
return vattr - > vector_value ( vname , value ) ;
}
2008-06-17 20:27:32 +04:00
} ;
# endif /*NEBULA_H_*/