2008-06-17 20:27:32 +04:00
/* -------------------------------------------------------------------------- */
2015-09-23 16:03:22 +03:00
/* Copyright 2002-2015, 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_
2010-04-11 00:19:49 +04:00
# include "SqlDB.h"
2012-11-30 05:59:26 +04:00
# include "SystemDB.h"
2008-06-17 20:27:32 +04:00
# include "NebulaTemplate.h"
# include "VirtualMachinePool.h"
2008-11-13 19:21:17 +03:00
# include "VirtualNetworkPool.h"
2008-06-17 20:27:32 +04:00
# include "HostPool.h"
2009-07-09 18:34:34 +04:00
# include "UserPool.h"
2011-03-30 21:03:49 +04:00
# include "VMTemplatePool.h"
2011-05-10 20:45:15 +04:00
# include "GroupPool.h"
2012-02-09 20:56:47 +04:00
# include "DatastorePool.h"
2012-02-24 18:53:53 +04:00
# include "ClusterPool.h"
2012-06-08 17:41:59 +04:00
# include "DocumentPool.h"
2013-12-12 22:08:59 +04:00
# include "ZonePool.h"
2014-09-08 13:50:25 +04:00
# include "SecurityGroupPool.h"
2014-12-19 19:30:00 +03:00
# include "VdcPool.h"
2008-06-17 20:27:32 +04:00
# include "VirtualMachineManager.h"
# include "LifeCycleManager.h"
# include "InformationManager.h"
# include "TransferManager.h"
# include "DispatchManager.h"
# include "RequestManager.h"
2009-04-04 03:34:33 +04:00
# include "HookManager.h"
2010-07-08 21:28:10 +04:00
# include "AuthManager.h"
2011-06-22 21:22:52 +04:00
# include "AclManager.h"
2011-03-22 20:21:09 +03:00
# include "ImageManager.h"
2008-06-17 20:27:32 +04:00
2012-11-26 15:48:10 +04:00
# include "DefaultQuotas.h"
2012-11-19 18:19:09 +04:00
2011-04-29 20:59:39 +04:00
# include "Callbackable.h"
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 .
*/
class Nebula
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
{
static Nebula nebulad ;
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
return nebulad ;
} ;
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
// --------------------------------------------------------------
2008-06-17 20:27:32 +04:00
VirtualMachinePool * get_vmpool ( )
{
return vmpool ;
2010-04-11 00:19:49 +04:00
} ;
2008-06-17 20:27:32 +04:00
HostPool * get_hpool ( )
{
return hpool ;
2010-04-11 00:19:49 +04:00
} ;
2008-11-13 19:21:17 +03:00
VirtualNetworkPool * get_vnpool ( )
{
return vnpool ;
} ;
2010-04-11 00:19:49 +04:00
2009-07-09 18:34:34 +04:00
UserPool * get_upool ( )
{
return upool ;
} ;
2008-06-17 20:27:32 +04:00
2010-06-25 15:24:54 +04:00
ImagePool * get_ipool ( )
{
return ipool ;
} ;
2011-05-10 20:45:15 +04:00
GroupPool * get_gpool ( )
{
return gpool ;
} ;
2011-03-30 21:03:49 +04:00
VMTemplatePool * get_tpool ( )
{
return tpool ;
} ;
2012-02-09 20:56:47 +04:00
DatastorePool * get_dspool ( )
{
return dspool ;
} ;
2012-02-24 18:53:53 +04:00
ClusterPool * get_clpool ( )
{
return clpool ;
} ;
2012-06-08 17:41:59 +04:00
DocumentPool * get_docpool ( )
{
return docpool ;
} ;
2013-12-12 22:08:59 +04:00
ZonePool * get_zonepool ( )
{
return zonepool ;
} ;
2014-09-08 13:50:25 +04:00
SecurityGroupPool * get_secgrouppool ( )
{
return secgrouppool ;
} ;
2014-12-19 19:30:00 +03:00
VdcPool * get_vdcpool ( )
{
return vdcpool ;
} ;
2008-06-17 20:27:32 +04:00
// --------------------------------------------------------------
// Manager Accessors
2010-04-11 00:19:49 +04:00
// --------------------------------------------------------------
2008-06-17 20:27:32 +04:00
VirtualMachineManager * get_vmm ( )
{
return vmm ;
} ;
LifeCycleManager * get_lcm ( )
{
return lcm ;
} ;
2010-04-11 00:19:49 +04:00
2015-07-01 22:15:40 +03:00
InformationManager * get_im ( )
2008-06-17 20:27:32 +04:00
{
return im ;
} ;
TransferManager * get_tm ( )
{
return tm ;
} ;
DispatchManager * get_dm ( )
{
return dm ;
} ;
2010-04-11 00:19:49 +04:00
2009-04-04 03:34:33 +04:00
HookManager * get_hm ( )
{
return hm ;
} ;
2010-04-11 00:19:49 +04:00
2010-07-08 21:28:10 +04:00
AuthManager * get_authm ( )
{
return authm ;
} ;
2011-03-22 20:21:09 +03:00
ImageManager * get_imagem ( )
{
return imagem ;
} ;
2011-06-22 21:22:52 +04:00
AclManager * get_aclm ( )
{
return aclm ;
} ;
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
2012-04-03 20:02:14 +04:00
/**
2013-01-31 23:43:17 +04:00
* Returns the value of LOG - > DEBUG_LEVEL in oned . conf file
2012-04-03 20:02:14 +04:00
* @ return the debug level , to instantiate Log ' ers
*/
Log : : MessageType get_debug_level ( ) const
{
2013-01-31 23:43:17 +04:00
Log : : MessageType clevel = Log : : ERROR ;
vector < const Attribute * > logs ;
int rc ;
int log_level_int ;
2012-04-03 20:02:14 +04:00
2013-01-31 23:43:17 +04:00
rc = nebula_configuration - > get ( " LOG " , logs ) ;
2012-04-03 20:02:14 +04:00
2013-01-31 23:43:17 +04:00
if ( rc ! = 0 )
2012-04-03 20:02:14 +04:00
{
2013-01-31 23:43:17 +04:00
string value ;
const VectorAttribute * log = static_cast < const VectorAttribute * >
( logs [ 0 ] ) ;
value = log - > vector_value ( " DEBUG_LEVEL " ) ;
log_level_int = atoi ( value . c_str ( ) ) ;
2013-07-16 18:51:40 +04:00
if ( Log : : ERROR < = log_level_int & & log_level_int < = Log : : DDDEBUG )
2013-01-31 23:43:17 +04:00
{
clevel = static_cast < Log : : MessageType > ( log_level_int ) ;
}
2012-04-03 20:02:14 +04:00
}
return clevel ;
}
2013-01-31 23:43:17 +04:00
/**
* Returns the value of LOG - > SYSTEM in oned . conf file
2013-02-01 21:49:03 +04:00
* @ return the logging system CERR , FILE_TS or SYSLOG
2013-01-31 23:43:17 +04:00
*/
2013-02-01 21:49:03 +04:00
NebulaLog : : LogType get_log_system ( ) const
2013-01-31 23:43:17 +04:00
{
2013-02-01 21:49:03 +04:00
vector < const Attribute * > logs ;
int rc ;
NebulaLog : : LogType log_system = NebulaLog : : UNDEFINED ;
2013-01-31 23:43:17 +04:00
rc = nebula_configuration - > get ( " LOG " , logs ) ;
if ( rc ! = 0 )
{
string value ;
const VectorAttribute * log = static_cast < const VectorAttribute * >
( logs [ 0 ] ) ;
2013-02-01 21:49:03 +04:00
value = log - > vector_value ( " SYSTEM " ) ;
log_system = NebulaLog : : str_to_type ( value ) ;
2013-01-31 23:43:17 +04:00
}
return log_system ;
2013-02-01 21:49:03 +04:00
} ;
2013-01-31 23:43:17 +04:00
2009-01-02 17:58:51 +03:00
/**
2010-04-11 00:19:49 +04:00
* Returns the value of ONE_LOCATION env variable . When this variable is
2009-01-02 17:58:51 +03:00
* not defined the nebula location is " / " .
2015-07-01 22:15:40 +03:00
* @ return the nebula location .
2010-04-11 00:19:49 +04:00
*/
2008-11-13 19:21:17 +03:00
const string & get_nebula_location ( )
2008-06-17 20:27:32 +04:00
{
return nebula_location ;
} ;
2009-01-02 17:58:51 +03:00
/**
2010-04-11 00:19:49 +04:00
* Returns the path where mad executables are stored , if ONE_LOCATION is
* defined this path points to $ ONE_LOCATION / bin , otherwise it is
2009-01-02 17:58:51 +03:00
* / usr / lib / one / mads .
2015-07-01 22:15:40 +03:00
* @ return the mad execs location .
2009-01-02 17:58:51 +03:00
*/
const string & get_mad_location ( )
{
2015-07-01 22:15:40 +03:00
return mad_location ;
2009-01-02 17:58:51 +03:00
} ;
/**
2010-04-11 00:19:49 +04:00
* Returns the path where defaults for mads are stored , if ONE_LOCATION is
2009-01-02 17:58:51 +03:00
* defined this path points to $ ONE_LOCATION / etc , otherwise it is / etc / one
2015-07-01 22:15:40 +03:00
* @ return the mad defaults location .
2009-01-02 17:58:51 +03:00
*/
const string & get_defaults_location ( )
{
2015-07-01 22:15:40 +03:00
return etc_location ;
2009-01-02 17:58:51 +03:00
} ;
2010-04-11 00:19:49 +04:00
2009-01-02 17:58:51 +03:00
/**
* Returns the path where logs ( oned . log , schedd . log , . . . ) are generated
2010-04-11 00:19:49 +04:00
* if ONE_LOCATION is defined this path points to $ ONE_LOCATION / var ,
2009-01-02 17:58:51 +03:00
* otherwise it is / var / log / one .
2015-07-01 22:15:40 +03:00
* @ return the log location .
2009-01-02 17:58:51 +03:00
*/
const string & get_log_location ( )
{
2015-07-01 22:15:40 +03:00
return log_location ;
2009-01-02 17:58:51 +03:00
} ;
/**
2012-02-25 02:13:22 +04:00
* Returns the default var location . When ONE_LOCATION is defined this path
* points to $ ONE_LOCATION / var , otherwise it is / var / lib / one .
2015-07-01 22:15:40 +03:00
* @ return the log location .
2009-01-02 17:58:51 +03:00
*/
const string & get_var_location ( )
{
2015-07-01 22:15:40 +03:00
return var_location ;
2009-01-02 17:58:51 +03:00
} ;
2010-04-11 00:19:49 +04:00
2013-10-20 17:11:13 +04:00
/**
*
*
*/
int get_ds_location ( int cluster_id , string & dsloc )
{
if ( cluster_id ! = - 1 )
{
Cluster * cluster = clpool - > get ( cluster_id , true ) ;
if ( cluster = = 0 )
{
return - 1 ;
}
cluster - > get_ds_location ( dsloc ) ;
cluster - > unlock ( ) ;
}
else
{
get_configuration_attribute ( " DATASTORE_LOCATION " , dsloc ) ;
}
return 0 ;
}
2012-10-28 22:19:57 +04:00
/**
* Returns the default vms location . When ONE_LOCATION is defined this path
* points to $ ONE_LOCATION / var / vms , otherwise it is / var / lib / one / vms . This
* location stores vm related files : deployment , transfer , context , and
* logs ( in self - contained mode only )
* @ return the vms location .
*/
const string & get_vms_location ( )
{
return vms_location ;
} ;
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 .
*/
string get_vm_log_filename ( int oid )
{
2015-07-01 22:15:40 +03:00
ostringstream oss ;
2010-04-11 00:19:49 +04:00
2015-07-01 22:15:40 +03:00
if ( nebula_location = = " / " )
{
oss < < log_location < < oid < < " .log " ;
}
else
{
oss < < vms_location < < oid < < " /vm.log " ;
}
2010-04-11 00:19:49 +04:00
2015-07-01 22:15:40 +03:00
return oss . str ( ) ;
2009-01-02 17:58:51 +03:00
} ;
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
*/
2008-11-13 19:21:17 +03:00
const string & get_nebula_hostname ( )
{
return hostname ;
} ;
2010-04-11 00:19:49 +04:00
2012-12-24 05:41:17 +04:00
/**
* Returns the version of oned
* @ return the version
*/
2008-06-17 20:27:32 +04:00
static string version ( )
{
2014-03-04 15:49:42 +04:00
return " OpenNebula " + code_version ( ) ;
2008-06-17 20:27:32 +04:00
} ;
2010-04-11 00:19:49 +04:00
2014-02-21 21:08:41 +04:00
/**
* Returns the version of oned
* @ return
*/
static string code_version ( )
{
2015-10-05 18:04:53 +03:00
return " 4.14.1 " ; // bump version
2014-02-21 21:08:41 +04:00
}
/**
2014-02-23 22:31:08 +04:00
* Version needed for the DB , shared tables
2014-02-21 21:08:41 +04:00
* @ return
*/
2014-02-23 22:31:08 +04:00
static string shared_db_version ( )
2011-04-29 20:59:39 +04:00
{
2015-01-14 18:53:39 +03:00
return " 4.11.80 " ;
2011-07-12 15:54:53 +04:00
}
2011-04-29 20:59:39 +04:00
2014-02-21 21:08:41 +04:00
/**
* Version needed for the DB , local tables
* @ return
*/
2014-02-23 22:31:08 +04:00
static string local_db_version ( )
2014-02-21 21:08:41 +04:00
{
2015-07-28 18:52:55 +03:00
return " 4.13.85 " ;
2014-02-21 21:08:41 +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
*/
2013-10-09 20:39:18 +04:00
void bootstrap_db ( ) ;
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 ;
} ;
2014-01-22 15:55:30 +04:00
int get_zone_id ( )
{
return zone_id ;
} ;
const string & get_master_oned ( )
{
return master_oned ;
} ;
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
*/
2008-06-17 20:27:32 +04:00
void get_configuration_attribute (
2010-04-11 00:19:49 +04:00
const char * name ,
2008-06-17 20:27:32 +04:00
string & value ) const
{
string _name ( name ) ;
2010-04-11 00:19:49 +04:00
2012-12-24 05:41:17 +04:00
nebula_configuration - > Template : : get ( _name , value ) ;
2008-06-17 20:27:32 +04:00
} ;
2010-04-11 00:19:49 +04:00
2014-01-24 03:14:38 +04:00
/**
2014-08-11 19:22:15 +04:00
* Gets a configuration attribute for oned ( long long version )
2014-01-24 03:14:38 +04:00
*/
void get_configuration_attribute (
const char * name ,
long long & value ) const
{
string _name ( name ) ;
nebula_configuration - > Template : : get ( _name , value ) ;
} ;
2014-08-11 19:22:15 +04:00
/**
* Gets a configuration attribute for oned ( time_t version )
*/
void get_configuration_attribute (
const char * name ,
time_t & value ) const
{
nebula_configuration - > get ( name , value ) ;
} ;
2012-12-24 05:41:17 +04:00
/**
* Gets a configuration attribute for oned , bool version
*/
void get_configuration_attribute (
const char * name ,
bool & value ) const
{
string _name ( name ) ;
nebula_configuration - > Template : : get ( _name , value ) ;
} ;
2013-10-23 18:15:18 +04:00
/**
* Gets a TM configuration attribute
*/
int get_tm_conf_attribute (
2013-10-24 17:29:36 +04:00
const string & tm_name ,
const VectorAttribute * & value ) const
2013-10-23 18:15:18 +04:00
{
2013-10-24 17:29:36 +04:00
vector < const Attribute * > : : const_iterator it ;
vector < const Attribute * > values ;
2013-10-23 18:15:18 +04:00
nebula_configuration - > Template : : get ( " TM_MAD_CONF " , values ) ;
for ( it = values . begin ( ) ; it ! = values . end ( ) ; it + + )
{
2013-10-24 17:29:36 +04:00
value = dynamic_cast < const VectorAttribute * > ( * it ) ;
2013-10-23 18:15:18 +04:00
if ( value = = 0 )
{
continue ;
}
if ( value - > vector_value ( " NAME " ) = = tm_name )
{
return 0 ;
}
}
value = 0 ;
return - 1 ;
} ;
2012-12-24 05:41:17 +04:00
/**
* Gets an XML document with all of the configuration attributes
* @ return the XML
*/
2012-11-14 15:54:31 +04:00
string get_configuration_xml ( ) const
{
string xml ;
return nebula_configuration - > to_xml ( xml ) ;
} ;
2012-12-24 05:41:17 +04:00
// -----------------------------------------------------------------------
// Default Quotas
// -----------------------------------------------------------------------
/**
* Get the default quotas for OpenNebula users
* @ return the default quotas
*/
2012-11-26 19:12:05 +04:00
const DefaultQuotas & get_default_user_quota ( )
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
*/
2012-11-23 19:03:10 +04:00
int set_default_user_quota ( Template * tmpl , string & error )
{
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
*/
2012-11-26 19:12:05 +04:00
const DefaultQuotas & get_default_group_quota ( )
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
*/
2012-11-23 19:03:10 +04:00
int set_default_group_quota ( Template * tmpl , string & error )
{
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
*/
int select_sys_attribute ( const string & attr_name , string & attr_xml )
{
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 (
const string & attr_name ,
const string & xml_attr ,
string & error_str )
{
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 (
const string & attr_name ,
const string & xml_attr ,
string & error_str )
{
return system_db - > update_sys_attribute ( attr_name , xml_attr , error_str ) ;
} ;
2008-06-17 20:27:32 +04:00
private :
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
2012-11-19 18:19:09 +04:00
Nebula ( ) : nebula_configuration ( 0 ) ,
2012-11-26 19:12:05 +04:00
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 " ,
" /DEFAULT_GROUP_QUOTAS/DATASTORE_QUOTA " ,
" /DEFAULT_GROUP_QUOTAS/NETWORK_QUOTA " ,
" /DEFAULT_GROUP_QUOTAS/IMAGE_QUOTA " ,
" /DEFAULT_GROUP_QUOTAS/VM_QUOTA " ) ,
2013-12-12 22:08:59 +04:00
system_db ( 0 ) , db ( 0 ) ,
vmpool ( 0 ) , hpool ( 0 ) , vnpool ( 0 ) , upool ( 0 ) , ipool ( 0 ) , gpool ( 0 ) , tpool ( 0 ) ,
2014-12-19 19:30:00 +03:00
dspool ( 0 ) , clpool ( 0 ) , docpool ( 0 ) , zonepool ( 0 ) , secgrouppool ( 0 ) , vdcpool ( 0 ) ,
2013-12-12 22:08:59 +04:00
lcm ( 0 ) , vmm ( 0 ) , im ( 0 ) , tm ( 0 ) , dm ( 0 ) , rm ( 0 ) , hm ( 0 ) , authm ( 0 ) ,
2012-11-30 05:59:26 +04:00
aclm ( 0 ) , imagem ( 0 )
2009-01-02 17:58:51 +03:00
{
2010-06-25 15:24:54 +04:00
const char * nl = getenv ( " ONE_LOCATION " ) ;
2009-01-02 17:58:51 +03:00
if ( nl = = 0 ) //OpenNebula installed under root directory
{
2010-06-25 15:24:54 +04:00
nebula_location = " / " ;
2010-04-11 00:19:49 +04:00
2010-08-17 02:28:48 +04:00
mad_location = " /usr/lib/one/mads/ " ;
etc_location = " /etc/one/ " ;
log_location = " /var/log/one/ " ;
var_location = " /var/lib/one/ " ;
2010-11-16 14:29:14 +03:00
remotes_location = " /var/lib/one/remotes/ " ;
2012-10-28 22:19:57 +04:00
vms_location = " /var/lib/one/vms/ " ;
2009-01-02 17:58:51 +03:00
}
else
{
2010-06-25 15:24:54 +04:00
nebula_location = nl ;
2010-04-11 00:19:49 +04:00
2010-06-25 15:24:54 +04:00
if ( nebula_location . at ( nebula_location . size ( ) - 1 ) ! = ' / ' )
{
nebula_location + = " / " ;
}
2010-04-11 00:19:49 +04:00
2010-08-17 02:28:48 +04:00
mad_location = nebula_location + " lib/mads/ " ;
etc_location = nebula_location + " etc/ " ;
log_location = nebula_location + " var/ " ;
var_location = nebula_location + " var/ " ;
2010-11-16 14:29:14 +03:00
remotes_location = nebula_location + " var/remotes/ " ;
2012-10-28 22:19:57 +04:00
vms_location = nebula_location + " var/vms/ " ;
2010-04-11 00:19:49 +04:00
}
2009-01-02 17:58:51 +03:00
} ;
2010-04-11 00:19:49 +04:00
2008-06-17 20:27:32 +04:00
~ Nebula ( )
{
2013-12-10 21:03:03 +04:00
delete vmpool ;
delete vnpool ;
delete hpool ;
delete upool ;
delete ipool ;
delete gpool ;
delete tpool ;
delete dspool ;
delete clpool ;
delete docpool ;
2013-12-12 22:08:59 +04:00
delete zonepool ;
2014-09-08 13:50:25 +04:00
delete secgrouppool ;
2014-12-19 19:30:00 +03:00
delete vdcpool ;
2013-12-10 21:03:03 +04:00
delete vmm ;
delete lcm ;
delete im ;
delete tm ;
delete dm ;
delete rm ;
delete hm ;
delete authm ;
delete aclm ;
delete imagem ;
delete nebula_configuration ;
delete db ;
delete system_db ;
2008-06-17 20:27:32 +04:00
} ;
2010-04-11 00:19:49 +04:00
Nebula & operator = ( Nebula const & ) { return * this ; } ;
2008-06-17 20:27:32 +04:00
// ---------------------------------------------------------------
// Environment variables
// ---------------------------------------------------------------
2010-04-11 00:19:49 +04:00
2009-01-02 17:58:51 +03:00
string nebula_location ;
2010-04-11 00:19:49 +04:00
2015-07-01 22:15:40 +03:00
string mad_location ;
string etc_location ;
string log_location ;
string var_location ;
2010-08-02 13:24:01 +04:00
string hook_location ;
2010-08-17 02:28:48 +04:00
string remotes_location ;
2012-10-28 22:19:57 +04:00
string vms_location ;
2010-08-17 02:28:48 +04:00
2015-07-01 22:15:40 +03:00
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
// ---------------------------------------------------------------
// Federation
// ---------------------------------------------------------------
bool federation_enabled ;
bool federation_master ;
int zone_id ;
string master_oned ;
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
// ---------------------------------------------------------------
SystemDB * system_db ;
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
SqlDB * db ;
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 ;
2010-04-11 00:19:49 +04:00
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 ;
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 ;
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 ) ;
} ;
# endif /*NEBULA_H_*/