1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-18 06:03:39 +03:00

L #-: Add Astyle linting

* Add AStyle to smoke tests
* Format C++ files using AStyle
This commit is contained in:
Pavel Czerný 2024-06-03 11:40:24 +02:00 committed by GitHub
parent 4f8e837fd9
commit 2fe396ae15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
382 changed files with 79574 additions and 79104 deletions

View File

@ -19,6 +19,8 @@ jobs:
run: gem install rubocop
- name: Install CppCheck
run: sudo apt install -y cppcheck
- name: Install AStyle
run: sudo apt install -y astyle
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

View File

@ -90,7 +90,7 @@ public:
* @return true if the authorization is granted for oneadmin
*/
bool oneadmin_authorize(const PoolObjectAuth& obj_perms,
AuthRequest::Operation op) const;
AuthRequest::Operation op) const;
/**
* Adds a new rule to the ACL rule set

View File

@ -64,11 +64,11 @@ public:
/**
* Set the fields of the ACL, and updates its representation
*/
void set(int _oid,
long long _user,
long long _resource,
long long _rights,
long long _zone)
void set(int _oid,
long long _user,
long long _resource,
long long _rights,
long long _zone)
{
oid = _oid;
user = _user;

View File

@ -28,7 +28,7 @@ template <typename T>
class ActionSet
{
public:
ActionSet():action_set(0UL){};
ActionSet():action_set(0UL) {};
ActionSet(const T * actions, int actions_len):action_set(0)
{
for (int i=0; i<actions_len; i++)
@ -37,7 +37,7 @@ public:
}
};
~ActionSet(){};
~ActionSet() {};
/* Set the action in the set */
void set(T action)

View File

@ -33,7 +33,7 @@ class AddressRange
{
public:
virtual ~AddressRange(){};
virtual ~AddressRange() {};
// *************************************************************************
// Address Range types
@ -166,7 +166,7 @@ public:
* A vector containing just -1 means all VRouters.
*/
void to_xml(std::ostringstream &oss, const std::vector<int>& vms,
const std::vector<int>& vnets, const std::vector<int>& vrs) const;
const std::vector<int>& vnets, const std::vector<int>& vrs) const;
/**
* Same as above but without the LEASES section
@ -194,7 +194,7 @@ public:
* @return 0 if success
*/
int allocate_addr(PoolObjectSQL::ObjectType ot, int obid,
VectorAttribute * nic, const std::set<std::string> &inherit);
VectorAttribute * nic, const std::set<std::string> &inherit);
/**
* Returns the specific address by mac/ip if is not allocated. The NIC attr
@ -207,13 +207,13 @@ public:
* @return 0 if success
*/
int allocate_by_mac(const std::string& mac, PoolObjectSQL::ObjectType ot,
int obid, VectorAttribute * nic, const std::set<std::string> &inherit);
int obid, VectorAttribute * nic, const std::set<std::string> &inherit);
int allocate_by_ip(const std::string& ip, PoolObjectSQL::ObjectType ot,
int obid, VectorAttribute * nic, const std::set<std::string> &inherit);
int obid, VectorAttribute * nic, const std::set<std::string> &inherit);
int allocate_by_ip6(const std::string& ip6, PoolObjectSQL::ObjectType ot,
int obid, VectorAttribute * nic, const std::set<std::string> &inherit);
int obid, VectorAttribute * nic, const std::set<std::string> &inherit);
/**
* Sets the given ip/mac on hold, the address is associated to a VM of
@ -237,7 +237,7 @@ public:
int free_addr_by_ip(PoolObjectSQL::ObjectType ot, int id, const std::string& ip);
int free_addr_by_ip6(PoolObjectSQL::ObjectType ot, int id,const std::string& ip);
int free_addr_by_ip6(PoolObjectSQL::ObjectType ot, int id, const std::string& ip);
/**
* Frees all previous allocated address to the given object
@ -257,7 +257,7 @@ public:
* @return the number of addresses freed
*/
int free_addr_by_range(PoolObjectSQL::ObjectType ot, int obid,
const std::string& mac, unsigned int rsize);
const std::string& mac, unsigned int rsize);
/**
* Adds the relevant AR definition attributes to the Security Group rule
@ -288,13 +288,13 @@ public:
* @return 0 on success
*/
int reserve_addr_by_mac(int vid, unsigned int rsize, const std::string& mac,
AddressRange *rar);
AddressRange *rar);
int reserve_addr_by_ip(int vid, unsigned int rsize, const std::string& ip,
AddressRange *rar);
AddressRange *rar);
int reserve_addr_by_ip6(int vid, unsigned int rsize, const std::string& ip,
AddressRange *rar);
AddressRange *rar);
// *************************************************************************
// Helpers
@ -437,7 +437,7 @@ protected:
* Base constructor it cannot be called directly but from the
* AddressRange factory constructor.
*/
AddressRange(unsigned int _id):id(_id){};
AddressRange(unsigned int _id):id(_id) {};
/* ---------------------------------------------------------------------- */
/* Address/AR helper functions to build/parse driver messages */
@ -462,7 +462,7 @@ protected:
* @param oss string stream to write the request to
*/
void addr_to_xml(unsigned int index, unsigned int size,
std::ostringstream& oss) const;
std::ostringstream& oss) const;
/**
* Check if the given MAC is valid for this address range by verifying:
@ -611,7 +611,7 @@ private:
* @return 0 on success
*/
static int ip6_to_s(const unsigned int prefix[], const unsigned int mac[],
std::string& ip6_s);
std::string& ip6_s);
static int ip6_to_s(const unsigned int ip6_i[], std::string& ip6_s);
@ -686,7 +686,7 @@ private:
* Adds a new allocated address to the map. Updates the ALLOCATED attribute
*/
void set_allocated_addr(PoolObjectSQL::ObjectType ot, int obid,
unsigned int addr_index);
unsigned int addr_index);
/**
* Sets the address lease as used and fills a NIC attribute with the
@ -699,16 +699,16 @@ private:
* @return 0 if success
*/
void allocate_by_index(unsigned int index,
PoolObjectSQL::ObjectType ot,
int obid,
VectorAttribute* nic,
const std::set<std::string>& inherit);
PoolObjectSQL::ObjectType ot,
int obid,
VectorAttribute* nic,
const std::set<std::string>& inherit);
/**
* Frees an address from the map. Updates the ALLOCATED attribute
*/
int free_allocated_addr(PoolObjectSQL::ObjectType ot, int obid,
unsigned int addr_index);
unsigned int addr_index);
/**
* Reserve a set of addresses from an starting one
@ -719,7 +719,7 @@ private:
* @return 0 on success
*/
int reserve_addr_by_index(int vid, unsigned int rsize, unsigned int sindex,
AddressRange *rar);
AddressRange *rar);
/* ---------------------------------------------------------------------- */
/* Restricted Attributes functions */

View File

@ -26,9 +26,9 @@ class VectorAttribute;
class AddressRangeIPAM : public AddressRange
{
public:
AddressRangeIPAM(unsigned int _id):AddressRange(_id){};
AddressRangeIPAM(unsigned int _id):AddressRange(_id) {};
virtual ~AddressRangeIPAM(){};
virtual ~AddressRangeIPAM() {};
/* ---------------------------------------------------------------------- */
/* AddressRange Interface */

View File

@ -26,9 +26,9 @@ class VectorAttribute;
class AddressRangeInternal : public AddressRange
{
public:
AddressRangeInternal(unsigned int _id):AddressRange(_id), next(0){};
AddressRangeInternal(unsigned int _id):AddressRange(_id), next(0) {};
virtual ~AddressRangeInternal(){};
virtual ~AddressRangeInternal() {};
/* ---------------------------------------------------------------------- */
/* AddressRange Interface */

View File

@ -89,8 +89,8 @@ public:
* @return 0 on success
*/
int update_ar(std::vector<VectorAttribute *> ars, bool keep_restricted,
std::set<int>& update_ids, std::unique_ptr<VectorAttribute>& update_attr,
std::string& error_msg);
std::set<int>& update_ids, std::unique_ptr<VectorAttribute>& update_attr,
std::string& error_msg);
/**
* Allocates a new *empty* address range. It is not added to the pool as it
* needs to be initialized. Only the AR_ID is set.
@ -121,7 +121,7 @@ public:
* @return 0 if success
*/
int allocate_addr(PoolObjectSQL::ObjectType ot, int obid,
VectorAttribute * nic, const std::set<std::string> &inherit);
VectorAttribute * nic, const std::set<std::string> &inherit);
/**
* Allocates an address in a suitable address range from the pool by mac/ip
@ -175,13 +175,13 @@ public:
* @param mac/ip the specific MAC/IP address requested
*/
void free_addr(unsigned int arid, PoolObjectSQL::ObjectType ot, int obid,
const std::string& mac);
const std::string& mac);
void free_addr_by_ip(unsigned int arid, PoolObjectSQL::ObjectType ot,
int obid, const std::string& ip);
int obid, const std::string& ip);
void free_addr_by_ip6(unsigned int arid, PoolObjectSQL::ObjectType ot,
int obid, const std::string& ip);
int obid, const std::string& ip);
/**
* Frees the given address by MAC/IP from all address ranges containing
@ -216,7 +216,7 @@ public:
* @param rsize size of the address range
*/
int free_addr_by_range(unsigned int arid, PoolObjectSQL::ObjectType ot,
int obid, const std::string& mac, unsigned int rsize);
int obid, const std::string& mac, unsigned int rsize);
/**
* From a Security Group rule that uses this vnet, creates a new rule
@ -253,7 +253,7 @@ public:
* @return 0 on success
*/
int reserve_addr(int vid, unsigned int rsize, unsigned int ar_id,
AddressRange *rar);
AddressRange *rar);
/**
* Reserve a number of addresses from an address range from a given ip/mac
@ -265,13 +265,13 @@ public:
* @return 0 on success
*/
int reserve_addr_by_mac(int vid, unsigned int rsize, unsigned int ar_id,
const std::string& mac, AddressRange *rar);
const std::string& mac, AddressRange *rar);
int reserve_addr_by_ip(int vid, unsigned int rsize, unsigned int ar_id,
const std::string& ip, AddressRange *rar);
const std::string& ip, AddressRange *rar);
int reserve_addr_by_ip6(int vid, unsigned int rsize, unsigned int ar_id,
const std::string& ip, AddressRange *rar);
const std::string& ip, AddressRange *rar);
// *************************************************************************

View File

@ -45,11 +45,11 @@ public:
if ((size >0 && !(isalpha(aname[0]) || aname[0] == '_')) ||
(size >=3 && (aname[0]=='X' && aname[1]=='M' && aname[2]=='L')))
{
attribute_name.insert(0,"ONE_");
attribute_name.insert(0, "ONE_");
}
};
virtual ~Attribute(){};
virtual ~Attribute() {};
enum AttributeType
{
@ -82,7 +82,7 @@ public:
virtual void to_token(std::ostringstream& s) const = 0;
virtual void to_xml(std::ostringstream& s,
const std::map<std::string, std::set<std::string>> &hidden) const = 0;
const std::map<std::string, std::set<std::string>> &hidden) const = 0;
/**
* Builds a new attribute from a string.
@ -145,7 +145,7 @@ public:
, attribute_value(sa.attribute_value)
{}
~SingleAttribute(){};
~SingleAttribute() {};
/**
* Returns the attribute value, a string.
@ -182,17 +182,17 @@ public:
}
void to_xml(std::ostringstream& s,
const std::map<std::string, std::set<std::string>> &hidden) const override
const std::map<std::string, std::set<std::string>> &hidden) const override
{
s << "<" << attribute_name << ">";
if (hidden.find(attribute_name) != hidden.end() )
{
s << "***";
s << "***";
}
else
{
s << one_util::escape_xml(attribute_value);
s << one_util::escape_xml(attribute_value);
}
s << "</"<< attribute_name << ">";
@ -282,7 +282,7 @@ public:
{}
VectorAttribute(const std::string& name,
const std::map<std::string,std::string>& value)
const std::map<std::string, std::string>& value)
: Attribute(name)
, attribute_value(value)
{}
@ -296,12 +296,12 @@ public:
VectorAttribute& operator=(const VectorAttribute& va) = default;
~VectorAttribute(){};
~VectorAttribute() {};
/**
* Returns the attribute value, a string.
*/
const std::map<std::string,std::string>& value() const
const std::map<std::string, std::string>& value() const
{
return attribute_value;
};
@ -452,7 +452,7 @@ public:
void to_xml(std::ostringstream& s) const override;
void to_xml(std::ostringstream& s,
const std::map<std::string, std::set<std::string>> &hidden) const override;
const std::map<std::string, std::set<std::string>> &hidden) const override;
void to_json(std::ostringstream& s) const override;
@ -467,7 +467,7 @@ public:
/**
* Replace the value of the given attribute with the provided map
*/
void replace(const std::map<std::string,std::string>& attr);
void replace(const std::map<std::string, std::string>& attr);
/**
* The attributes from vattr will be copied to this vector
@ -560,7 +560,7 @@ private:
static const int magic_sep_size;
std::map<std::string,std::string> attribute_value;
std::map<std::string, std::string> attribute_value;
};
#endif /*ATTRIBUTE_H_*/

View File

@ -29,17 +29,17 @@ class AuthRequest;
class AuthManager :
public DriverManager<Driver<auth_msg_t>>,
public Listener
public Listener
{
public:
AuthManager(
time_t timer,
const std::string& mads_location)
: DriverManager(mads_location)
, Listener("Authorization Manager")
, timer_thread(timer, [this](){timer_action();})
, authz_enabled(false)
time_t timer,
const std::string& mads_location)
: DriverManager(mads_location)
, Listener("Authorization Manager")
, timer_thread(timer, [this]() {timer_action();})
, authz_enabled(false)
{
}
@ -88,9 +88,9 @@ private:
*/
static const char * auth_driver_name;
/**
* True if there is an authorization driver enabled
*/
/**
* True if there is an authorization driver enabled
*/
bool authz_enabled;
/**

View File

@ -40,7 +40,7 @@ public:
, self_authorize(true)
{}
~AuthRequest(){};
~AuthRequest() {};
/**
* Authorization Request Type
@ -78,11 +78,11 @@ public:
static Operation str_to_operation(const std::string& str)
{
if (str == "USE") return USE;
else if (str == "MANAGE") return MANAGE;
else if (str == "ADMIN") return ADMIN;
else if (str == "CREATE") return CREATE;
else return NONE;
if (str == "USE") return USE;
else if (str == "MANAGE") return MANAGE;
else if (str == "ADMIN") return ADMIN;
else if (str == "CREATE") return CREATE;
else return NONE;
};
/**

View File

@ -36,7 +36,7 @@
class Increment : public ExtendedAttribute
{
public:
Increment(VectorAttribute *va, int id): ExtendedAttribute(va, id){};
Increment(VectorAttribute *va, int id): ExtendedAttribute(va, id) {};
~Increment() = default;
@ -90,7 +90,7 @@ public:
case FULL:
replace("TYPE", "FULL");
break;
case INCREMENT:
case INCREMENT:
replace("TYPE", "INCREMENT");
break;
}
@ -121,7 +121,7 @@ public:
class IncrementSet : public ExtendedAttributeSet
{
public:
IncrementSet(): ExtendedAttributeSet(false){};
IncrementSet(): ExtendedAttributeSet(false) {};
~IncrementSet() = default;
@ -146,7 +146,7 @@ public:
* @return Pointer to the new attribute
*/
VectorAttribute * new_increment(const std::string& source, long long sz,
Increment::Type type);
Increment::Type type);
Increment * last_increment()
{
@ -182,10 +182,10 @@ public:
class IncIterator : public AttributeIterator
{
public:
IncIterator():AttributeIterator(){};
IncIterator(const AttributeIterator& dit):AttributeIterator(dit){};
IncIterator():AttributeIterator() {};
IncIterator(const AttributeIterator& dit):AttributeIterator(dit) {};
virtual ~IncIterator(){};
virtual ~IncIterator() {};
Increment * operator*() const
{
@ -229,7 +229,7 @@ private:
class BackupIncrements
{
public:
BackupIncrements():_template(false,'=',"BACKUP_INCREMENTS"){};
BackupIncrements():_template(false, '=', "BACKUP_INCREMENTS") {};
~BackupIncrements() = default;

View File

@ -242,8 +242,8 @@ public:
* @return 0 on success
*/
int replace_template(const std::string& tmpl_str,
bool keep_restricted,
std::string& error) override;
bool keep_restricted,
std::string& error) override;
/**
* Append new attributes to the *user template*.
@ -254,7 +254,7 @@ public:
* @return 0 on success
*/
int append_template(const std::string& tmpl_str, bool keep_restricted,
std::string& error) override;
std::string& error) override;
friend class BackupJobPool;
friend class PoolSQL;
@ -296,7 +296,7 @@ protected:
* @param db pointer to the database.
* @return 0 on success.
*/
int update(SqlDB * db) override;
int update(SqlDB * db) override;
/**
* Execute an INSERT or REPLACE Sql query.
@ -394,7 +394,7 @@ private:
*/
int process_backup_vms(const std::string& vms_new_str,
const std::string& vms_old_str,
std::string& error);
std::string& error);
/**
* Remove Backup Job ID from Virtual Machines listed in BACKUP_VMS attribute

View File

@ -47,14 +47,14 @@ public:
* -2 in case of template parse failure
*/
int allocate (
int uid,
int gid,
const std::string& uname,
const std::string& gname,
int umask,
std::unique_ptr<Template> templ,
int * oid,
std::string& error_str);
int uid,
int gid,
const std::string& uname,
const std::string& gname,
int umask,
std::unique_ptr<Template> templ,
int * oid,
std::string& error_str);
/**
* Updates an Image in the data base. It also updates the previous state
@ -128,7 +128,7 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "BACKUPJOB_POOL", "body", one_db::backup_job_table,
where, sid, eid, desc);

View File

@ -175,7 +175,7 @@ public:
{
bs->reset(bit);
}
catch(const std::out_of_range& oor){};
catch(const std::out_of_range& oor) {};
}
/**
@ -196,7 +196,7 @@ public:
rc = 0;
}
}
catch(const std::out_of_range& oor){};
catch(const std::out_of_range& oor) {};
return rc;
}
@ -304,7 +304,7 @@ private:
else
{
oss << "INSERT INTO " << db_table << " (id, map) VALUES ("
<< id << ",'" << ezipped64 << "')";
<< id << ",'" << ezipped64 << "')";
}
int rc = db->exec_wr(oss);

View File

@ -43,7 +43,7 @@ public:
/**
* Datatype for call back pointers
*/
typedef int (Callbackable::*Callback)(void *, int, char ** ,char **);
typedef int (Callbackable::*Callback)(void *, int, char **, char **);
/**
* Set the callback function and custom arguments to be executed by the
@ -91,9 +91,9 @@ public:
_mutex.unlock();
}
/**
* set affected rows variable
*/
/**
* set affected rows variable
*/
void set_affected_rows(int num_rows)
{
affected_rows = num_rows;
@ -277,7 +277,7 @@ private:
class string_cb : public Callbackable
{
public:
string_cb(int _total):total_values(_total){};
string_cb(int _total):total_values(_total) {};
void set_callback(std::string * _str)
{
@ -317,7 +317,7 @@ private:
class stream_cb : public Callbackable
{
public:
stream_cb(int _total): total_values(_total){};
stream_cb(int _total): total_values(_total) {};
void set_callback(std::ostringstream * _oss)
{
@ -358,7 +358,7 @@ private:
class empty_cb : public Callbackable
{
public:
void set_callback(Callback _cb, void * _arg = 0){};
void set_callback(Callback _cb, void * _arg = 0) {};
bool isCallBackSet() override
{

View File

@ -48,7 +48,7 @@ public:
* Singleton initializer
*/
static Client * initialize(const std::string& secret,
const std::string& endpoint, size_t message_size, unsigned int tout)
const std::string& endpoint, size_t message_size, unsigned int tout)
{
if ( _client == 0 )
{
@ -69,16 +69,16 @@ public:
*/
static int read_oneauth(std::string &secret, std::string& error);
/**
/**
* Performs a xmlrpc call to the initialized server
* @param method name
* @param plist initialized param list
* @param result of the xmlrpc call
*/
void call(const std::string& method, const xmlrpc_c::paramList& plist,
xmlrpc_c::value * const result);
xmlrpc_c::value * const result);
/**
/**
* Performs a xmlrpc call
* @param endpoint of server
* @param method name
@ -89,10 +89,10 @@ public:
* @return 0
*/
static int call(const std::string& endpoint, const std::string& method,
const xmlrpc_c::paramList& plist, unsigned int _timeout,
xmlrpc_c::value * const result, std::string& error);
const xmlrpc_c::paramList& plist, unsigned int _timeout,
xmlrpc_c::value * const result, std::string& error);
/**
/**
* Performs an xmlrpc call to the initialized server and credentials.
* This method automatically adds the credential argument.
* @param method name
@ -102,7 +102,7 @@ public:
* @param ... xmlrpc arguments
*/
void call(const std::string &method, const std::string &format,
xmlrpc_c::value * const result, ...);
xmlrpc_c::value * const result, ...);
void refresh_authentication();
@ -119,12 +119,12 @@ private:
* @throws Exception if the authorization options are invalid
*/
Client(const std::string& secret, const std::string& endpoint, size_t message_size,
unsigned int tout);
unsigned int tout);
std::string one_auth;
std::string one_endpoint;
unsigned int timeout;
unsigned int timeout;
static Client * _client;
};

View File

@ -122,7 +122,7 @@ private:
unsigned int base_port = vnc_bitmap.get_start_bit();
unsigned int hint_port = base_port + (vmid % (65535 - base_port));
return vnc_bitmap.get(hint_port,port);
return vnc_bitmap.get(hint_port, port);
}
void release_vnc_port(int port)
@ -233,17 +233,17 @@ private:
* @param db pointer to the db
* @return 0 on success
*/
int select(SqlDB *db, const std::string& _name, int _uid) override
{
int rc = PoolObjectSQL::select(db, _name, _uid);
int select(SqlDB *db, const std::string& _name, int _uid) override
{
int rc = PoolObjectSQL::select(db, _name, _uid);
if ( rc != 0 )
{
return rc;
}
if ( rc != 0 )
{
return rc;
}
return vnc_bitmap.select(oid, db);
}
return vnc_bitmap.select(oid, db);
}
/**
* Checks if all the collections are empty, and therefore this cluster

View File

@ -29,7 +29,7 @@ public:
const VectorAttribute * vnc_conf,
const std::vector<const SingleAttribute *>& encrypted_attrs);
~ClusterPool(){};
~ClusterPool() {};
/* ---------------------------------------------------------------------- */
/* Constants for DB management */
@ -175,7 +175,7 @@ public:
rc = Cluster::bootstrap(_db);
rc += _db->exec_local_wr(
BitMap<0>::bootstrap(one_db::cluster_bitmap_table, oss_bitmap));
BitMap<0>::bootstrap(one_db::cluster_bitmap_table, oss_bitmap));
return rc;
};
@ -192,7 +192,7 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "CLUSTER_POOL", "body",
one_db::cluster_table, where,
@ -207,7 +207,7 @@ public:
* @param cids vector of cluster ids
*/
static void cluster_acl_filter(std::ostringstream& filter,
PoolObjectSQL::ObjectType auth_object, const std::vector<int>& cids);
PoolObjectSQL::ObjectType auth_object, const std::vector<int>& cids);
/**
* Returns the Datastore Clusters performing a DB query
@ -269,7 +269,7 @@ private:
*/
PoolObjectSQL * create() override
{
return new Cluster(-1,"",0, &vnc_conf);
return new Cluster(-1, "", 0, &vnc_conf);
};
};

View File

@ -27,11 +27,11 @@ class ClusterTemplate : public Template
{
public:
ClusterTemplate():
Template(false,'=',"TEMPLATE"){};
Template(false, '=', "TEMPLATE") {};
~ClusterTemplate(){};
~ClusterTemplate() {};
ClusterTemplate(ClusterTemplate& ct):Template(ct){};
ClusterTemplate(ClusterTemplate& ct):Template(ct) {};
// -------------------------------------------------------------------------
// Encrypted attributes interface implementation

View File

@ -69,9 +69,9 @@ public:
protected:
Clusterable(const std::set<int> &_cluster_ids):
cluster_ids("CLUSTERS", _cluster_ids){};
cluster_ids("CLUSTERS", _cluster_ids) {};
~Clusterable(){};
~Clusterable() {};
/**
* IDs of the clusters this object belongs to.

View File

@ -58,9 +58,9 @@ protected:
ClusterableSingle(int _cluster_id, const std::string& _cluster):
cluster_id(_cluster_id),
cluster(_cluster){};
cluster(_cluster) {};
~ClusterableSingle(){};
~ClusterableSingle() {};
/**
* ID of the cluster this object belongs to.

View File

@ -327,22 +327,22 @@ private:
/**
* Disk types for the Images created in this datastore
*/
Image::DiskType disk_type;
Image::DiskType disk_type;
/**
* Total datastore capacity in MB
*/
long long total_mb;
long long total_mb;
/**
* Available datastore capacity in MB
*/
long long free_mb;
long long free_mb;
/**
* Used datastore capacity in MB
*/
long long used_mb;
long long used_mb;
/**
* Datastore state

View File

@ -29,7 +29,7 @@ public:
const std::vector<const SingleAttribute *>& _inherit_attrs,
const std::vector<const SingleAttribute *>& encrypted_attrs);
~DatastorePool(){};
~DatastorePool() {};
/* ---------------------------------------------------------------------- */
/* Constants for DB management */
@ -149,10 +149,10 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "DATASTORE_POOL", "body", one_db::ds_table,
where, sid, eid, desc);
where, sid, eid, desc);
};
/**
@ -161,18 +161,18 @@ public:
*
* @return 0 on success
*/
int list(std::vector<int>& oids)
{
int list(std::vector<int>& oids)
{
return PoolSQL::list(oids, one_db::ds_table);
}
}
/**
* Adds to the disk the datastore inherit attributes and conf values
* @param ds_id of the datastore to use
* @para disk vector attribute for the disk
*
* @return -1 if the DS does not exists
*/
/**
* Adds to the disk the datastore inherit attributes and conf values
* @param ds_id of the datastore to use
* @para disk vector attribute for the disk
*
* @return -1 if the DS does not exists
*/
int disk_attribute(int ds_id, VirtualMachineDisk * disk);
/**
@ -209,7 +209,7 @@ private:
{
std::set<int> empty;
return new Datastore(-1,-1,"","", 0, 0, empty);
return new Datastore(-1, -1, "", "", 0, 0, empty);
};
};

View File

@ -27,11 +27,11 @@ class DatastoreTemplate : public Template
{
public:
DatastoreTemplate():
Template(false,'=',"TEMPLATE"){};
Template(false, '=', "TEMPLATE") {};
~DatastoreTemplate(){};
~DatastoreTemplate() {};
DatastoreTemplate(DatastoreTemplate& dt):Template(dt){};
DatastoreTemplate(DatastoreTemplate& dt):Template(dt) {};
// -------------------------------------------------------------------------
// Encrypted attributes interface implementation

View File

@ -28,11 +28,11 @@ public:
const char * _net_xpath,
const char * _img_xpath,
const char * _vm_xpath):
Quotas(_ds_xpath, _net_xpath, _img_xpath, _vm_xpath, true),
root_elem(_root_elem)
Quotas(_ds_xpath, _net_xpath, _img_xpath, _vm_xpath, true),
root_elem(_root_elem)
{};
~DefaultQuotas(){};
~DefaultQuotas() {};
/**
* Generates a string representation of the quotas in XML format

View File

@ -49,10 +49,10 @@ public:
~DispatchManager() = default;
/**
* Initializes internal pointers to other managers. Must be called when
* all the other managers exist in Nebula::instance
*/
/**
* Initializes internal pointers to other managers. Must be called when
* all the other managers exist in Nebula::instance
*/
void init_managers();
/**
@ -124,7 +124,7 @@ public:
* in a wrong a state
*/
int terminate(int vid, bool hard, const RequestAttributes& request,
std::string& error_str);
std::string& error_str);
/**
* Shuts down a VM, but it is saved in the system DS instead of destroyed.
@ -135,7 +135,7 @@ public:
* in a wrong a state
*/
int undeploy(int vid, bool hard, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Powers off a VM.
@ -146,7 +146,7 @@ public:
* in a wrong a state
*/
int poweroff(int vid, bool hard, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Holds a VM.
@ -247,7 +247,7 @@ public:
* @return 0 on success
*/
int retry(std::unique_ptr<VirtualMachine> vm, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Reboots a VM preserving any resource and RUNNING state
@ -258,7 +258,7 @@ public:
* in a wrong a state
*/
int reboot(int vid, bool hard, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Set the re-scheduling flag for the VM (must be in RUNNING state)
@ -270,7 +270,7 @@ public:
* in a wrong a state
*/
int resched(int vid, bool do_resched, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Starts the attach disk action.
@ -282,7 +282,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int attach(int vid, VirtualMachineTemplate * tmpl,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Starts the detach disk action.
@ -294,7 +294,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int detach(int id, int disk_id, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Starts the attach NIC action.
@ -306,7 +306,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int attach_nic(int vid, VirtualMachineTemplate * tmpl,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Starts the detach NIC action.
@ -318,7 +318,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int detach_nic(int id, int nic_id, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Starts the update NIC action.
@ -363,7 +363,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int snapshot_create(int vid, std::string& name, int& snap_id,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Starts the snapshot revert action
@ -376,7 +376,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int snapshot_revert(int vid, int snap_id, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Starts the snapshot delete action
@ -389,7 +389,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int snapshot_delete(int vid, int snap_id, const RequestAttributes& ra,
std::string& error_str);
std::string& error_str);
/**
* Starts the disk snapshot create action
@ -404,7 +404,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int disk_snapshot_create(int vid, int did, const std::string& name,
int& snap_id, const RequestAttributes& ra, std::string& error_str);
int& snap_id, const RequestAttributes& ra, std::string& error_str);
/**
* Reverts the disk state to a previous snapshot
@ -418,7 +418,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int disk_snapshot_revert(int vid, int did, int snap_id,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Deletes a disk snapshot
@ -432,7 +432,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int disk_snapshot_delete(int vid, int did, int snap_id,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Starts the disk resize create action
@ -446,7 +446,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int disk_resize(int vid, int did, long long new_size,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Update virtual machine context
@ -458,7 +458,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int live_updateconf(std::unique_ptr<VirtualMachine> vm,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Attach a new SG to a VM NIC
@ -472,7 +472,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int attach_sg(int vid, int nicid, int sgid,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Detach a SG from VM NIC
@ -486,7 +486,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int detach_sg(int vid, int nicid, int sgid,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Backup a VM
@ -500,7 +500,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int backup(int vid, int bck_ds_id, bool reset,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Cancel ongoing backup operation
@ -526,7 +526,7 @@ public:
* @return 0 on success, -1 otherwise
*/
int restore(int vid, int img_id, int inc_id, int disk_id,
const RequestAttributes& ra, std::string& error_str);
const RequestAttributes& ra, std::string& error_str);
/**
* Resize cpu and memory
@ -553,8 +553,8 @@ public:
*
* @return 0 on success, -1 otherwise
*/
int attach_pci(int vid, VectorAttribute * pci, const RequestAttributes& ra,
std::string& err);
int attach_pci(int vid, VectorAttribute * pci, const RequestAttributes& ra,
std::string& err);
/**
* Detach an existing PCI device
*
@ -566,8 +566,8 @@ public:
*
* @return 0 on success, -1 otherwise
*/
int detach_pci(int vid, int pci_id, const RequestAttributes& ra,
std::string& err);
int detach_pci(int vid, int pci_id, const RequestAttributes& ra,
std::string& err);
//--------------------------------------------------------------------------
// DM Actions associated with a VM state transition
@ -586,7 +586,7 @@ public:
void trigger_resubmit(int vid);
static void close_cp_history(VirtualMachinePool *vmpool, VirtualMachine *vm,
VMActions::Action action, const RequestAttributes& ra);
VMActions::Action action, const RequestAttributes& ra);
private:
/**

View File

@ -29,11 +29,12 @@ class DocumentPool : public PoolSQL
public:
DocumentPool(SqlDB * db, const std::vector<const SingleAttribute *>& ea) :
PoolSQL(db, one_db::doc_table) {
PoolSQL(db, one_db::doc_table)
{
DocumentTemplate::parse_encrypted(ea);
};
~DocumentPool(){};
~DocumentPool() {};
/**
* Allocates a new object, writing it in the pool database. No memory is
@ -61,9 +62,9 @@ public:
std::string& error_str)
{
*oid = PoolSQL::allocate(
new Document(-1, uid, gid, uname, gname, umask, type,
std::move(template_contents)),
error_str);
new Document(-1, uid, gid, uname, gname, umask, type,
std::move(template_contents)),
error_str);
return *oid;
}
@ -103,7 +104,7 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "DOCUMENT_POOL", "body", one_db::doc_table,
where, sid, eid, desc);
@ -125,7 +126,7 @@ private:
*/
PoolObjectSQL * create() override
{
return new Document(-1,-1,-1,"","",0,0,0);
return new Document(-1, -1, -1, "", "", 0, 0, 0);
};
};

View File

@ -25,13 +25,13 @@
class DocumentTemplate : public Template
{
public:
DocumentTemplate() : Template(false,'=',"TEMPLATE"){};
DocumentTemplate() : Template(false, '=', "TEMPLATE") {};
~DocumentTemplate(){};
~DocumentTemplate() {};
DocumentTemplate(DocumentTemplate& dt):Template(dt){};
DocumentTemplate(DocumentTemplate& dt):Template(dt) {};
DocumentTemplate(const Template& tmpl):Template(tmpl){};
DocumentTemplate(const Template& tmpl):Template(tmpl) {};
// -------------------------------------------------------------------------
// Encrypted attributes interface implementation

View File

@ -190,7 +190,7 @@ private:
template<typename MSG>
void Driver<MSG>
::stop_driver(int secs)
::stop_driver(int secs)
{
if ( pid == -1 )
{
@ -230,7 +230,7 @@ void Driver<MSG>
template<typename MSG>
int Driver<MSG>
::start_driver(std::string& error)
::start_driver(std::string& error)
{
// Open communication pipes
int to_drv_pipe[2];
@ -249,35 +249,35 @@ int Driver<MSG>
switch (pid)
{
case -1: // Error
error = "Error forking to start driver, ";
error.append(strerror(errno));
return -1;
case 0: // Child process (driver)
close(to_drv_pipe[1]);
close(from_drv_pipe[0]);
if ( dup2(to_drv_pipe[0], 0) != 0 || dup2(from_drv_pipe[1], 1) != 1 )
{
error = "Error setting communication pipes, ";
case -1: // Error
error = "Error forking to start driver, ";
error.append(strerror(errno));
return -1;
}
close(to_drv_pipe[0]);
close(from_drv_pipe[1]);
case 0: // Child process (driver)
close(to_drv_pipe[1]);
close(from_drv_pipe[0]);
close(2);
if ( dup2(to_drv_pipe[0], 0) != 0 || dup2(from_drv_pipe[1], 1) != 1 )
{
error = "Error setting communication pipes, ";
error.append(strerror(errno));
return -1;
}
execlp(cmd.c_str(), cmd.c_str(), arg.c_str(), (char*)NULL);
close(to_drv_pipe[0]);
close(from_drv_pipe[1]);
error = "Error starting driver, ";
error.append(strerror(errno));
return -1;
close(2);
default:
break;
execlp(cmd.c_str(), cmd.c_str(), arg.c_str(), (char*)NULL);
error = "Error starting driver, ";
error.append(strerror(errno));
return -1;
default:
break;
}
// Parent process (daemon)
@ -337,11 +337,12 @@ int Driver<MSG>
template<typename MSG>
void Driver<MSG>
::start_listener()
::start_listener()
{
streamer.fd(from_drv);
stream_thr = std::thread([this](){
stream_thr = std::thread([this]()
{
while(streamer.action_loop(concurrency) == -1 && !terminate.load())
{
std::string error;

View File

@ -45,7 +45,7 @@ public:
* for all installed drivers. Must be called after load_drivers method.
*/
void register_action(typename D::message_t::msg_enum t,
std::function<void(std::unique_ptr<typename D::message_t>)> a);
std::function<void(std::unique_ptr<typename D::message_t>)> a);
/**
* Start all drivers
@ -137,7 +137,7 @@ int DriverManager<D>::load_driver(const VectorAttribute* mad_config)
}
auto rc = drivers.insert(std::make_pair(name,
std::unique_ptr<D>(new D(exec, args, threads))));
std::unique_ptr<D>(new D(exec, args, threads))));
if (rc.second)
{
@ -191,7 +191,7 @@ D * DriverManager<D>::get_driver(const std::string& name) const
template<typename D>
void DriverManager<D>::register_action(typename D::message_t::msg_enum t,
std::function<void(std::unique_ptr<typename D::message_t>)> a)
std::function<void(std::unique_ptr<typename D::message_t>)> a)
{
for (auto& driver : drivers)
{
@ -211,7 +211,7 @@ int DriverManager<D>::start(std::string& error)
if (rc != 0)
{
NebulaLog::error("DrM", "Unable to start driver '" + driver.first
+ "': " + error);
+ "': " + error);
return rc;
}
}
@ -229,7 +229,8 @@ void DriverManager<D>::stop(int secs)
for (auto& driver : drivers)
{
int _secs = secs;
threads.push_back(std::thread([_secs, &driver] () {
threads.push_back(std::thread([_secs, &driver] ()
{
driver.second->stop(_secs);
}));
}
@ -300,7 +301,7 @@ void DriverManager<D>::add_request(SyncRequest *ar)
ar->id = request_id++;
sync_requests.insert(sync_requests.end(),std::make_pair(ar->id,ar));
sync_requests.insert(sync_requests.end(), std::make_pair(ar->id, ar));
}
/* -------------------------------------------------------------------------- */

View File

@ -66,10 +66,10 @@ public:
const std::string& _to_str(T ev) const
{
const auto it = std::find_if(enum_map.begin(), enum_map.end(),
[ev](const std::pair<std::string, T> & t) -> bool
{
return t.second == ev;
});
[ev](const std::pair<std::string, T> & t) -> bool
{
return t.second == ev;
});
return it->first;
}

View File

@ -25,7 +25,7 @@ class ExecuteHook
{
public:
ExecuteHook(const std::string& _name, const std::string& _cmd,
const std::string& _arg, const std::string& rl);
const std::string& _arg, const std::string& rl);
~ExecuteHook() = default;

View File

@ -99,7 +99,7 @@ public:
};
void to_xml(std::ostringstream& s,
const std::map<std::string, std::set<std::string>> &hidden) const override
const std::map<std::string, std::set<std::string>> &hidden) const override
{
return va->to_xml(s, hidden);
}
@ -111,12 +111,12 @@ protected:
* @param va pointer to the VectorAttribute.
*/
ExtendedAttribute(VectorAttribute *_va):
Attribute(_va->name()) ,va(_va), id(-1) {};
Attribute(_va->name()), va(_va), id(-1) {};
ExtendedAttribute(VectorAttribute *_va, int _id):
Attribute(_va->name()) ,va(_va), id(_id) {};
Attribute(_va->name()), va(_va), id(_id) {};
virtual ~ExtendedAttribute(){};
virtual ~ExtendedAttribute() {};
/* ---------------------------------------------------------------------- */
/* Attribute Interface */
@ -174,7 +174,7 @@ protected:
* Creates the ExtenededAttribute set
* @param dispose elements upon set destruction
*/
ExtendedAttributeSet(bool _dispose):dispose(_dispose){};
ExtendedAttributeSet(bool _dispose):dispose(_dispose) {};
virtual ~ExtendedAttributeSet();
@ -218,12 +218,12 @@ protected:
return map_it != rhs.map_it;
}
AttributeIterator(){};
AttributeIterator(const AttributeIterator& ait):map_it(ait.map_it){};
AttributeIterator() {};
AttributeIterator(const AttributeIterator& ait):map_it(ait.map_it) {};
AttributeIterator(const std::map<int,
ExtendedAttribute *>::iterator& _map_it):map_it(_map_it){};
ExtendedAttribute *>::iterator& _map_it):map_it(_map_it) {};
virtual ~AttributeIterator(){};
virtual ~AttributeIterator() {};
protected:
std::map<int, ExtendedAttribute *>::iterator map_it;
@ -270,12 +270,12 @@ protected:
* @param vas vector of attribute to use
*/
void init_attribute_map(const std::string& id_name,
std::vector<VectorAttribute *>& vas);
std::vector<VectorAttribute *>& vas);
/**
* Abstract method to create the VirtualMachineAttributes for this set
*/
virtual ExtendedAttribute * attribute_factory(VectorAttribute * va,
int id) const = 0;
int id) const = 0;
/**
* @return the number of elements in the set

View File

@ -80,7 +80,7 @@ public:
* @return 0 on success -1 if a xml-rpc/network error occurred
*/
int xmlrpc_replicate_log(int zone_id, bool& success, uint64_t& last,
std::string& err);
std::string& err);
/**
* Start the replication threads, and updates the server list of the zone
@ -139,9 +139,9 @@ private:
struct ZoneServers
{
ZoneServers(int z, uint64_t l, const std::string& s):
zone_id(z), endpoint(s), next(l), last(UINT64_MAX){};
zone_id(z), endpoint(s), next(l), last(UINT64_MAX) {};
~ZoneServers(){};
~ZoneServers() {};
int zone_id;
@ -166,7 +166,7 @@ private:
* @return 0 on success, -1 otherwise
*/
int get_next_record(int zone_id, std::string& zedp, LogDBRecord& lr,
std::string& error);
std::string& error);
};

View File

@ -26,7 +26,7 @@ class GroupPool : public PoolSQL
public:
GroupPool(SqlDB * db, bool is_federation_slave,
const std::vector<const SingleAttribute *>& restricted_attrs);
const std::vector<const SingleAttribute *>& restricted_attrs);
~GroupPool() = default;
@ -172,7 +172,7 @@ private:
*/
PoolObjectSQL * create() override
{
return new Group(-1,"");
return new Group(-1, "");
};
};

View File

@ -32,17 +32,17 @@ public:
History(int oid, int _seq = -1);
History(
int oid,
int seq,
int hid,
const std::string& hostname,
int cid,
const std::string& vmm,
const std::string& tmm,
int ds_id,
const std::string& vm_info);
int oid,
int seq,
int hid,
const std::string& hostname,
int cid,
const std::string& vmm,
const std::string& tmm,
int ds_id,
const std::string& vm_info);
~History(){};
~History() {};
/**
* Function to write the History Record in an output stream
@ -144,10 +144,10 @@ private:
* @param db pointer to the database.
* @return 0 on success.
*/
int update(SqlDB * db) override
{
int update(SqlDB * db) override
{
return insert_replace(db, true);
}
}
/**
* Removes the all history records from the DB

View File

@ -53,7 +53,7 @@ private:
// *************************************************************************
HookAPI() = default;
HookAPI(const std::string& _call): call(_call){};
HookAPI(const std::string& _call): call(_call) {};
virtual ~HookAPI() = default;

View File

@ -28,7 +28,7 @@
class HookManager :
public DriverManager<Driver<hook_msg_t>>,
public Listener
public Listener
{
public:

View File

@ -29,9 +29,9 @@ class HookPool : public PoolSQL
{
public:
HookPool(SqlDB * db) : PoolSQL(db, one_db::hook_table){};
HookPool(SqlDB * db) : PoolSQL(db, one_db::hook_table) {};
~HookPool(){};
~HookPool() {};
/**
* Function to allocate a new Hook object
@ -84,7 +84,7 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "HOOK_POOL", "body", one_db::hook_table,
where, sid, eid, desc);

View File

@ -40,7 +40,7 @@ private:
// Constructor/Destructor
// *************************************************************************
HookStateHost():state(Host::INIT){};
HookStateHost():state(Host::INIT) {};
virtual ~HookStateHost() = default;

View File

@ -40,7 +40,7 @@ private:
// Constructor/Destructor
// *************************************************************************
HookStateImage():state(Image::INIT){};
HookStateImage():state(Image::INIT) {};
virtual ~HookStateImage() = default;

View File

@ -41,7 +41,7 @@ private:
// *************************************************************************
HookStateVM():state(VirtualMachine::INIT),
lcm_state(VirtualMachine::LCM_INIT){};
lcm_state(VirtualMachine::LCM_INIT) {};
virtual ~HookStateVM() = default;

View File

@ -40,7 +40,7 @@ private:
// Constructor/Destructor
// *************************************************************************
HookStateVirtualNetwork():state(VirtualNetwork::INIT){};
HookStateVirtualNetwork():state(VirtualNetwork::INIT) {};
virtual ~HookStateVirtualNetwork() = default;

View File

@ -67,15 +67,24 @@ public:
state = INIT;
if ( st == "INIT" ) {
if ( st == "INIT" )
{
state = INIT;
} else if ( st == "MONITORED" ) {
}
else if ( st == "MONITORED" )
{
state = MONITORED;
} else if ( st == "ERROR" ) {
}
else if ( st == "ERROR" )
{
state = ERROR;
} else if ( st == "DISABLED" ) {
}
else if ( st == "DISABLED" )
{
state = DISABLED;
} else if ( st == "OFFLINE" ) {
}
else if ( st == "OFFLINE" )
{
state = OFFLINE;
}
else
@ -129,11 +138,11 @@ public:
*/
int from_xml(const std::string &xml_str) override;
/**
* Checks if the host is a remote public cloud
* @return true if the host is a remote public cloud
*/
bool is_public_cloud() const;
/**
* Checks if the host is a remote public cloud
* @return true if the host is a remote public cloud
*/
bool is_public_cloud() const;
/**
* Sets the current host offline, it will not be monitored nor used by the

View File

@ -42,13 +42,13 @@ public:
* @return the oid assigned to the object or -1 in case of failure
*/
int allocate (
int * oid,
const std::string& hostname,
const std::string& im_mad_name,
const std::string& vmm_mad_name,
int cluster_id,
const std::string& cluster_name,
std::string& error_str);
int * oid,
const std::string& hostname,
const std::string& im_mad_name,
const std::string& vmm_mad_name,
int cluster_id,
const std::string& cluster_name,
std::string& error_str);
/**
* Updates a Host in the data base. It also updates the previous state
@ -154,9 +154,9 @@ public:
if ( auto host = get(oid) )
{
host->add_capacity(sr);
host->add_capacity(sr);
update(host.get());
update(host.get());
}
else
{
@ -210,10 +210,10 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "HOST_POOL", "body", one_db::host_table,
where, sid, eid, desc);
where, sid, eid, desc);
};
/**
@ -271,7 +271,7 @@ private:
*/
PoolObjectSQL * create() override
{
return new Host(-1,"","","",-1,"");
return new Host(-1, "", "", "", -1, "");
};
};

View File

@ -36,7 +36,7 @@ class HostShare : public ObjectXML
public:
HostShare();
~HostShare(){};
~HostShare() {};
/**
* Pin policy for the host

View File

@ -28,9 +28,9 @@ class HostShareDatastore : public Template
{
public:
HostShareDatastore() : Template(false, '=', "DATASTORES"), disk_usage(0),
max_disk(0), free_disk(0), used_disk(0){};
max_disk(0), free_disk(0), used_disk(0) {};
virtual ~HostShareDatastore(){};
virtual ~HostShareDatastore() {};
/**
* Updates the Datastore information from the monitorization template.

View File

@ -103,7 +103,7 @@ public:
* @return 0 on success
*/
int allocate_ht_cpus(int id, unsigned int tcpus, unsigned int tc,
std::string &c_s);
std::string &c_s);
/**
* Remove allocation for the given CPUs
@ -265,7 +265,7 @@ private:
* @param update if true also adds the core to the object Template
*/
void set_core(unsigned int id, std::string& cpus, unsigned int vms_thread,
bool dedicated, bool update);
bool dedicated, bool update);
/**
* Regenerate the template representation of the CORES for this node.
@ -285,7 +285,7 @@ private:
* @param update if true also adds the page to the object Template
*/
void set_hugepage(unsigned long size, unsigned int nr,
unsigned long usage, bool update);
unsigned long usage, bool update);
void update_hugepage(unsigned long size);
@ -332,7 +332,7 @@ private:
class HostShareNUMA
{
public:
HostShareNUMA():threads_core(1){};
HostShareNUMA():threads_core(1) {};
virtual ~HostShareNUMA()
{
@ -468,7 +468,7 @@ private:
* @return 0 success (vm was allocated) -1 otherwise
*/
int make_affined_topology(HostShareCapacity &sr, int node_id,
unsigned long hpsz_kb, bool do_alloc);
unsigned long hpsz_kb, bool do_alloc);
/*
* Computes the virtual topology for the VM based on the huge pages allocation
@ -479,7 +479,7 @@ private:
* @return 0 success (vm was allocated) -1 otherwise
*/
int make_hugepage_topology(HostShareCapacity &sr, unsigned long hpzs_kb,
bool do_alloc);
bool do_alloc);
/**
* This is an internal structure to represent a virtual node allocation
* request and the resulting schedule
@ -500,7 +500,7 @@ private:
};
bool schedule_nodes(NUMANodeRequest &nr, unsigned int thr, bool dedicated,
unsigned long hpsz_kb, std::set<unsigned int> &pci, bool do_alloc);
unsigned long hpsz_kb, std::set<unsigned int> &pci, bool do_alloc);
};
#endif /*HOST_SHARE_NUMA_H_*/

View File

@ -47,7 +47,7 @@ class HostSharePCI : public Template
{
public:
HostSharePCI() : Template(false, '=', "PCI_DEVICES"){};
HostSharePCI() : Template(false, '=', "PCI_DEVICES") {};
HostSharePCI(const HostSharePCI& src);
@ -148,7 +148,7 @@ public:
* @return -1 if wrong bus 0 on success
*/
static int set_pci_address(VectorAttribute * pci_device, const std::string& dbus,
bool bus_index, bool clean);
bool bus_index, bool clean);
private:
/**
@ -161,7 +161,7 @@ private:
PCIDevice(const PCIDevice& src);
~PCIDevice(){};
~PCIDevice() {};
unsigned int vendor_id;
unsigned int device_id;

View File

@ -26,11 +26,11 @@
class HostTemplate : public Template
{
public:
HostTemplate() : Template(false,'=',"TEMPLATE"){};
HostTemplate() : Template(false, '=', "TEMPLATE") {};
~HostTemplate(){};
~HostTemplate() {};
HostTemplate(HostTemplate& ht):Template(ht){};
HostTemplate(HostTemplate& ht):Template(ht) {};
// -------------------------------------------------------------------------
// Encrypted attributes interface implementation

View File

@ -32,14 +32,14 @@ class VectorAttribute;
class IPAMManager :
public DriverManager<Driver<ipam_msg_t>>,
public Listener
public Listener
{
public:
IPAMManager(time_t timer, const std::string& mad_location)
: DriverManager(mad_location)
, Listener("IPAM Manager")
, timer_thread(timer, [this](){timer_action();})
, timer_thread(timer, [this]() {timer_action();})
{
}

View File

@ -37,16 +37,16 @@ public:
/* IPAM Request constructors */
/* ---------------------------------------------------------------------- */
IPAMRequest(VectorAttribute * _ar_vattr) : IPAMRequest(_ar_vattr,
"<ADDRESS><MAC/><IP/><IP6_GLOBAL/><IP6_ULA/><IP6/><SIZE/></ADDRESS>"){};
"<ADDRESS><MAC/><IP/><IP6_GLOBAL/><IP6_ULA/><IP6/><SIZE/></ADDRESS>") {};
IPAMRequest(VectorAttribute * _ar_vattr, const std::string& _address_xml);
IPAMRequest(AddressRange * _ar) : IPAMRequest(_ar,
"<ADDRESS><MAC/><IP/><IP6_GLOBAL/><IP6_ULA/><IP6/><SIZE/></ADDRESS>"){};
"<ADDRESS><MAC/><IP/><IP6_GLOBAL/><IP6_ULA/><IP6/><SIZE/></ADDRESS>") {};
IPAMRequest(AddressRange * _ar, const std::string& _address_xml);
virtual ~IPAMRequest(){};
virtual ~IPAMRequest() {};
/* ---------------------------------------------------------------------- */
/* Driver message formatting and processing */

View File

@ -213,7 +213,7 @@ public:
* @return true if the image is set to persistent, false otherwise
*/
static bool test_set_persistent(Template * image_template, int uid, int gid,
bool is_allocate);
bool is_allocate);
/**
* Returns the source path of the image
@ -461,8 +461,8 @@ public:
if ((snapshots.size() > 0) && !persis)
{
error_str = "Image has snapshots.";
return -1;
error_str = "Image has snapshots.";
return -1;
}
switch (state)
@ -702,9 +702,9 @@ private:
*/
long long size_mb;
/**
* Image state
*/
/**
* Image state
*/
ImageState state;
ImageState prev_state;

View File

@ -38,13 +38,13 @@ public:
DatastorePool * _dspool,
const std::string& _mads_location,
int _monitor_vm_disk):
DriverManager(_mads_location),
timer_thread(_timer_period, [this](){timer_action();}),
timer_period(_timer_period),
monitor_period(_monitor_period),
monitor_vm_disk(_monitor_vm_disk),
ipool(_ipool),
dspool(_dspool)
DriverManager(_mads_location),
timer_thread(_timer_period, [this]() {timer_action();}),
timer_period(_timer_period),
monitor_period(_monitor_period),
monitor_vm_disk(_monitor_vm_disk),
ipool(_ipool),
dspool(_dspool)
{
}
@ -97,7 +97,7 @@ public:
* @return pointer to the image or 0 if could not be acquired
*/
std::unique_ptr<Image> acquire_image(int vm_id, const std::string& name,
int uid, bool attach, std::string& error);
int uid, bool attach, std::string& error);
/**
* Releases an image and triggers any needed operations in the repo
@ -176,7 +176,7 @@ public:
* @return 0 on success
*/
int set_clone_state(PoolObjectSQL::ObjectType ot, int new_id,
int cloning_id, std::string& error);
int cloning_id, std::string& error);
/**
* Sets the state to CLONE for the given image
@ -237,7 +237,7 @@ public:
* @return 0 on success
*/
int restore_image(int iid, int dst_ds_id, const std::string& opts,
std::string& result);
std::string& result);
/**
* Gets the size of an image by calling the STAT action of the associated
@ -249,15 +249,15 @@ public:
* occurred describing the error.
* @result 0 on success
*/
int stat_image(Template* img_tmpl,
const std::string& ds_tmpl,
std::string& res);
int stat_image(Template* img_tmpl,
const std::string& ds_tmpl,
std::string& res);
/**
* Trigger a monitor action for the datastore.
* @param ds_id id of the datastore to monitor
*/
void monitor_datastore(int ds_id);
/**
* Trigger a monitor action for the datastore.
* @param ds_id id of the datastore to monitor
*/
void monitor_datastore(int ds_id);
/**
* Set the snapshots for the given image. The image MUST be persistent
@ -265,13 +265,13 @@ public:
* @param iid id of image
* @param s snapshot list
*/
void set_image_snapshots(int iid, const Snapshots& s);
void set_image_snapshots(int iid, const Snapshots& s);
/**
* Clear the snapshots of an image by setting an empty set.
* @param iid id of image
*/
void clear_image_snapshots(int iid);
/**
* Clear the snapshots of an image by setting an empty set.
* @param iid id of image
*/
void clear_image_snapshots(int iid);
/**
* Set the size for the given image. The image MUST be persistent
@ -279,44 +279,44 @@ public:
* @param iid id of image
* @param size
*/
void set_image_size(int iid, long long size);
void set_image_size(int iid, long long size);
/**
* Deletes the snapshot of an image
* @param iid id of image
* @param sid id of the snapshot
* @param error_str Error reason, if any
* @return 0 on success
*/
int delete_snapshot(int iid, int sid, std::string& error);
/**
* Deletes the snapshot of an image
* @param iid id of image
* @param sid id of the snapshot
* @param error_str Error reason, if any
* @return 0 on success
*/
int delete_snapshot(int iid, int sid, std::string& error);
/**
* Reverts image state to a previous snapshot
* @param iid id of image
* @param sid id of the snapshot
* @param error_str Error reason, if any
* @return 0 on success
*/
int revert_snapshot(int iid, int sid, std::string& error);
/**
* Reverts image state to a previous snapshot
* @param iid id of image
* @param sid id of the snapshot
* @param error_str Error reason, if any
* @return 0 on success
*/
int revert_snapshot(int iid, int sid, std::string& error);
/**
* Flattens the snapshot by commiting changes to base image.
* @param iid id of image
* @param sid id of the snapshot
* @param error_str Error reason, if any
* @return 0 on success
*/
int flatten_snapshot(int iid, int sid, std::string& error);
/**
* Flattens the snapshot by commiting changes to base image.
* @param iid id of image
* @param sid id of the snapshot
* @param error_str Error reason, if any
* @return 0 on success
*/
int flatten_snapshot(int iid, int sid, std::string& error);
/**
* Flattens the backup chain by commiting changes to first (full) backup
* @param iid id of image
* @param ds_id id of the datastore
* @param edata XML string with KEEP_LAST and VM_ID
* @param error_str Error reason, if any
* @return 0 on success
*/
int flatten_increments(int iid, int ds_id, const std::string& edata, std::string& error);
/**
* Flattens the backup chain by commiting changes to first (full) backup
* @param iid id of image
* @param ds_id id of the datastore
* @param edata XML string with KEEP_LAST and VM_ID
* @param error_str Error reason, if any
* @return 0 on success
*/
int flatten_increments(int iid, int ds_id, const std::string& edata, std::string& error);
private:
/**
@ -393,8 +393,8 @@ private:
* @return the XML message
*/
static std::string format_message(const std::string& img_data,
const std::string& ds_data,
const std::string& extra_data);
const std::string& ds_data,
const std::string& extra_data);
// -------------------------------------------------------------------------
// Protocol implementation, procesing messages from driver

View File

@ -44,7 +44,7 @@ public:
const std::vector<const SingleAttribute *>& encrypted_attrs,
const std::vector<const SingleAttribute *>& inherit_attrs);
~ImagePool(){};
~ImagePool() {};
/**
* Function to allocate a new Image object
@ -69,23 +69,23 @@ public:
* -2 in case of template parse failure
*/
int allocate (
int uid,
int gid,
const std::string& uname,
const std::string& gname,
int umask,
std::unique_ptr<ImageTemplate> img_template,
int ds_id,
const std::string& ds_name,
Image::DiskType disk_type,
const std::string& ds_data,
Datastore::DatastoreType ds_type,
const std::string& ds_mad,
const std::string& tm_mad,
const std::string& extra_data,
int source_img_id,
int * oid,
std::string& error_str);
int uid,
int gid,
const std::string& uname,
const std::string& gname,
int umask,
std::unique_ptr<ImageTemplate> img_template,
int ds_id,
const std::string& ds_name,
Image::DiskType disk_type,
const std::string& ds_data,
Datastore::DatastoreType ds_type,
const std::string& ds_mad,
const std::string& tm_mad,
const std::string& extra_data,
int source_img_id,
int * oid,
std::string& error_str);
/**
* Updates an Image in the data base. It also updates the previous state
@ -130,7 +130,7 @@ public:
*/
std::unique_ptr<Image> get(const std::string& name, int uid)
{
return PoolSQL::get<Image>(name,uid);
return PoolSQL::get<Image>(name, uid);
}
/**
@ -167,7 +167,7 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "IMAGE_POOL", "body", one_db::image_table,
where, sid, eid, desc);
@ -261,7 +261,7 @@ private:
*/
PoolObjectSQL * create() override
{
return new Image(-1,-1,"","",0,0);
return new Image(-1, -1, "", "", 0, 0);
};
};

View File

@ -25,11 +25,11 @@
class ImageTemplate : public Template
{
public:
ImageTemplate() : Template(true,'=',"TEMPLATE"){};
ImageTemplate() : Template(true, '=', "TEMPLATE") {};
ImageTemplate(const Template& tmpl):Template(tmpl){};
ImageTemplate(const Template& tmpl):Template(tmpl) {};
~ImageTemplate(){};
~ImageTemplate() {};
bool is_saving()
{

View File

@ -30,12 +30,12 @@ class InformationManager : public DriverManager<Driver<im_msg_t>>
{
public:
InformationManager(
HostPool * _hpool,
VirtualMachinePool * _vmpool,
const std::string& mad_location)
: DriverManager(mad_location)
, hpool(_hpool)
, vmpool(_vmpool)
HostPool * _hpool,
VirtualMachinePool * _vmpool,
const std::string& mad_location)
: DriverManager(mad_location)
, hpool(_hpool)
, vmpool(_vmpool)
{
}

View File

@ -266,7 +266,7 @@ private:
* image may need to be set to error state.
*/
void clean_up_vm(VirtualMachine *vm, bool dispose, int& image_id,
int uid, int gid, int req_id, Template& quota_tmpl);
int uid, int gid, int req_id, Template& quota_tmpl);
};
#endif /*LIFE_CYCLE_MANAGER_H_*/

View File

@ -75,14 +75,16 @@ public:
end = false;
timer_thread = std::thread([&, s, timer]{
timer_thread = std::thread([&, s, timer]
{
std::unique_lock<std::mutex> ul(lock);
while (true)
{
bool tout = cond.wait_for(ul, std::chrono::duration<double>(s), [&]{
return end == true;
bool tout = cond.wait_for(ul, std::chrono::duration<double>(s), [&]
{
return end == true;
});
if (end)
@ -159,7 +161,8 @@ public:
*/
void finalize()
{
trigger([&] {
trigger([&]
{
if (!name.empty())
{
NebulaLog::info("Lis", "Stopping " + name);
@ -187,7 +190,8 @@ protected:
*/
void start()
{
loop_thread = std::thread([&] {
loop_thread = std::thread([&]
{
NebulaLog::info("Lis", name + " started.");
loop();
@ -207,7 +211,7 @@ protected:
{
std::unique_lock<std::mutex> ul(lock);
cond.wait(ul, [&]{return (end || !pending.empty());});
cond.wait(ul, [&] {return (end || !pending.empty());});
if (end)
{

View File

@ -31,7 +31,8 @@
class Log
{
public:
enum MessageType {
enum MessageType
{
ERROR = 0,
WARNING = 1,
INFO = 2,
@ -42,9 +43,9 @@ public:
static const std::string error_names[];
Log(const MessageType _level = WARNING):log_level(_level){};
Log(const MessageType _level = WARNING):log_level(_level) {};
virtual ~Log(){};
virtual ~Log() {};
MessageType get_log_level() const
{
@ -73,7 +74,7 @@ public:
clock_gettime(CLOCK_MONOTONIC, &eend);
sec = (eend.tv_sec + (eend.tv_nsec * 1e-9)) - (estart->tv_sec +
(estart->tv_nsec * 1e-9));
(estart->tv_nsec * 1e-9));
return sec;
}
@ -83,9 +84,9 @@ public:
// -------------------------------------------------------------------------
virtual void log(
const char * module,
const MessageType type,
const char * message) = 0;
const char * module,
const MessageType type,
const char * message) = 0;
protected:
/**
@ -116,9 +117,9 @@ public:
virtual ~FileLog();
void log(
const char * module,
const MessageType type,
const char * message) override;
const char * module,
const MessageType type,
const char * message) override;
private:
std::string log_file_name;
@ -133,19 +134,19 @@ public:
FileLogTS(const std::string& file_name,
const MessageType level = WARNING,
std::ios_base::openmode mode = std::ios_base::app)
:FileLog(file_name,level,mode)
:FileLog(file_name, level, mode)
{
}
~FileLogTS() = default;
void log(
const char * module,
const MessageType type,
const char * message) override
const char * module,
const MessageType type,
const char * message) override
{
std::lock_guard <std::mutex> lock(log_mutex);
FileLog::log(module,type,message);
FileLog::log(module, type, message);
}
private:
@ -162,18 +163,18 @@ private:
class StdLog : public Log
{
public:
StdLog(const MessageType level):Log(level){};
StdLog(const MessageType level):Log(level) {};
StdLog(const MessageType level,
int oid,
const PoolObjectSQL::ObjectType obj_type);
~StdLog(){};
~StdLog() {};
void log(
const char * module,
const MessageType type,
const char * message) override;
const char * module,
const MessageType type,
const char * message) override;
private:
std::string resource_label;
@ -195,12 +196,12 @@ public:
int oid,
const PoolObjectSQL::ObjectType obj_type);
~SysLog(){};
~SysLog() {};
void log(
const char * module,
const MessageType type,
const char * message) override;
const char * module,
const MessageType type,
const char * message) override;
/**
* Return the associated syslog level

View File

@ -29,9 +29,9 @@
class LogDBRecord : public Callbackable
{
public:
/**
* Index for this log entry (and previous)
*/
/**
* Index for this log entry (and previous)
*/
uint64_t index;
uint64_t prev_index;
@ -83,7 +83,7 @@ class LogDB : public SqlDB
{
public:
LogDB(SqlDB * _db, bool solo, bool cache, uint64_t log_retention,
uint64_t limit_purge);
uint64_t limit_purge);
virtual ~LogDB();
@ -126,8 +126,8 @@ public:
* @return 0 on sucess, -1 on failure
*/
int insert_log_record(uint64_t index, unsigned int term,
const std::ostringstream& sql, time_t timestamp, uint64_t fed_index,
bool replace);
const std::ostringstream& sql, time_t timestamp, uint64_t fed_index,
bool replace);
/**
* Replicate a log record on followers. It will also replicate any missing
@ -383,7 +383,7 @@ private:
* @return -1 on failure, index of the inserted record on success
*/
uint64_t insert_log_record(unsigned int term, const std::ostringstream& sql,
time_t timestamp, uint64_t fed_index);
time_t timestamp, uint64_t fed_index);
};
// -----------------------------------------------------------------------------
@ -393,9 +393,9 @@ private:
class FedLogDB: public SqlDB
{
public:
FedLogDB(LogDB *db):_logdb(db){};
FedLogDB(LogDB *db):_logdb(db) {};
virtual ~FedLogDB(){};
virtual ~FedLogDB() {};
int exec_wr(std::ostringstream& cmd) override;

View File

@ -35,13 +35,13 @@ class SessionToken
{
public:
SessionToken():expiration_time(0), token(""){};
SessionToken():expiration_time(0), token("") {};
virtual ~SessionToken(){};
virtual ~SessionToken() {};
/**
* Clears the token if not valid
*/
/**
* Clears the token if not valid
*/
void reset();
/**
@ -89,9 +89,9 @@ class LoginToken: public SessionToken
{
public:
LoginToken():SessionToken(), egid(-1){};
LoginToken():SessionToken(), egid(-1) {};
virtual ~LoginToken(){};
virtual ~LoginToken() {};
/**
* Check if the token is valid (same as the one provided, and not expired)
@ -155,7 +155,7 @@ private:
class LoginTokenPool
{
public:
LoginTokenPool(){};
LoginTokenPool() {};
~LoginTokenPool();

View File

@ -45,9 +45,12 @@ public:
state = ENABLED;
if ( st == "ENABLED" ) {
if ( st == "ENABLED" )
{
state = ENABLED;
} else if ( st == "DISABLED" ) {
}
else if ( st == "DISABLED" )
{
state = DISABLED;
}
else

View File

@ -27,7 +27,7 @@ class MarketPlaceAppPool : public PoolSQL
public:
MarketPlaceAppPool(SqlDB * db):PoolSQL(db, one_db::mp_app_table) {};
~MarketPlaceAppPool(){};
~MarketPlaceAppPool() {};
/* ---------------------------------------------------------------------- */
/* Methods for DB management */
@ -81,7 +81,7 @@ public:
* already imported
*/
int import(const std::string& t64, int mp_id, const std::string& mp_name,
int& app_id, std::string& error_str);
int& app_id, std::string& error_str);
/**
* Gets an object from the pool (if needed the object is loaded from the
@ -154,7 +154,7 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "MARKETPLACEAPP_POOL", "body",
one_db::mp_app_table, where, sid, eid, desc);
@ -172,7 +172,7 @@ public:
*/
PoolObjectSQL * create() override
{
return new MarketPlaceApp(-1,-1,"","", 0, 0);
return new MarketPlaceApp(-1, -1, "", "", 0, 0);
};
/**

View File

@ -26,9 +26,9 @@ class MarketPlaceAppTemplate : public Template
{
public:
MarketPlaceAppTemplate():
Template(false,'=',"TEMPLATE"){};
Template(false, '=', "TEMPLATE") {};
~MarketPlaceAppTemplate(){};
~MarketPlaceAppTemplate() {};
};
/* -------------------------------------------------------------------------- */

View File

@ -108,23 +108,23 @@ public:
*/
int delete_app(int appid, const std::string& market_data, std::string& err);
/**
* Trigger a monitor action for the marketplace .
* @param ds_id id of the datastore to monitor
*/
void monitor_market(int ds_id);
/**
* Trigger a monitor action for the marketplace .
* @param ds_id id of the datastore to monitor
*/
void monitor_market(int ds_id);
/**
* Relsease resources locked by this app during the import phase
* @param appid of the app
*/
/**
* Relsease resources locked by this app during the import phase
* @param appid of the app
*/
void release_app_resources(int appid);
private:
/**
* Generic name for the marketplace driver
*/
static const char * market_driver_name;
static const char * market_driver_name;
/**
* Timer action async execution

View File

@ -29,7 +29,7 @@ public:
MarketPlacePool(SqlDB * db,
bool is_federation_slave);
~MarketPlacePool(){};
~MarketPlacePool() {};
/* ---------------------------------------------------------------------- */
/* Methods for DB management */
@ -118,10 +118,10 @@ public:
* @return 0 on success
*/
int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) override
bool desc) override
{
return PoolSQL::dump(oss, "MARKETPLACE_POOL", "body", one_db::mp_table,
where, sid, eid, desc);
where, sid, eid, desc);
};
/**
@ -130,10 +130,10 @@ public:
*
* @return 0 on success
*/
int list(std::vector<int>& oids)
{
int list(std::vector<int>& oids)
{
return PoolSQL::list(oids, one_db::mp_table);
}
}
/**
* Factory method to produce objects
@ -141,7 +141,7 @@ public:
*/
PoolObjectSQL * create() override
{
return new MarketPlace(-1,-1,"","", 0, 0);
return new MarketPlace(-1, -1, "", "", 0, 0);
};
};

View File

@ -26,9 +26,9 @@ class MarketPlaceTemplate : public Template
{
public:
MarketPlaceTemplate():
Template(false,'=',"TEMPLATE"){};
Template(false, '=', "TEMPLATE") {};
~MarketPlaceTemplate(){};
~MarketPlaceTemplate() {};
};
/* -------------------------------------------------------------------------- */

View File

@ -196,17 +196,17 @@ private:
template<typename E, bool compress, bool encode, bool encrypt, bool has_timestamp>
Message<E, compress, encode, encrypt, has_timestamp>
::Message(E type, std::string &&status, int oid, const std::string& payload)
: _type(type)
, _status(std::move(status))
, _oid(oid)
, _payload(payload)
::Message(E type, std::string &&status, int oid, const std::string& payload)
: _type(type)
, _status(std::move(status))
, _oid(oid)
, _payload(payload)
{
}
template<typename E, bool compress, bool encode, bool encrypt, bool has_timestamp>
int Message<E, compress, encode, encrypt, has_timestamp>
::parse_from(const std::string& input)
::parse_from(const std::string& input)
{
std::istringstream is(input);
std::string buffer;
@ -279,7 +279,7 @@ error:
template<typename E, bool compress, bool encode, bool encrypt, bool has_timestamp>
int Message<E, compress, encode, encrypt, has_timestamp>
::write_to(std::string& out) const
::write_to(std::string& out) const
{
out.clear();
@ -332,7 +332,7 @@ int Message<E, compress, encode, encrypt, has_timestamp>
template<typename E, bool compress, bool encode, bool encrypt, bool has_timestamp>
int Message<E, compress, encode, encrypt, has_timestamp>
::write_to(int fd) const
::write_to(int fd) const
{
std::string out;
@ -351,7 +351,7 @@ int Message<E, compress, encode, encrypt, has_timestamp>
template<typename E, bool compress, bool encode, bool encrypt, bool has_timestamp>
int Message<E, compress, encode, encrypt, has_timestamp>
::write_to(std::ostream& oss) const
::write_to(std::ostream& oss) const
{
std::string out;

View File

@ -155,14 +155,15 @@ public:
throw std::runtime_error("Aborting oned, MySQL support not compiled!");
};
~MySqlDB(){};
~MySqlDB() {};
char * escape_str(const std::string& str) const override {return nullptr;};
void free_str(char * str) const override {};
protected:
int exec_ext(std::ostringstream& c, Callbackable *o, bool q) override {
int exec_ext(std::ostringstream& c, Callbackable *o, bool q) override
{
return -1;
};
};

View File

@ -402,7 +402,7 @@ public:
*/
template<typename T>
int get_configuration_attribute(int uid, int gid, const std::string& name,
T& value) const
T& value) const
{
if ( uid != -1 )
{
@ -450,7 +450,7 @@ public:
* Gets a DS configuration attribute
*/
int get_ds_conf_attribute(const std::string& ds_name,
const VectorAttribute* &value) const
const VectorAttribute* &value) const
{
return get_conf_attribute("DS_MAD_CONF", ds_name, value);
};
@ -459,7 +459,7 @@ public:
* Gets a VN configuration attribute
*/
int get_vn_conf_attribute(const std::string& vn_name,
const VectorAttribute* &value) const
const VectorAttribute* &value) const
{
return get_conf_attribute("VN_MAD_CONF", vn_name, value);
}
@ -468,7 +468,7 @@ public:
* Gets a TM configuration attribute
*/
int get_tm_conf_attribute(const std::string& tm_name,
const VectorAttribute* &value) const
const VectorAttribute* &value) const
{
return get_conf_attribute("TM_MAD_CONF", tm_name, value);
};
@ -477,7 +477,7 @@ public:
* Gets a Market configuration attribute
*/
int get_market_conf_attribute( const std::string& mk_name,
const VectorAttribute* &value) const
const VectorAttribute* &value) const
{
return get_conf_attribute("MARKET_MAD_CONF", mk_name, value);
};
@ -487,8 +487,8 @@ public:
*/
template<typename T>
int get_auth_conf_attribute(const std::string& driver,
const std::string& attribute,
T& value) const
const std::string& attribute,
T& value) const
{
return get_conf_attribute("AUTH_MAD_CONF", driver, attribute, value);
};
@ -591,9 +591,9 @@ public:
* @return 0 on success
*/
int insert_sys_attribute(
const std::string& attr_name,
const std::string& xml_attr,
std::string& error_str)
const std::string& attr_name,
const std::string& xml_attr,
std::string& error_str)
{
return system_db->insert_sys_attribute(attr_name, xml_attr, error_str);
};
@ -604,9 +604,9 @@ public:
* @return 0 on success
*/
int update_sys_attribute(
const std::string& attr_name,
const std::string& xml_attr,
std::string& error_str)
const std::string& attr_name,
const std::string& xml_attr,
std::string& error_str)
{
return system_db->update_sys_attribute(attr_name, xml_attr, error_str);
};
@ -628,10 +628,10 @@ public:
"/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")
"/DEFAULT_GROUP_QUOTAS/DATASTORE_QUOTA",
"/DEFAULT_GROUP_QUOTAS/NETWORK_QUOTA",
"/DEFAULT_GROUP_QUOTAS/IMAGE_QUOTA",
"/DEFAULT_GROUP_QUOTAS/VM_QUOTA")
, 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)
@ -753,9 +753,9 @@ private:
* @return a reference to the generated string
*/
int get_conf_attribute(
const std::string& key,
const std::string& name,
const VectorAttribute* &value) const;
const std::string& key,
const std::string& name,
const VectorAttribute* &value) const;
/**
* Gets a Generic configuration attribute
@ -766,10 +766,10 @@ private:
*/
template<typename T>
int get_conf_attribute(
const std::string& key,
const std::string& name,
const std::string& vname,
T& value) const
const std::string& key,
const std::string& name,
const std::string& vname,
T& value) const
{
const VectorAttribute* vattr;

View File

@ -28,7 +28,8 @@
class NebulaLog
{
public:
enum LogType {
enum LogType
{
FILE = 0,
FILE_TS = 1,
STD = 2,
@ -41,11 +42,11 @@ public:
// ---------------------------------------------------------------
static void init_log_system(
LogType ltype,
Log::MessageType clevel,
const char * filename,
std::ios_base::openmode mode,
const std::string& daemon)
LogType ltype,
Log::MessageType clevel,
const char * filename,
std::ios_base::openmode mode,
const std::string& daemon)
{
_log_type = ltype;
@ -92,27 +93,27 @@ public:
}
static void log(
const char * module,
const Log::MessageType type,
const char * message)
const char * module,
const Log::MessageType type,
const char * message)
{
logger->log(module,type,message);
logger->log(module, type, message);
};
static void log(
const char * module,
const Log::MessageType type,
const std::ostringstream& message)
const char * module,
const Log::MessageType type,
const std::ostringstream& message)
{
logger->log(module,type,message.str().c_str());
logger->log(module, type, message.str().c_str());
};
static void log(
const char * module,
const Log::MessageType type,
const std::string& message)
const char * module,
const Log::MessageType type,
const std::string& message)
{
logger->log(module,type,message.c_str());
logger->log(module, type, message.c_str());
};
static void error(const char* module, const std::string& msg)
@ -156,9 +157,9 @@ public:
};
private:
NebulaLog(){};
NebulaLog() {};
~NebulaLog(){};
~NebulaLog() {};
static LogType _log_type;
static Log * logger;

View File

@ -48,14 +48,14 @@ public:
* @return the debug level, to instantiate Log'ers
*/
Log::MessageType get_debug_level(
Log::MessageType default_ = Log::ERROR) const;
Log::MessageType default_ = Log::ERROR) const;
/**
* Returns the value of LOG->SYSTEM in oned.conf file
* @return the logging system CERR, FILE_TS or SYSLOG
*/
NebulaLog::LogType get_log_system(
NebulaLog::LogType default_ = NebulaLog::UNDEFINED) const;
NebulaLog::LogType default_ = NebulaLog::UNDEFINED) const;
/**
* Returns the value of ONE_LOCATION env variable. When this variable is
@ -137,11 +137,11 @@ public:
*/
static std::string version()
{
std::ostringstream os;
os << "OpenNebula " << code_version();
os << " (" << GITVERSION << ")";
std::ostringstream os;
os << "OpenNebula " << code_version();
os << " (" << GITVERSION << ")";
return os.str();
return os.str();
};
/**

View File

@ -28,11 +28,12 @@ class NebulaTemplate : public Template
{
public:
NebulaTemplate(const std::string& etc_location, const char * _conf_name,
const char * root_name)
const char * root_name)
: Template(false, '=', root_name)
, hidden_attributes{
{"DB", {"BACKEND", "SERVER", "PORT", "USER", "PASSWD", "DB_NAME"}}
}
, hidden_attributes
{
{"DB", {"BACKEND", "SERVER", "PORT", "USER", "PASSWD", "DB_NAME"}}
}
{
if (_conf_name[0] == '/')
{

View File

@ -66,22 +66,22 @@ namespace one_util
std::string sha256_digest(const std::string& in);
/**
* AES256 encryption
* @param in the string to encrypt
* @param password to encrypt data
* @return a pointer to the encrypted string (must be freed) or nullptr in case of
* error
*/
/**
* AES256 encryption
* @param in the string to encrypt
* @param password to encrypt data
* @return a pointer to the encrypted string (must be freed) or nullptr in case of
* error
*/
std::string * aes256cbc_encrypt(const std::string& in, const std::string& password);
/**
* AES256 decryption
* @param in the base64 string to decrypt
* @param password to decrypt data
* @return a pointer to the decrypted string (must be freed) or nullptr in case of
* error
*/
/**
* AES256 decryption
* @param in the base64 string to decrypt
* @param password to decrypt data
* @return a pointer to the decrypted string (must be freed) or nullptr in case of
* error
*/
std::string * aes256cbc_decrypt(const std::string& in, const std::string& password);
/**
@ -177,7 +177,7 @@ namespace one_util
}
std::vector<std::string> split(const std::string& st, char delim,
bool clean_empty = true);
bool clean_empty = true);
/**
* Splits a string, using the given delimiter
@ -212,7 +212,7 @@ namespace one_util
*/
template <>
void split_unique(const std::string& st, char delim,
std::set<std::string>& result);
std::set<std::string>& result);
/**
* Joins the given element with the delimiter
@ -319,11 +319,11 @@ namespace one_util
* @return a string copy
*/
std::string gsub(const std::string& st, const std::string& sfind,
const std::string& replacement);
const std::string& replacement);
template <class T>
std::set<T> set_intersection(const std::set<T> &first, const std::set<T>
&second)
&second)
{
std::set<T> output;

View File

@ -32,13 +32,12 @@ class ObjectCollection
public:
ObjectCollection(const std::string& _collection_name)
:collection_name(_collection_name){};
:collection_name(_collection_name) {};
ObjectCollection(const std::string& cname, const std::set<int>& cset)
:collection_name(cname), collection_set(cset){};
:collection_name(cname), collection_set(cset) {};
template <typename T>
ObjectCollection(const std::string& cname, const std::vector<T>& cvector)
template <typename T> ObjectCollection(const std::string& cname, const std::vector<T>& cvector)
:collection_name(cname)
{
for (const auto& i: cvector)
@ -48,7 +47,7 @@ public:
}
~ObjectCollection(){};
~ObjectCollection() {};
/**
* Adds an ID to the set.

View File

@ -39,7 +39,7 @@ protected:
* @return 0 on success
*/
virtual int select(
SqlDB * db) = 0;
SqlDB * db) = 0;
/**
* Writes the ObjectSQL in the database.
@ -47,8 +47,8 @@ protected:
* @return 0 on success
*/
virtual int insert(
SqlDB * db,
std::string& error_str) = 0;
SqlDB * db,
std::string& error_str) = 0;
/**
* Updates the ObjectSQL in the database.
@ -56,7 +56,7 @@ protected:
* @return 0 on success
*/
virtual int update(
SqlDB * db) = 0;
SqlDB * db) = 0;
/**
* Removes the ObjectSQL from the database.
@ -64,7 +64,7 @@ protected:
* @return 0 on success
*/
virtual int drop(
SqlDB * db) = 0;
SqlDB * db) = 0;
};
#endif /*OBJECT_SQL_H_*/

View File

@ -70,7 +70,7 @@ public:
xmlNodePtr cur;
xmlChar * str_ptr;
obj = xmlXPathEvalExpression(reinterpret_cast<const xmlChar *>(expr),ctx);
obj = xmlXPathEvalExpression(reinterpret_cast<const xmlChar *>(expr), ctx);
if (obj == 0)
{

View File

@ -34,7 +34,7 @@ public:
const std::string& _conf_name = conf_name):
NebulaTemplate(etc_location, _conf_name.c_str(), "OPENNEBULA_CONFIGURATION"),
var_location(_var_location)
{};
{};
~OpenNebulaTemplate() = default;
@ -54,7 +54,7 @@ public:
* Returns action set from a string of actions seperated by commas
*/
static int set_vm_auth_ops(const std::string& ops_str,
ActionSet<VMActions::Action>& ops_set, std::string& error);
ActionSet<VMActions::Action>& ops_set, std::string& error);
/**
* @param action

View File

@ -162,31 +162,31 @@ public:
const std::string& _uname,
const std::string& _gname,
const char * _table)
:ObjectSQL(),
ObjectXML(),
oid(id),
obj_type(_obj_type),
name(_name),
uid(_uid),
gid(_gid),
uname(_uname),
gname(_gname),
owner_u(1),
owner_m(1),
owner_a(0),
group_u(0),
group_m(0),
group_a(0),
other_u(0),
other_m(0),
other_a(0),
locked(LockStates::ST_NONE),
lock_owner(-1),
lock_req_id(-1),
lock_time(0),
ro(false),
_mutex(nullptr),
table(_table)
:ObjectSQL(),
ObjectXML(),
oid(id),
obj_type(_obj_type),
name(_name),
uid(_uid),
gid(_gid),
uname(_uname),
gname(_gname),
owner_u(1),
owner_m(1),
owner_a(0),
group_u(0),
group_m(0),
group_a(0),
other_u(0),
other_m(0),
other_a(0),
locked(LockStates::ST_NONE),
lock_owner(-1),
lock_req_id(-1),
lock_time(0),
ro(false),
_mutex(nullptr),
table(_table)
{
};
@ -629,7 +629,7 @@ protected:
* @return -1 if not found or oid otherwise
*/
static int select_oid(SqlDB *db, const char * _table, const std::string& _name,
int _uid);
int _uid);
/**
* Check if the object exists

View File

@ -52,8 +52,8 @@ public:
* @return the oid assigned to the object or -1 in case of failure
*/
virtual int allocate(
PoolObjectSQL *objsql,
std::string& error_str);
PoolObjectSQL *objsql,
std::string& error_str);
/**
* Gets an object from the pool (if needed the object is loaded from the
@ -153,9 +153,9 @@ public:
* @return 0 on success
*/
virtual int search(
std::vector<int>& oids,
const char * table,
const std::string& where);
std::vector<int>& oids,
const char * table,
const std::string& where);
/**
* List the objects in the pool
@ -165,8 +165,8 @@ public:
* @return 0 on success
*/
int list(
std::vector<int>& oids,
const char * table)
std::vector<int>& oids,
const char * table)
{
return search(oids, table, "");
}
@ -179,7 +179,7 @@ public:
* @return 0 on success.
*/
virtual int update(
PoolObjectSQL * objsql)
PoolObjectSQL * objsql)
{
return objsql->update(db);
};
@ -245,10 +245,10 @@ public:
* @return 0 on success
*/
virtual int dump_extended(std::string& oss,
const std::string& where,
int sid,
int eid,
bool desc)
const std::string& where,
int sid,
int eid,
bool desc)
{
return dump(oss, where, sid, eid, desc);
}
@ -328,10 +328,10 @@ public:
/**
* Return true if feature is supported
*/
bool supports(SqlDB::SqlFeature ft)
{
return db->supports(ft);
}
bool supports(SqlDB::SqlFeature ft)
{
return db->supports(ft);
}
protected:

View File

@ -35,12 +35,12 @@ class PostgreSqlDB : public SqlDB
{
public:
PostgreSqlDB(
const std::string& _server,
int _port,
const std::string& _user,
const std::string& _password,
const std::string& _database,
int _connections);
const std::string& _server,
int _port,
const std::string& _user,
const std::string& _password,
const std::string& _database,
int _connections);
~PostgreSqlDB();
@ -168,24 +168,25 @@ class PostgreSqlDB : public SqlDB
{
public:
PostgreSqlDB(
const std::string& _server,
int _port,
const std::string& _user,
const std::string& _password,
const std::string& _database,
int _connections)
const std::string& _server,
int _port,
const std::string& _user,
const std::string& _password,
const std::string& _database,
int _connections)
{
throw std::runtime_error("Aborting oned, PostgreSQL support not compiled!");
}
~PostgreSqlDB(){}
~PostgreSqlDB() {}
char * escape_str(const std::string& str) const override {return 0;};
void free_str(char * str) const override {};
protected:
int exec_ext(std::ostringstream& c, Callbackable *o, bool q) override {
int exec_ext(std::ostringstream& c, Callbackable *o, bool q) override
{
return -1;
};
};

View File

@ -66,20 +66,20 @@ public:
/**
* Returns the name that identifies the quota in a template
*/
virtual const char * get_quota_name() const = 0;
virtual const char * get_quota_name() const = 0;
/**
* Gets a quota identified by its ID.
* @param id of the quota
* @param va The quota, if it is found
* @return 0 on success, -1 if not found
*/
virtual int get_quota(const std::string& id, VectorAttribute **va) = 0;
/**
* Gets a quota identified by its ID.
* @param id of the quota
* @param va The quota, if it is found
* @return 0 on success, -1 if not found
*/
virtual int get_quota(const std::string& id, VectorAttribute **va) = 0;
protected:
QuotaInterface(){};
QuotaInterface() {};
virtual ~QuotaInterface(){};
virtual ~QuotaInterface() {};
};
/**
@ -120,9 +120,9 @@ class QuotaDecorator : public QuotaInterface
}
protected:
QuotaDecorator(QuotaInterface * _quota):quota(_quota){};
QuotaDecorator(QuotaInterface * _quota):quota(_quota) {};
virtual ~QuotaDecorator(){};
virtual ~QuotaDecorator() {};
QuotaInterface * quota;
};
@ -162,33 +162,33 @@ public:
/**
* Returns the name that identifies the quota in a template
*/
const char * get_quota_name() const override
{
const char * get_quota_name() const override
{
return template_name;
}
}
/**
* Gets a quota identified by its ID.
* @param id of the quota
* @param va The quota, if it is found
* @return 0 on success, -1 if not found
*/
int get_quota(const std::string& id, VectorAttribute **va) override
{
std::map<std::string, Attribute *>::iterator it;
return get_quota(id, va, it);
}
/**
* Gets a quota identified by its ID.
* @param id of the quota
* @param va The quota, if it is found
* @return 0 on success, -1 if not found
*/
int get_quota(const std::string& id, VectorAttribute **va) override
{
std::map<std::string, Attribute *>::iterator it;
return get_quota(id, va, it);
}
/**
* Value for limit default
*/
static const int DEFAULT;
static const std::string DEFAULT_STR;
/**
* Value for limit default
*/
static const int DEFAULT;
static const std::string DEFAULT_STR;
/**
* Value for "unlimited" limit
*/
static const int UNLIMITED;
/**
* Value for "unlimited" limit
*/
static const int UNLIMITED;
protected:
@ -199,9 +199,9 @@ protected:
: Template(false, '=', quota_name),
template_name(_template_name),
metrics(_metrics),
is_default(_is_default){};
is_default(_is_default) {};
virtual ~Quota(){};
virtual ~Quota() {};
/**
* Generic Quota Names
@ -271,8 +271,8 @@ protected:
* @return 0 on success, -1 if not found
*/
virtual int get_default_quota(const std::string& id,
Quotas& default_quotas,
VectorAttribute **va) = 0;
Quotas& default_quotas,
VectorAttribute **va) = 0;
/**
* Gets a quota identified by its ID.
@ -312,7 +312,7 @@ private:
*/
void add(VectorAttribute * nq)
{
attributes.insert(make_pair(nq->name(), nq));
attributes.insert(make_pair(nq->name(), nq));
}
/**
@ -333,7 +333,7 @@ private:
* @return 0 on success or -1 if wrong limits
*/
int update_limits(VectorAttribute* quota,
const VectorAttribute* va);
const VectorAttribute* va);
/**
* Extract the limits for the defined quota metrics from a given attribute

View File

@ -43,7 +43,7 @@ public:
is_default)
{};
~QuotaDatastore(){};
~QuotaDatastore() {};
/**
* Check if the resource allocation will exceed the quota limits. If not
@ -73,8 +73,8 @@ protected:
* @return 0 on success, -1 if not found
*/
int get_default_quota(const std::string& id,
Quotas& default_quotas,
VectorAttribute **va) override;
Quotas& default_quotas,
VectorAttribute **va) override;
static const std::vector<std::string> DS_METRICS;
};

View File

@ -41,7 +41,7 @@ public:
is_default)
{};
~QuotaImage(){};
~QuotaImage() {};
/**
* Check if the resource allocation will exceed the quota limits. If not
@ -71,8 +71,8 @@ protected:
* @return 0 on success, -1 if not found
*/
int get_default_quota(const std::string& id,
Quotas& default_quotas,
VectorAttribute **va) override;
Quotas& default_quotas,
VectorAttribute **va) override;
static const std::vector<std::string> IMAGE_METRICS;
};

View File

@ -37,7 +37,7 @@ public:
: Quota("NETWORK_QUOTA", "NETWORK", NET_METRICS, is_default)
{}
virtual ~QuotaNetwork(){};
virtual ~QuotaNetwork() {};
/**
* Check if the resource allocation will exceed the quota limits. If not
@ -73,8 +73,8 @@ protected:
* @return 0 on success, -1 if not found
*/
int get_default_quota(const std::string& id,
Quotas& default_quotas,
VectorAttribute **va) override;
Quotas& default_quotas,
VectorAttribute **va) override;
static const std::vector<std::string> NET_METRICS;
@ -96,7 +96,7 @@ private:
* @return true if the operation can be performed
*/
bool check(PoolObjectSQL::ObjectType otype, Template* tmpl,
Quotas& default_quotas, std::string& error);
Quotas& default_quotas, std::string& error);
/**
* Decrement usage counters when freeing a lease. This method considers
@ -115,9 +115,9 @@ private:
class QuotaNetworkVirtualRouter: public QuotaDecorator
{
public:
QuotaNetworkVirtualRouter(QuotaNetwork *qn):QuotaDecorator(qn){};
QuotaNetworkVirtualRouter(QuotaNetwork *qn):QuotaDecorator(qn) {};
virtual ~QuotaNetworkVirtualRouter(){};
virtual ~QuotaNetworkVirtualRouter() {};
bool check(Template* tmpl, Quotas& default_quotas, std::string& err) override
{
@ -126,7 +126,7 @@ public:
return qn->check(PoolObjectSQL::VROUTER, tmpl, default_quotas, err);
}
void del(Template* tmpl) override
void del(Template* tmpl) override
{
QuotaNetwork * qn = static_cast<QuotaNetwork *>(quota);

View File

@ -52,7 +52,7 @@ public:
is_default)
{};
~QuotaVirtualMachine(){};
~QuotaVirtualMachine() {};
/**
* Check if the resource allocation will exceed the quota limits. If not
@ -146,9 +146,9 @@ protected:
* @return 0 on success, -1 if not found
*/
int get_default_quota(
const std::string& id,
Quotas& default_quotas,
VectorAttribute **va) override;
const std::string& id,
Quotas& default_quotas,
VectorAttribute **va) override;
static std::vector<std::string> VM_METRICS;
static std::vector<std::string> VM_GENERIC;

View File

@ -30,7 +30,8 @@ public:
/**
* Different quota types
*/
enum QuotaType {
enum QuotaType
{
DATASTORE, /**< Checks Datastore usage */
VM, /**< Checks VM usage (MEMORY, CPU and VMS) */
NETWORK, /**< Checks Network usage (leases) */
@ -52,71 +53,71 @@ public:
* Delete usage from quota counters.
* @param tmpl Template with the quota usage
*/
void ds_del(Template * tmpl)
{
void ds_del(Template * tmpl)
{
datastore_quota.del(tmpl);
}
}
/**
* Gets a Datastore quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int ds_get(const std::string& id, VectorAttribute **va)
{
return datastore_quota.get_quota(id, va);
}
/**
* Gets a Datastore quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int ds_get(const std::string& id, VectorAttribute **va)
{
return datastore_quota.get_quota(id, va);
}
/**
* Add VM quota usage, without checking limits
* @param tmpl Template with the quota usage
*/
void vm_add(Template * tmpl)
{
vm_quota.add(tmpl);
}
/**
* Add VM quota usage, without checking limits
* @param tmpl Template with the quota usage
*/
void vm_add(Template * tmpl)
{
vm_quota.add(tmpl);
}
/**
* Gets a VM quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int vm_get(const std::string& id, VectorAttribute **va)
{
return vm_quota.get_quota(id, va);
}
/**
* Gets a VM quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int vm_get(const std::string& id, VectorAttribute **va)
{
return vm_quota.get_quota(id, va);
}
/**
* Gets a Network quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int network_get(const std::string& id, VectorAttribute **va)
{
return network_quota.get_quota(id, va);
}
/**
* Gets a Network quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int network_get(const std::string& id, VectorAttribute **va)
{
return network_quota.get_quota(id, va);
}
/**
* Gets an Image quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int image_get(const std::string& id, VectorAttribute **va)
{
return image_quota.get_quota(id, va);
}
/**
* Gets an Image quota identified by its ID.
*
* @param id of the quota
* @param va The quota, if it is found
*
* @return 0 on success, -1 if not found
*/
int image_get(const std::string& id, VectorAttribute **va)
{
return image_quota.get_quota(id, va);
}
/**
* Check quota, it updates usage counters if quotas are not exceeded.
@ -126,7 +127,7 @@ public:
* @param error_str string describing the error
* @return true if resource can be allocated, false otherwise
*/
bool quota_check(QuotaType type,
bool quota_check(QuotaType type,
Template *tmpl,
Quotas& default_quotas,
std::string& error_str);
@ -140,10 +141,10 @@ public:
* @param error_str string describing the error
* @return true if resource can be updated, false otherwise
*/
bool quota_update(QuotaType type,
Template *tmpl,
Quotas& default_quotas,
std::string& error_str);
bool quota_update(QuotaType type,
Template *tmpl,
Quotas& default_quotas,
std::string& error_str);
/**
* Delete usage from the given quota counters.
@ -249,12 +250,12 @@ public:
}
}
/**
* Delete a set of Datastore usage attributes from quota counters. Each
* quota datastore is associate to a given image. NOTE: The templates
* *ARE FREED* by this function
* @param ds_quotas a map with image_id and a tmpl with usage attributes
*/
/**
* Delete a set of Datastore usage attributes from quota counters. Each
* quota datastore is associate to a given image. NOTE: The templates
* *ARE FREED* by this function
* @param ds_quotas a map with image_id and a tmpl with usage attributes
*/
static void ds_del_recreate(int uid, int gid, std::vector<Template *>& ds_quotas);
/**
@ -274,7 +275,7 @@ public:
* @param tmpl template for the image, with usage
*/
static void quota_check(QuotaType type, int uid, int gid, Template * tmpl,
std::string& error);
std::string& error);
protected:
/**
@ -286,16 +287,16 @@ protected:
const char * _img_xpath,
const char * _vm_xpath,
bool is_deafult):
datastore_quota(is_deafult),
network_quota(is_deafult),
image_quota(is_deafult),
vm_quota(is_deafult),
ds_xpath(_ds_xpath),
net_xpath(_net_xpath),
img_xpath(_img_xpath),
vm_xpath(_vm_xpath){};
datastore_quota(is_deafult),
network_quota(is_deafult),
image_quota(is_deafult),
vm_quota(is_deafult),
ds_xpath(_ds_xpath),
net_xpath(_net_xpath),
img_xpath(_img_xpath),
vm_xpath(_vm_xpath) {};
virtual ~Quotas(){};
virtual ~Quotas() {};
private:
//--------------------------------------------------------------------------
@ -305,22 +306,22 @@ private:
/**
* Datastore Quotas
*/
QuotaDatastore datastore_quota;
QuotaDatastore datastore_quota;
/**
* Network Quotas
*/
QuotaNetwork network_quota;
QuotaNetwork network_quota;
/**
* Image Quotas
*/
QuotaImage image_quota;
QuotaImage image_quota;
/**
* Virtual Machine Quotas
*/
QuotaVirtualMachine vm_quota;
QuotaVirtualMachine vm_quota;
//--------------------------------------------------------------------------
// XPaths

View File

@ -71,11 +71,11 @@ protected:
const char * net_xpath,
const char * img_xpath,
const char * vm_xpath):
Quotas(ds_xpath, net_xpath, img_xpath, vm_xpath, false),
ObjectSQL(),
oid(-1){};
Quotas(ds_xpath, net_xpath, img_xpath, vm_xpath, false),
ObjectSQL(),
oid(-1) {};
virtual ~QuotasSQL(){};
virtual ~QuotasSQL() {};
virtual const char * table() const = 0;
@ -153,12 +153,12 @@ class GroupQuotas : public QuotasSQL
{
public:
GroupQuotas():QuotasSQL(
"/QUOTAS/DATASTORE_QUOTA",
"/QUOTAS/NETWORK_QUOTA",
"/QUOTAS/IMAGE_QUOTA",
"/QUOTAS/VM_QUOTA"){};
"/QUOTAS/DATASTORE_QUOTA",
"/QUOTAS/NETWORK_QUOTA",
"/QUOTAS/IMAGE_QUOTA",
"/QUOTAS/VM_QUOTA") {};
virtual ~GroupQuotas(){};
virtual ~GroupQuotas() {};
/**
* Bootstraps the database table for group quotas
@ -201,10 +201,10 @@ class UserQuotas : public QuotasSQL
{
public:
UserQuotas():QuotasSQL(
"/QUOTAS/DATASTORE_QUOTA",
"/QUOTAS/NETWORK_QUOTA",
"/QUOTAS/IMAGE_QUOTA",
"/QUOTAS/VM_QUOTA"){};
"/QUOTAS/DATASTORE_QUOTA",
"/QUOTAS/NETWORK_QUOTA",
"/QUOTAS/IMAGE_QUOTA",
"/QUOTAS/VM_QUOTA") {};
/**
* Bootstraps the database table for user quotas

View File

@ -34,7 +34,8 @@ public:
/**
* State of this server
*/
enum State {
enum State
{
SOLO = 0,
CANDIDATE = 1,
FOLLOWER = 2,
@ -52,9 +53,9 @@ public:
* @param xmlrpc timeout for RAFT related xmlrpc API calls
**/
RaftManager(int server_id, const VectorAttribute * leader_hook_mad,
const VectorAttribute * follower_hook_mad, time_t log_purge,
long long bcast, long long election, time_t xmlrpc,
const std::string& remotes_location);
const VectorAttribute * follower_hook_mad, time_t log_purge,
long long bcast, long long election, time_t xmlrpc,
const std::string& remotes_location);
~RaftManager() = default;
@ -254,7 +255,7 @@ public:
* @return -1 if a XMl-RPC (network) error occurs, 0 otherwise
*/
int xmlrpc_replicate_log(int follower_id, LogDBRecord * lr, bool& success,
unsigned int& ft, std::string& error);
unsigned int& ft, std::string& error);
/**
* Calls the request vote xml-rpc method
@ -267,8 +268,8 @@ public:
* @return -1 if a XMl-RPC (network) error occurs, 0 otherwise
*/
int xmlrpc_request_vote(int follower_id, uint64_t lindex,
unsigned int lterm, bool& success, unsigned int& fterm,
std::string& error);
unsigned int lterm, bool& success, unsigned int& fterm,
std::string& error);
// -------------------------------------------------------------------------
// Server related interface

View File

@ -27,7 +27,7 @@ class RankScheduler : public Scheduler
{
public:
RankScheduler():Scheduler(),rp_host(0),rp_ds(0),rp_nics(0), rp_vm(0){};
RankScheduler():Scheduler(), rp_host(0), rp_ds(0), rp_nics(0), rp_vm(0) {};
~RankScheduler()
{

View File

@ -66,7 +66,7 @@ public:
void add_replica_thread(int follower_id);
protected:
ReplicaManager(){};
ReplicaManager() {};
virtual ~ReplicaManager()
{
@ -96,9 +96,9 @@ private:
class RaftReplicaManager : public ReplicaManager
{
public:
RaftReplicaManager():ReplicaManager(){};
RaftReplicaManager():ReplicaManager() {};
virtual ~RaftReplicaManager(){};
virtual ~RaftReplicaManager() {};
private:
ReplicaThread * thread_factory(int follower_id) override;
@ -107,9 +107,9 @@ private:
class HeartBeatManager : public ReplicaManager
{
public:
HeartBeatManager():ReplicaManager(){};
HeartBeatManager():ReplicaManager() {};
virtual ~HeartBeatManager(){};
virtual ~HeartBeatManager() {};
private:
ReplicaThread * thread_factory(int follower_id) override;

View File

@ -27,9 +27,9 @@
class ReplicaRequest : public SyncRequest
{
public:
ReplicaRequest(uint64_t i):_index(i), _to_commit(-1), _replicas(1){};
ReplicaRequest(uint64_t i):_index(i), _to_commit(-1), _replicas(1) {};
~ReplicaRequest(){};
~ReplicaRequest() {};
/**
* This function updates the number of replicas of the record and decrement

View File

@ -100,7 +100,7 @@ class RaftReplicaThread : public ReplicaThread
public:
RaftReplicaThread(int follower_id);
virtual ~RaftReplicaThread(){};
virtual ~RaftReplicaThread() {};
private:
/**
@ -127,7 +127,7 @@ class FedReplicaThread : public ReplicaThread
public:
FedReplicaThread(int zone_id);
virtual ~FedReplicaThread(){};
virtual ~FedReplicaThread() {};
private:
/**
@ -149,7 +149,7 @@ class HeartBeatThread : public ReplicaThread
public:
HeartBeatThread(int follower_id);
virtual ~HeartBeatThread(){};
virtual ~HeartBeatThread() {};
private:
/**

View File

@ -117,7 +117,7 @@ public:
bool is_admin() const
{
return uid == UserPool::ONEADMIN_ID ||
group_ids.count(GroupPool::ONEADMIN_ID) == 1;
group_ids.count(GroupPool::ONEADMIN_ID) == 1;
}
bool is_oneadmin() const
@ -145,7 +145,7 @@ public:
ParamList(const xmlrpc_c::paramList * paramList,
const std::set<int>& hidden):
_paramList(paramList), _hidden(hidden){};
_paramList(paramList), _hidden(hidden) {};
std::string& to_string(std::string& str) const
{
@ -223,7 +223,8 @@ public:
/**
* Error codes for the XML-RPC API
*/
enum ErrorCode {
enum ErrorCode
{
SUCCESS = 0x00000,
AUTHENTICATION = 0x00100,
AUTHORIZATION = 0x00200,
@ -279,7 +280,7 @@ public:
* @return true if the user is authorized.
*/
static bool quota_authorization(Template * tmpl, Quotas::QuotaType qtype,
const RequestAttributes& att, std::string& error_str);
const RequestAttributes& att, std::string& error_str);
/**
* Performs rollback on usage counters for a previous quota check operation
@ -288,11 +289,11 @@ public:
* @param att the specific request attributes
*/
static void quota_rollback(Template * tmpl, Quotas::QuotaType qtype,
const RequestAttributes& att);
const RequestAttributes& att);
static std::string failure_message(ErrorCode ec, RequestAttributes& att,
const std::string& method_name,
PoolObjectSQL::ObjectType auth_object = PoolObjectSQL::NONE);
const std::string& method_name,
PoolObjectSQL::ObjectType auth_object = PoolObjectSQL::NONE);
/**
* Performs a basic authorization for this request using the uid/gid
@ -370,7 +371,7 @@ protected:
* @param _retval value to be returned to the client
*/
void execute(xmlrpc_c::paramList const& _paramList,
const xmlrpc_c::callInfo * _callInfoP, xmlrpc_c::value * const _retval) override;
const xmlrpc_c::callInfo * _callInfoP, xmlrpc_c::value * const _retval) override;
/**
* Actual Execution method for the request. Must be implemented by the
@ -484,7 +485,7 @@ protected:
* @return true if the user is authorized.
*/
bool quota_authorization(Template * tmpl, Quotas::QuotaType qtype,
RequestAttributes& att);
RequestAttributes& att);
/**
* @param tmpl describing the object
@ -497,16 +498,16 @@ private:
/* Functions to manage user and group quotas */
/* ---------------------------------------------------------------------- */
static bool user_quota_authorization(Template * tmpl, Quotas::QuotaType qtype,
const RequestAttributes& att, std::string& error_str);
const RequestAttributes& att, std::string& error_str);
static bool group_quota_authorization(Template * tmpl, Quotas::QuotaType qtype,
const RequestAttributes& att, std::string& error_str);
const RequestAttributes& att, std::string& error_str);
static void user_quota_rollback(Template * tmpl, Quotas::QuotaType qtype,
const RequestAttributes& att);
const RequestAttributes& att);
static void group_quota_rollback(Template * tmpl, Quotas::QuotaType qtype,
const RequestAttributes& att);
const RequestAttributes& att);
/**
* Builds an XML-RPC response updating retval. After calling this function
@ -526,9 +527,9 @@ private:
* @param callInfoP information of client
*/
static void log_method_invoked(const RequestAttributes& att,
const xmlrpc_c::paramList& paramList, const std::string& format_str,
const std::string& method_name, const std::set<int>& hidden_params,
const xmlrpc_c::callInfo * callInfoP);
const xmlrpc_c::paramList& paramList, const std::string& format_str,
const std::string& method_name, const std::set<int>& hidden_params,
const xmlrpc_c::callInfo * callInfoP);
/**
* Logs the method result, including the output data or error message
@ -537,7 +538,7 @@ private:
* @param method_name that produced the error
*/
static void log_result(const RequestAttributes& att,
const std::string& method_name);
const std::string& method_name);
/**
* Formats and adds a xmlrpc_c::value to oss.
@ -547,7 +548,7 @@ private:
* @param limit of characters to wirte
*/
static void log_xmlrpc_value(const xmlrpc_c::value& v,
std::ostringstream& oss, const int limit);
std::ostringstream& oss, const int limit);
// Default number of character to show in the log. Option %l<number>
const static int DEFAULT_LOG_LIMIT = 20;

View File

@ -30,7 +30,7 @@ protected:
RequestManagerAcl( const std::string& method_name,
const std::string& help,
const std::string& params)
:Request(method_name,params,help)
:Request(method_name, params, help)
{
auth_object = PoolObjectSQL::ACL;
auth_op = AuthRequest::MANAGE;
@ -39,7 +39,7 @@ protected:
aclm = nd.get_aclm();
};
~RequestManagerAcl(){};
~RequestManagerAcl() {};
/* -------------------------------------------------------------------- */
@ -58,7 +58,7 @@ public:
"A:ssss")
{};
~AclAddRule(){};
~AclAddRule() {};
void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) override;
@ -76,7 +76,7 @@ public:
"A:si")
{};
~AclDelRule(){};
~AclDelRule() {};
void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) override;
@ -94,7 +94,7 @@ public:
"A:s")
{};
~AclInfo(){};
~AclInfo() {};
void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) override;

View File

@ -57,7 +57,7 @@ protected:
const std::string& help,
const std::string& xml_args,
bool _do_template)
:Request(method_name,xml_args,help), do_template(_do_template)
:Request(method_name, xml_args, help), do_template(_do_template)
{
auth_op = AuthRequest::CREATE;
@ -65,7 +65,7 @@ protected:
clpool = nd.get_clpool();
};
~RequestManagerAllocate(){};
~RequestManagerAllocate() {};
/* -------------------------------------------------------------------- */
@ -73,29 +73,29 @@ protected:
RequestAttributes& att) override;
virtual bool allocate_authorization(xmlrpc_c::paramList const& _paramList,
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms);
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms);
/* -------------------------------------------------------------------- */
virtual std::unique_ptr<Template> get_object_template() const { return 0; };
virtual Request::ErrorCode pool_allocate(
xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att)
xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att)
{
return Request::INTERNAL;
};
virtual Request::ErrorCode pool_allocate(
xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name)
xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name)
{
return pool_allocate(_paramList, move(tmpl), id, att);
};
@ -155,7 +155,7 @@ public:
auth_object = PoolObjectSQL::VM;
};
~VirtualMachineAllocate(){};
~VirtualMachineAllocate() {};
/* --------------------------------------------------------------------- */
@ -170,8 +170,8 @@ public:
RequestAttributes& att) override;
bool allocate_authorization(xmlrpc_c::paramList const& paramList,
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
};
/* ------------------------------------------------------------------------- */
@ -191,7 +191,7 @@ public:
auth_object = PoolObjectSQL::NET;
};
~VirtualNetworkAllocate(){};
~VirtualNetworkAllocate() {};
/* --------------------------------------------------------------------- */
@ -201,11 +201,11 @@ public:
};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name) override;
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name) override;
int get_cluster_id(xmlrpc_c::paramList const& paramList) const override
{
@ -238,7 +238,7 @@ public:
auth_object = PoolObjectSQL::IMAGE;
};
~ImageAllocate(){};
~ImageAllocate() {};
/* --------------------------------------------------------------------- */
@ -263,7 +263,7 @@ public:
auth_object = PoolObjectSQL::TEMPLATE;
};
~TemplateAllocate(){};
~TemplateAllocate() {};
/* --------------------------------------------------------------------- */
@ -278,8 +278,8 @@ public:
RequestAttributes& att) override;
bool allocate_authorization(xmlrpc_c::paramList const& paramList,
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
};
class VirtualNetworkTemplateAllocate : public RequestManagerAllocate
@ -296,7 +296,7 @@ public:
auth_object = PoolObjectSQL::VNTEMPLATE;
};
~VirtualNetworkTemplateAllocate(){};
~VirtualNetworkTemplateAllocate() {};
/* --------------------------------------------------------------------- */
@ -311,8 +311,8 @@ public:
RequestAttributes& att) override;
bool allocate_authorization(xmlrpc_c::paramList const& paramList,
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
};
/* ------------------------------------------------------------------------- */
@ -332,16 +332,16 @@ public:
auth_object = PoolObjectSQL::HOST;
};
~HostAllocate(){};
~HostAllocate() {};
/* --------------------------------------------------------------------- */
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name) override;
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name) override;
int get_cluster_id(xmlrpc_c::paramList const& paramList) const override
{
@ -377,7 +377,7 @@ public:
hidden_params.insert(2); // password argument
};
~UserAllocate(){};
~UserAllocate() {};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& paramList,
std::unique_ptr<Template> tmpl,
@ -385,8 +385,8 @@ public:
RequestAttributes& att) override;
bool allocate_authorization(xmlrpc_c::paramList const& paramList,
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
private:
GroupPool * gpool;
};
@ -410,7 +410,7 @@ public:
vdcpool = nd.get_vdcpool();
};
~GroupAllocate(){};
~GroupAllocate() {};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& paramList,
std::unique_ptr<Template> tmpl,
@ -438,7 +438,7 @@ public:
auth_object = PoolObjectSQL::DATASTORE;
};
~DatastoreAllocate(){};
~DatastoreAllocate() {};
/* -------------------------------------------------------------------- */
@ -448,11 +448,11 @@ public:
};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name) override;
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att,
int cluster_id,
const std::string& cluster_name) override;
int get_cluster_id(xmlrpc_c::paramList const& paramList) const override
{
@ -485,7 +485,7 @@ public:
auth_object = PoolObjectSQL::CLUSTER;
};
~ClusterAllocate(){};
~ClusterAllocate() {};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& paramList,
std::unique_ptr<Template> tmpl,
@ -510,7 +510,7 @@ public:
auth_object = PoolObjectSQL::DOCUMENT;
};
~DocumentAllocate(){};
~DocumentAllocate() {};
/* --------------------------------------------------------------------- */
@ -542,7 +542,7 @@ public:
auth_object = PoolObjectSQL::ZONE;
};
~ZoneAllocate(){};
~ZoneAllocate() {};
/* --------------------------------------------------------------------- */
@ -577,7 +577,7 @@ public:
auth_object = PoolObjectSQL::SECGROUP;
};
~SecurityGroupAllocate(){};
~SecurityGroupAllocate() {};
/* --------------------------------------------------------------------- */
@ -609,7 +609,7 @@ public:
auth_object = PoolObjectSQL::VDC;
};
~VdcAllocate(){};
~VdcAllocate() {};
/* --------------------------------------------------------------------- */
@ -642,7 +642,7 @@ public:
auth_object = PoolObjectSQL::VROUTER;
};
~VirtualRouterAllocate(){};
~VirtualRouterAllocate() {};
/* --------------------------------------------------------------------- */
@ -657,8 +657,8 @@ public:
RequestAttributes& att) override;
bool allocate_authorization(xmlrpc_c::paramList const& paramList,
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
Template *obj_template, RequestAttributes& att,
PoolObjectAuth *cluster_perms) override;
};
/* ------------------------------------------------------------------------- */
@ -678,7 +678,7 @@ public:
auth_object = PoolObjectSQL::MARKETPLACE;
};
~MarketPlaceAllocate(){};
~MarketPlaceAllocate() {};
/* --------------------------------------------------------------------- */
@ -688,9 +688,9 @@ public:
};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
};
/* ------------------------------------------------------------------------- */
@ -711,7 +711,7 @@ public:
auth_object = PoolObjectSQL::MARKETPLACEAPP;
};
~MarketPlaceAppAllocate(){};
~MarketPlaceAppAllocate() {};
/* --------------------------------------------------------------------- */
@ -721,9 +721,9 @@ public:
};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
private:
MarketPlacePool * mppool;
};
@ -745,7 +745,7 @@ public:
auth_object = PoolObjectSQL::VMGROUP;
};
~VMGroupAllocate(){};
~VMGroupAllocate() {};
/* --------------------------------------------------------------------- */
@ -778,7 +778,7 @@ public:
auth_object = PoolObjectSQL::HOOK;
};
~HookAllocate(){};
~HookAllocate() {};
/* --------------------------------------------------------------------- */
@ -788,9 +788,9 @@ public:
};
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
};
@ -820,9 +820,9 @@ public:
}
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
std::unique_ptr<Template> tmpl,
int& id,
RequestAttributes& att) override;
};

View File

@ -26,12 +26,12 @@ class RequestManagerAllocateDB: public Request
{
protected:
RequestManagerAllocateDB(const std::string& name): Request(name, "A:ss",
"Allocates a new object from its template representation")
"Allocates a new object from its template representation")
{
auth_op = AuthRequest::MANAGE;
};
~RequestManagerAllocateDB(){};
~RequestManagerAllocateDB() {};
virtual PoolObjectSQL * create(const std::string& xml) = 0;
@ -75,7 +75,7 @@ public:
pool = Nebula::instance().get_apppool();
};
~MarketPlaceAppAllocateDB(){};
~MarketPlaceAppAllocateDB() {};
/* -------------------------------------------------------------------- */
@ -101,7 +101,7 @@ public:
pool = Nebula::instance().get_marketpool();
};
~MarketPlaceAllocateDB(){};
~MarketPlaceAllocateDB() {};
/* -------------------------------------------------------------------- */

View File

@ -42,19 +42,19 @@ class RequestManagerChmod : public Request
{
protected:
RequestManagerChmod(const std::string& method_name, const std::string& help,
const std::string& params = "A:siiiiiiiiii"):
Request(method_name, params, help){};
const std::string& params = "A:siiiiiiiiii"):
Request(method_name, params, help) {};
~RequestManagerChmod(){};
~RequestManagerChmod() {};
/* -------------------------------------------------------------------- */
void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) override;
RequestAttributes& att) override;
virtual ErrorCode chmod(PoolSQL * pool, int oid, int owner_u, int owner_m,
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att);
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att);
};
/* ------------------------------------------------------------------------- */
@ -72,7 +72,7 @@ public:
auth_object = PoolObjectSQL::VM;
};
~VirtualMachineChmod(){};
~VirtualMachineChmod() {};
};
/* ------------------------------------------------------------------------- */
@ -83,28 +83,28 @@ class TemplateChmod : public RequestManagerChmod
public:
TemplateChmod():
RequestManagerChmod("one.template.chmod", "Changes permission bits of a "
"virtual machine template", "A:siiiiiiiiiib")
"virtual machine template", "A:siiiiiiiiiib")
{
Nebula& nd = Nebula::instance();
pool = nd.get_tpool();
auth_object = PoolObjectSQL::TEMPLATE;
};
~TemplateChmod(){};
~TemplateChmod() {};
ErrorCode request_execute(PoolSQL * pool, int oid, int owner_u, int owner_m,
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att)
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att)
{
return chmod(pool, oid, owner_u, owner_m, owner_a, group_u, group_m,
group_a, other_u, other_m, other_a, recursive, att);
group_a, other_u, other_m, other_a, recursive, att);
}
protected:
ErrorCode chmod(PoolSQL * pool, int oid, int owner_u, int owner_m,
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att) override;
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att) override;
};
/* ------------------------------------------------------------------------- */
@ -115,21 +115,21 @@ class VirtualNetworkTemplateChmod : public RequestManagerChmod
public:
VirtualNetworkTemplateChmod():
RequestManagerChmod("one.vntemplate.chmod", "Changes permission bits of a "
"virtual network template")
"virtual network template")
{
Nebula& nd = Nebula::instance();
pool = nd.get_vntpool();
auth_object = PoolObjectSQL::VNTEMPLATE;
};
~VirtualNetworkTemplateChmod(){};
~VirtualNetworkTemplateChmod() {};
ErrorCode request_execute(PoolSQL * pool, int oid, int owner_u, int owner_m,
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att)
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, bool recursive, RequestAttributes& att)
{
return chmod(pool, oid, owner_u, owner_m, owner_a, group_u, group_m,
group_a, other_u, other_m, other_a, recursive, att);
group_a, other_u, other_m, other_a, recursive, att);
}
};
@ -141,14 +141,14 @@ class VirtualNetworkChmod: public RequestManagerChmod
public:
VirtualNetworkChmod():
RequestManagerChmod("one.vn.chmod",
"Changes permission bits of a virtual network")
"Changes permission bits of a virtual network")
{
Nebula& nd = Nebula::instance();
pool = nd.get_vnpool();
auth_object = PoolObjectSQL::NET;
};
~VirtualNetworkChmod(){};
~VirtualNetworkChmod() {};
};
/* ------------------------------------------------------------------------- */
@ -166,14 +166,14 @@ public:
auth_object = PoolObjectSQL::IMAGE;
};
~ImageChmod(){};
~ImageChmod() {};
ErrorCode request_execute(PoolSQL * pool, int oid, int owner_u, int owner_m,
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, RequestAttributes& att)
int owner_a, int group_u, int group_m, int group_a, int other_u,
int other_m, int other_a, RequestAttributes& att)
{
return chmod(pool, oid, owner_u, owner_m, owner_a, group_u, group_m,
group_a, other_u, other_m, other_a, false, att);
group_a, other_u, other_m, other_a, false, att);
}
};
@ -185,14 +185,14 @@ class DatastoreChmod: public RequestManagerChmod
public:
DatastoreChmod():
RequestManagerChmod("one.datastore.chmod",
"Changes permission bits of a datastore")
"Changes permission bits of a datastore")
{
Nebula& nd = Nebula::instance();
pool = nd.get_dspool();
auth_object = PoolObjectSQL::DATASTORE;
};
~DatastoreChmod(){};
~DatastoreChmod() {};
};
/* ------------------------------------------------------------------------- */
@ -210,7 +210,7 @@ public:
auth_object = PoolObjectSQL::DOCUMENT;
};
~DocumentChmod(){};
~DocumentChmod() {};
};
/* ------------------------------------------------------------------------- */
@ -228,7 +228,7 @@ public:
auth_object = PoolObjectSQL::SECGROUP;
};
~SecurityGroupChmod(){};
~SecurityGroupChmod() {};
};
/* ------------------------------------------------------------------------- */
@ -247,10 +247,10 @@ public:
auth_object = PoolObjectSQL::VROUTER;
};
~VirtualRouterChmod(){};
~VirtualRouterChmod() {};
void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) override;
RequestAttributes& att) override;
private:
@ -265,14 +265,14 @@ class MarketPlaceChmod: public RequestManagerChmod
public:
MarketPlaceChmod():
RequestManagerChmod("one.market.chmod",
"Changes permission bits of a marketplace")
"Changes permission bits of a marketplace")
{
Nebula& nd = Nebula::instance();
pool = nd.get_marketpool();
auth_object = PoolObjectSQL::MARKETPLACE;
};
~MarketPlaceChmod(){};
~MarketPlaceChmod() {};
};
/* ------------------------------------------------------------------------- */
@ -283,14 +283,14 @@ class MarketPlaceAppChmod: public RequestManagerChmod
public:
MarketPlaceAppChmod():
RequestManagerChmod("one.marketapp.chmod",
"Changes permission bits of a marketplace app")
"Changes permission bits of a marketplace app")
{
Nebula& nd = Nebula::instance();
pool = nd.get_apppool();
auth_object = PoolObjectSQL::MARKETPLACEAPP;
};
~MarketPlaceAppChmod(){};
~MarketPlaceAppChmod() {};
};
/* -------------------------------------------------------------------------- */
@ -308,7 +308,7 @@ public:
auth_object = PoolObjectSQL::VMGROUP;
};
~VMGroupChmod(){};
~VMGroupChmod() {};
};
/* -------------------------------------------------------------------------- */

Some files were not shown because too many files have changed in this diff Show More