1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-04-25 18:50:08 +03:00

F #6103: Last set of CppCheck issues (#2481)

This commit is contained in:
Pavel Czerný 2023-02-07 08:50:30 +01:00 committed by GitHub
parent 7b56617ca8
commit 4a9662a551
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
173 changed files with 402 additions and 668 deletions

View File

@ -39,7 +39,7 @@ public:
* @param error_msg description if error * @param error_msg description if error
* @return 0 on success * @return 0 on success
*/ */
int from_vattr(VectorAttribute * attr, std::string& error_msg); int from_vattr(VectorAttribute * attr, std::string& error_msg) override;
/** /**
* Sets the given range of addresses (by index) as used * Sets the given range of addresses (by index) as used
@ -50,7 +50,7 @@ public:
* @return 0 if success * @return 0 if success
*/ */
int allocate_addr(unsigned int index, unsigned int rsize, int allocate_addr(unsigned int index, unsigned int rsize,
std::string& error_msg); std::string& error_msg) override;
/** /**
* Gets a range of free addresses * Gets a range of free addresses
@ -61,7 +61,7 @@ public:
* @return 0 if success * @return 0 if success
*/ */
int get_addr(unsigned int& index, unsigned int rsize, int get_addr(unsigned int& index, unsigned int rsize,
std::string& error_msg); std::string& error_msg) override;
/** /**
* Sets the given address (by index) as free * Sets the given address (by index) as free
@ -70,7 +70,7 @@ public:
* *
* @return 0 if success * @return 0 if success
*/ */
int free_addr(unsigned int index, std::string& msg); int free_addr(unsigned int index, std::string& msg) override;
}; };
#endif #endif

View File

@ -39,7 +39,7 @@ public:
* @param error_msg description if error * @param error_msg description if error
* @return 0 on success * @return 0 on success
*/ */
int from_vattr(VectorAttribute * attr, std::string& error_msg) int from_vattr(VectorAttribute * attr, std::string& error_msg) override
{ {
return AddressRange::from_attr(attr, error_msg); return AddressRange::from_attr(attr, error_msg);
} }
@ -53,7 +53,7 @@ public:
* @return 0 if success * @return 0 if success
*/ */
int allocate_addr(unsigned int index, unsigned int rsize, int allocate_addr(unsigned int index, unsigned int rsize,
std::string& error_msg) std::string& error_msg) override
{ {
return 0; return 0;
} }
@ -67,7 +67,7 @@ public:
* @return 0 if success * @return 0 if success
*/ */
int get_addr(unsigned int& index, unsigned int rsize, int get_addr(unsigned int& index, unsigned int rsize,
std::string& error_msg) std::string& error_msg) override
{ {
if ( rsize == 1 ) if ( rsize == 1 )
{ {
@ -84,7 +84,7 @@ public:
* *
* @return 0 if success * @return 0 if success
*/ */
int free_addr(unsigned int index, std::string& msg) int free_addr(unsigned int index, std::string& msg) override
{ {
return 0; return 0;
}; };

View File

@ -320,7 +320,7 @@ private:
* @param string with reserved bits * @param string with reserved bits
*/ */
void set_reserved_bit(std::string& reserved) void set_reserved_bit(const std::string& reserved)
{ {
std::vector<std::string> strings; std::vector<std::string> strings;
std::vector<std::string> range; std::vector<std::string> range;

View File

@ -360,7 +360,7 @@ class empty_cb : public Callbackable
public: public:
void set_callback(Callback _cb, void * _arg = 0){}; void set_callback(Callback _cb, void * _arg = 0){};
bool isCallBackSet() bool isCallBackSet() override
{ {
return false; return false;
}; };

View File

@ -27,7 +27,7 @@ class ClusterPool : public PoolSQL
public: public:
ClusterPool(SqlDB * db, ClusterPool(SqlDB * db,
const VectorAttribute * vnc_conf, const VectorAttribute * vnc_conf,
std::vector<const SingleAttribute *>& encrypted_attrs); const std::vector<const SingleAttribute *>& encrypted_attrs);
~ClusterPool(){}; ~ClusterPool(){};
@ -162,7 +162,7 @@ public:
* -2 object is a system cluster (ID < 100) * -2 object is a system cluster (ID < 100)
* -3 Cluster's User IDs set is not empty * -3 Cluster's User IDs set is not empty
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Bootstraps the database table(s) associated to the Cluster pool * Bootstraps the database table(s) associated to the Cluster pool
@ -192,7 +192,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "CLUSTER_POOL", "body", return PoolSQL::dump(oss, "CLUSTER_POOL", "body",
one_db::cluster_table, where, one_db::cluster_table, where,
@ -267,7 +267,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Cluster(-1,"",0, &vnc_conf); return new Cluster(-1,"",0, &vnc_conf);
}; };

View File

@ -36,17 +36,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Encrypted attributes interface implementation // Encrypted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual void encrypt(const std::string& one_key) void encrypt(const std::string& one_key) override
{ {
Template::encrypt(one_key, encrypted); Template::encrypt(one_key, encrypted);
} }
virtual void decrypt(const std::string& one_key) void decrypt(const std::string& one_key) override
{ {
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
Template::parse_encrypted(ea, encrypted); Template::parse_encrypted(ea, encrypted);
} }

View File

@ -27,7 +27,7 @@ class DatastorePool : public PoolSQL
public: public:
DatastorePool(SqlDB * db, DatastorePool(SqlDB * db,
const std::vector<const SingleAttribute *>& _inherit_attrs, const std::vector<const SingleAttribute *>& _inherit_attrs,
std::vector<const SingleAttribute *>& encrypted_attrs); const std::vector<const SingleAttribute *>& encrypted_attrs);
~DatastorePool(){}; ~DatastorePool(){};
@ -126,7 +126,7 @@ public:
* @return 0 on success, -1 DB error * @return 0 on success, -1 DB error
* -3 Datastore's Image IDs set is not empty * -3 Datastore's Image IDs set is not empty
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Bootstraps the database table(s) associated to the Datastore pool * Bootstraps the database table(s) associated to the Datastore pool
@ -149,7 +149,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "DATASTORE_POOL", "body", one_db::ds_table, return PoolSQL::dump(oss, "DATASTORE_POOL", "body", one_db::ds_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -205,7 +205,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
std::set<int> empty; std::set<int> empty;

View File

@ -36,17 +36,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Encrypted attributes interface implementation // Encrypted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual void encrypt(const std::string& one_key) void encrypt(const std::string& one_key) override
{ {
Template::encrypt(one_key, encrypted); Template::encrypt(one_key, encrypted);
} }
virtual void decrypt(const std::string& one_key) void decrypt(const std::string& one_key) override
{ {
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
Template::parse_encrypted(ea, encrypted); Template::parse_encrypted(ea, encrypted);
} }

View File

@ -28,7 +28,7 @@ class DocumentPool : public PoolSQL
{ {
public: public:
DocumentPool(SqlDB * db, std::vector<const SingleAttribute *>& ea) : 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); DocumentTemplate::parse_encrypted(ea);
}; };
@ -103,7 +103,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "DOCUMENT_POOL", "body", one_db::doc_table, return PoolSQL::dump(oss, "DOCUMENT_POOL", "body", one_db::doc_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -123,7 +123,7 @@ private:
* Factory method to produce Image objects * Factory method to produce Image objects
* @return a pointer to the new Image * @return a pointer to the new Image
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Document(-1,-1,-1,"","",0,0,0); return new Document(-1,-1,-1,"","",0,0,0);
}; };

View File

@ -46,7 +46,7 @@ public:
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
Template::parse_encrypted(ea, encrypted); Template::parse_encrypted(ea, encrypted);
} }

View File

@ -73,22 +73,22 @@ public:
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* Attribute Interface */ /* Attribute Interface */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
std::string marshall(const char * _sep = 0) const std::string marshall(const char * _sep = 0) const override
{ {
return va->marshall(_sep); return va->marshall(_sep);
}; };
void to_xml(std::ostringstream& s) const void to_xml(std::ostringstream& s) const override
{ {
return va->to_xml(s); return va->to_xml(s);
}; };
void to_json(std::ostringstream& s) const void to_json(std::ostringstream& s) const override
{ {
return va->to_json(s); return va->to_json(s);
}; };
void to_token(std::ostringstream& s) const void to_token(std::ostringstream& s) const override
{ {
return va->to_token(s); return va->to_token(s);
}; };
@ -110,17 +110,17 @@ protected:
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* Attribute Interface */ /* Attribute Interface */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void unmarshall(const std::string& sattr, const char * _sep = 0) void unmarshall(const std::string& sattr, const char * _sep = 0) override
{ {
va->unmarshall(sattr, _sep); va->unmarshall(sattr, _sep);
} }
AttributeType type() AttributeType type() override
{ {
return va->type(); return va->type();
}; };
Attribute* clone() const Attribute* clone() const override
{ {
return va->clone(); return va->clone();
}; };

View File

@ -120,7 +120,7 @@ private:
/** /**
* Creates federation replica thread objects * Creates federation replica thread objects
*/ */
ReplicaThread * thread_factory(int follower_id); ReplicaThread * thread_factory(int follower_id) override;
/** /**
* Controls access to the zone list and server data * Controls access to the zone list and server data

View File

@ -26,7 +26,7 @@ class GroupPool : public PoolSQL
public: public:
GroupPool(SqlDB * db, bool is_federation_slave, GroupPool(SqlDB * db, bool is_federation_slave,
std::vector<const SingleAttribute *>& restricted_attrs); const std::vector<const SingleAttribute *>& restricted_attrs);
~GroupPool() = default; ~GroupPool() = default;
@ -120,7 +120,7 @@ public:
* @param user pointer to Group * @param user pointer to Group
* @return 0 on success * @return 0 on success
*/ */
int update(PoolObjectSQL * objsql); int update(PoolObjectSQL * objsql) override;
/** /**
* Update a particular Group's Quotas * Update a particular Group's Quotas
@ -139,7 +139,7 @@ public:
* -2 object is a system group (ID < 100) * -2 object is a system group (ID < 100)
* -3 Group's User IDs set is not empty * -3 Group's User IDs set is not empty
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Bootstraps the database table(s) associated to the Group pool * Bootstraps the database table(s) associated to the Group pool
@ -162,7 +162,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int dump(std::string& oss, const std::string& where,
int sid, int eid, bool desc); int sid, int eid, bool desc) override;
private: private:
@ -170,7 +170,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Group(-1,""); return new Group(-1,"");
}; };

View File

@ -42,7 +42,7 @@ public:
return Template::check_restricted(rs_attr, restricted); return Template::check_restricted(rs_attr, restricted);
} }
static void parse_restricted(std::vector<const SingleAttribute *>& ra) static void parse_restricted(const std::vector<const SingleAttribute *>& ra)
{ {
Template::parse_restricted(ra, restricted); Template::parse_restricted(ra, restricted);
} }

View File

@ -125,7 +125,7 @@ private:
* @param db pointer to the database. * @param db pointer to the database.
* @return 0 on success. * @return 0 on success.
*/ */
int insert(SqlDB * db, std::string& error_str) int insert(SqlDB * db, std::string& error_str) override
{ {
error_str.clear(); error_str.clear();
@ -137,14 +137,14 @@ private:
* @param db pointer to the database. * @param db pointer to the database.
* @return 0 on success. * @return 0 on success.
*/ */
int select(SqlDB * db); int select(SqlDB * db) override;
/** /**
* Updates the history record * Updates the history record
* @param db pointer to the database. * @param db pointer to the database.
* @return 0 on success. * @return 0 on success.
*/ */
int update(SqlDB * db) int update(SqlDB * db) override
{ {
return insert_replace(db, true); return insert_replace(db, true);
} }
@ -154,7 +154,7 @@ private:
* @param db pointer to the database. * @param db pointer to the database.
* @return 0 on success. * @return 0 on success.
*/ */
int drop(SqlDB * db); int drop(SqlDB * db) override;
/** /**
* Execute an INSERT or REPLACE Sql query. * Execute an INSERT or REPLACE Sql query.

View File

@ -74,7 +74,7 @@ public:
* @param xml the resulting XML string * @param xml the resulting XML string
* @return a reference to the generated string * @return a reference to the generated string
*/ */
std::string& to_xml(std::string& xml) const std::string& to_xml(std::string& xml) const override
{ {
return _to_xml(xml, false); return _to_xml(xml, false);
} }
@ -105,7 +105,7 @@ private:
/** /**
* Factory method for Hook templates * Factory method for Hook templates
*/ */
std::unique_ptr<Template> get_new_template() const std::unique_ptr<Template> get_new_template() const override
{ {
return std::make_unique<Template>(); return std::make_unique<Template>();
} }
@ -117,13 +117,13 @@ private:
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
*/ */
int from_xml(const std::string &xml_str); int from_xml(const std::string &xml_str) override;
/* Checks the mandatory templates attrbutes /* Checks the mandatory templates attrbutes
* @param error string describing the error if any * @param error string describing the error if any
* @return 0 on success * @return 0 on success
*/ */
int post_update_template(std::string& error); int post_update_template(std::string& error) override;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Hook Attributes // Hook Attributes

View File

@ -32,8 +32,9 @@ public:
/** /**
* Function to build a XML message for an API hook * Function to build a XML message for an API hook
*/ */
static std::string format_message(const std::string& method, ParamList& paramList, static std::string format_message(const std::string& method,
const RequestAttributes& att); const ParamList& paramList,
const RequestAttributes& att);
/** /**
* Check if an api call is supported or not. * Check if an api call is supported or not.
@ -62,7 +63,7 @@ private:
* @param error_str string with error information * @param error_str string with error information
* @return 0 on success * @return 0 on success
*/ */
int parse_template(Template *tmpl, std::string& error_str); int parse_template(Template *tmpl, std::string& error_str) override;
/** /**
* Rebuilds the object from a template * Rebuilds the object from a template
@ -70,7 +71,7 @@ private:
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
*/ */
int from_template(const Template * tmpl, std::string& error); int from_template(const Template * tmpl, std::string& error) override;
/* Checks the mandatory template attributes /* Checks the mandatory template attributes
* @param tmpl The hook template * @param tmpl The hook template
@ -78,7 +79,7 @@ private:
* *
* @return 0 on success * @return 0 on success
*/ */
int post_update_template(Template * tmpl, std::string& error); int post_update_template(Template * tmpl, std::string& error) override;
/** /**
* Check if an api call does exist in the XMLRPC server. * Check if an api call does exist in the XMLRPC server.

View File

@ -69,7 +69,7 @@ public:
* *
* @return 0 on success * @return 0 on success
*/ */
int add(int hkid, int rc, std::string &xml_result); int add(int hkid, int rc, const std::string &xml_result);
/** /**
* Retries a given execution for a host, using the same execution context * Retries a given execution for a host, using the same execution context

View File

@ -84,7 +84,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "HOOK_POOL", "body", one_db::hook_table, return PoolSQL::dump(oss, "HOOK_POOL", "body", one_db::hook_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -94,7 +94,7 @@ public:
* Factory method to produce Hook objects * Factory method to produce Hook objects
* @return a pointer to the new VN * @return a pointer to the new VN
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Hook(0); return new Hook(0);
}; };

View File

@ -50,7 +50,7 @@ private:
* @param error_str string with error information * @param error_str string with error information
* @return 0 on success * @return 0 on success
*/ */
int parse_template(Template *tmpl, std::string& error_str); int parse_template(Template *tmpl, std::string& error_str) override;
/** /**
* Rebuilds the object from a template * Rebuilds the object from a template
@ -58,14 +58,14 @@ private:
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
*/ */
int from_template(const Template * tmpl, std::string& error); int from_template(const Template * tmpl, std::string& error) override;
/* Checks the mandatory template attributes /* Checks the mandatory template attributes
* @param tmpl The hook template * @param tmpl The hook template
* @param error string describing the error if any * @param error string describing the error if any
* @return 0 on success * @return 0 on success
*/ */
int post_update_template(Template * tmpl, std::string& error); int post_update_template(Template * tmpl, std::string& error) override;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Hook API Attributes // Hook API Attributes

View File

@ -50,7 +50,7 @@ private:
* @param error_str string with error information * @param error_str string with error information
* @return 0 on success * @return 0 on success
*/ */
int parse_template(Template *tmpl, std::string& error_str); int parse_template(Template *tmpl, std::string& error_str) override;
/** /**
* Rebuilds the object from a template * Rebuilds the object from a template
@ -58,14 +58,14 @@ private:
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
*/ */
int from_template(const Template * tmpl, std::string& error); int from_template(const Template * tmpl, std::string& error) override;
/* Checks the mandatory template attributes /* Checks the mandatory template attributes
* @param tmpl The hook template * @param tmpl The hook template
* @param error string describing the error if any * @param error string describing the error if any
* @return 0 on success * @return 0 on success
*/ */
int post_update_template(Template * tmpl, std::string& error); int post_update_template(Template * tmpl, std::string& error) override;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Hook API Attributes // Hook API Attributes

View File

@ -51,7 +51,7 @@ private:
* @param error_str string with error information * @param error_str string with error information
* @return 0 on success * @return 0 on success
*/ */
int parse_template(Template *tmpl, std::string& error_str); int parse_template(Template *tmpl, std::string& error_str) override;
/** /**
* Rebuilds the object from a template * Rebuilds the object from a template
@ -59,14 +59,14 @@ private:
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
*/ */
int from_template(const Template * tmpl, std::string& error); int from_template(const Template * tmpl, std::string& error) override;
/* Checks the mandatory template attributes /* Checks the mandatory template attributes
* @param tmpl The hook template * @param tmpl The hook template
* @param error string describing the error if any * @param error string describing the error if any
* @return 0 on success * @return 0 on success
*/ */
int post_update_template(Template * tmpl, std::string& error); int post_update_template(Template * tmpl, std::string& error) override;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Hook API Attributes // Hook API Attributes

View File

@ -50,7 +50,7 @@ private:
* @param error_str string with error information * @param error_str string with error information
* @return 0 on success * @return 0 on success
*/ */
int parse_template(Template *tmpl, std::string& error_str); int parse_template(Template *tmpl, std::string& error_str) override;
/** /**
* Rebuilds the object from a template * Rebuilds the object from a template
@ -58,14 +58,14 @@ private:
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
*/ */
int from_template(const Template * tmpl, std::string& error); int from_template(const Template * tmpl, std::string& error) override;
/* Checks the mandatory template attributes /* Checks the mandatory template attributes
* @param tmpl The hook template * @param tmpl The hook template
* @param error string describing the error if any * @param error string describing the error if any
* @return 0 on success * @return 0 on success
*/ */
int post_update_template(Template * tmpl, std::string& error); int post_update_template(Template * tmpl, std::string& error) override;
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Hook API Attributes // Hook API Attributes

View File

@ -32,7 +32,7 @@
class HostPool : public PoolSQL class HostPool : public PoolSQL
{ {
public: public:
HostPool(SqlDB * db, std::vector<const SingleAttribute *>& secrets); HostPool(SqlDB * db, const std::vector<const SingleAttribute *>& secrets);
~HostPool() = default; ~HostPool() = default;
@ -185,7 +185,7 @@ public:
} }
} }
int drop(PoolObjectSQL * objsql, std::string& error_msg) int drop(PoolObjectSQL * objsql, std::string& error_msg) override
{ {
Host * host = static_cast<Host *>(objsql); Host * host = static_cast<Host *>(objsql);
@ -210,7 +210,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "HOST_POOL", "body", one_db::host_table, return PoolSQL::dump(oss, "HOST_POOL", "body", one_db::host_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -269,7 +269,7 @@ private:
* Factory method to produce Host objects * Factory method to produce Host objects
* @return a pointer to the new Host * @return a pointer to the new Host
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Host(-1,"","","",-1,""); return new Host(-1,"","","",-1,"");
}; };

View File

@ -35,17 +35,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Encrypted attributes interface implementation // Encrypted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual void encrypt(const std::string& one_key) void encrypt(const std::string& one_key) override
{ {
Template::encrypt(one_key, encrypted); Template::encrypt(one_key, encrypted);
} }
virtual void decrypt(const std::string& one_key) void decrypt(const std::string& one_key) override
{ {
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
Template::parse_encrypted(ea, encrypted); Template::parse_encrypted(ea, encrypted);
} }

View File

@ -40,8 +40,8 @@ public:
const std::string& __default_type, const std::string& __default_type,
const std::string& __default_dev_prefix, const std::string& __default_dev_prefix,
const std::string& __default_cdrom_dev_prefix, const std::string& __default_cdrom_dev_prefix,
std::vector<const SingleAttribute *>& restricted_attrs, const std::vector<const SingleAttribute *>& restricted_attrs,
std::vector<const SingleAttribute *>& encrypted_attrs, const std::vector<const SingleAttribute *>& encrypted_attrs,
const std::vector<const SingleAttribute *>& inherit_attrs); const std::vector<const SingleAttribute *>& inherit_attrs);
~ImagePool(){}; ~ImagePool(){};
@ -88,7 +88,7 @@ public:
std::string& error_str); std::string& error_str);
/** /**
* Updates an Image in the data base. It also updates the previous state * Updates an Image in the data base. It also updates the previous state
* after executing the hooks. * after executing the hooks.
* @param objsql a pointer to the VM * @param objsql a pointer to the VM
* *
@ -167,7 +167,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "IMAGE_POOL", "body", one_db::image_table, return PoolSQL::dump(oss, "IMAGE_POOL", "body", one_db::image_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -259,7 +259,7 @@ private:
* Factory method to produce Image objects * Factory method to produce Image objects
* @return a pointer to the new Image * @return a pointer to the new Image
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Image(-1,-1,"","",0,0); return new Image(-1,-1,"","",0,0);
}; };

View File

@ -53,17 +53,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Restricted attributes interface implementation // Restricted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual bool check_restricted(std::string& rs_attr, const Template* base) bool check_restricted(std::string& rs_attr, const Template* base) override
{ {
return Template::check_restricted(rs_attr, base, restricted); return Template::check_restricted(rs_attr, base, restricted);
} }
virtual bool check_restricted(std::string& rs_attr) bool check_restricted(std::string& rs_attr) override
{ {
return Template::check_restricted(rs_attr, restricted); return Template::check_restricted(rs_attr, restricted);
} }
static void parse_restricted(std::vector<const SingleAttribute *>& ra) static void parse_restricted(const std::vector<const SingleAttribute *>& ra)
{ {
Template::parse_restricted(ra, restricted); Template::parse_restricted(ra, restricted);
} }
@ -71,17 +71,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Encrypted attributes interface implementation // Encrypted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual void encrypt(const std::string& one_key) void encrypt(const std::string& one_key) override
{ {
Template::encrypt(one_key, encrypted); Template::encrypt(one_key, encrypted);
} }
virtual void decrypt(const std::string& one_key) void decrypt(const std::string& one_key) override
{ {
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
Template::parse_encrypted(ea, encrypted); Template::parse_encrypted(ea, encrypted);
} }

View File

@ -115,10 +115,10 @@ public:
virtual ~FileLog(); virtual ~FileLog();
virtual void log( void log(
const char * module, const char * module,
const MessageType type, const MessageType type,
const char * message); const char * message) override;
private: private:
std::string log_file_name; std::string log_file_name;
@ -142,7 +142,7 @@ public:
void log( void log(
const char * module, const char * module,
const MessageType type, const MessageType type,
const char * message) const char * message) override
{ {
std::lock_guard <std::mutex> lock(log_mutex); std::lock_guard <std::mutex> lock(log_mutex);
FileLog::log(module,type,message); FileLog::log(module,type,message);
@ -173,7 +173,7 @@ public:
void log( void log(
const char * module, const char * module,
const MessageType type, const MessageType type,
const char * message); const char * message) override;
private: private:
std::string resource_label; std::string resource_label;
@ -200,7 +200,7 @@ public:
void log( void log(
const char * module, const char * module,
const MessageType type, const MessageType type,
const char * message); const char * message) override;
/** /**
* Return the associated syslog level * Return the associated syslog level

View File

@ -126,7 +126,7 @@ public:
* @return 0 on sucess, -1 on failure * @return 0 on sucess, -1 on failure
*/ */
int insert_log_record(uint64_t index, unsigned int term, int insert_log_record(uint64_t index, unsigned int term,
std::ostringstream& sql, time_t timestamp, uint64_t fed_index, const std::ostringstream& sql, time_t timestamp, uint64_t fed_index,
bool replace); bool replace);
/** /**
@ -146,7 +146,7 @@ public:
* @param raft attributes in XML format * @param raft attributes in XML format
* @return 0 on success * @return 0 on success
*/ */
int update_raft_state(const std::string& name, std::string& raft_xml); int update_raft_state(const std::string& name, const std::string& raft_xml);
/** /**
* Returns the raft state attributes as stored in the log * Returns the raft state attributes as stored in the log
@ -169,12 +169,12 @@ public:
* This function replicates the DB changes on followers before updating * This function replicates the DB changes on followers before updating
* the DB state * the DB state
*/ */
int exec_wr(std::ostringstream& cmd) int exec_wr(std::ostringstream& cmd) override
{ {
return _exec_wr(cmd, UINT64_MAX); return _exec_wr(cmd, UINT64_MAX);
} }
int exec_wr(std::ostringstream& cmd, Callbackable* obj) int exec_wr(std::ostringstream& cmd, Callbackable* obj) override
{ {
return exec_wr(cmd); return exec_wr(cmd);
} }
@ -189,32 +189,32 @@ public:
return _exec_wr(cmd, index); return _exec_wr(cmd, index);
} }
int exec_local_wr(std::ostringstream& cmd) int exec_local_wr(std::ostringstream& cmd) override
{ {
return db->exec_local_wr(cmd); return db->exec_local_wr(cmd);
} }
int exec_rd(std::ostringstream& cmd, Callbackable* obj) int exec_rd(std::ostringstream& cmd, Callbackable* obj) override
{ {
return db->exec_rd(cmd, obj); return db->exec_rd(cmd, obj);
} }
char * escape_str(const std::string& str) const char * escape_str(const std::string& str) const override
{ {
return db->escape_str(str); return db->escape_str(str);
} }
void free_str(char * str) const void free_str(char * str) const override
{ {
db->free_str(str); db->free_str(str);
} }
bool supports(SqlDB::SqlFeature ft) const bool supports(SqlDB::SqlFeature ft) const override
{ {
return db->supports(ft); return db->supports(ft);
} }
std::string limit_string(int start_id, int end_id) const std::string limit_string(int start_id, int end_id) const override
{ {
return db->limit_string(start_id, end_id); return db->limit_string(start_id, end_id);
} }
@ -264,13 +264,13 @@ public:
* *
* @return pointer to the non-federated logDB * @return pointer to the non-federated logDB
*/ */
virtual SqlDB * get_local_db() SqlDB * get_local_db() override
{ {
return this; return this;
} }
protected: protected:
int exec_ext(std::ostringstream& cmd, Callbackable *obj, bool quiet) int exec_ext(std::ostringstream& cmd, Callbackable *obj, bool quiet) override
{ {
return SqlDB::INTERNAL; return SqlDB::INTERNAL;
}; };
@ -382,7 +382,7 @@ private:
* *
* @return -1 on failure, index of the inserted record on success * @return -1 on failure, index of the inserted record on success
*/ */
uint64_t insert_log_record(unsigned int term, std::ostringstream& sql, 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);
}; };
@ -397,29 +397,29 @@ public:
virtual ~FedLogDB(){}; virtual ~FedLogDB(){};
int exec_wr(std::ostringstream& cmd); int exec_wr(std::ostringstream& cmd) override;
int exec_local_wr(std::ostringstream& cmd) int exec_local_wr(std::ostringstream& cmd) override
{ {
return _logdb->exec_local_wr(cmd); return _logdb->exec_local_wr(cmd);
} }
int exec_rd(std::ostringstream& cmd, Callbackable* obj) int exec_rd(std::ostringstream& cmd, Callbackable* obj) override
{ {
return _logdb->exec_rd(cmd, obj); return _logdb->exec_rd(cmd, obj);
} }
char * escape_str(const std::string& str) const char * escape_str(const std::string& str) const override
{ {
return _logdb->escape_str(str); return _logdb->escape_str(str);
} }
void free_str(char * str) const void free_str(char * str) const override
{ {
_logdb->free_str(str); _logdb->free_str(str);
} }
bool supports(SqlDB::SqlFeature ft) const bool supports(SqlDB::SqlFeature ft) const override
{ {
return _logdb->supports(ft); return _logdb->supports(ft);
} }
@ -431,13 +431,13 @@ public:
* *
* @return pointer to the non-federated logDB * @return pointer to the non-federated logDB
*/ */
virtual SqlDB * get_local_db() SqlDB * get_local_db() override
{ {
return _logdb->get_local_db(); return _logdb->get_local_db();
} }
protected: protected:
int exec_ext(std::ostringstream& cmd, Callbackable *obj, bool quiet) int exec_ext(std::ostringstream& cmd, Callbackable *obj, bool quiet) override
{ {
return SqlDB::INTERNAL; return SqlDB::INTERNAL;
}; };

View File

@ -67,7 +67,7 @@ public:
* @param error_msg Error reason, if any * @param error_msg Error reason, if any
* @return 0 on success, -1 DB error * @return 0 on success, -1 DB error
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Imports an app into the marketplace, as reported by the monitor driver * Imports an app into the marketplace, as reported by the monitor driver
@ -154,7 +154,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "MARKETPLACEAPP_POOL", "body", return PoolSQL::dump(oss, "MARKETPLACEAPP_POOL", "body",
one_db::mp_app_table, where, sid, eid, desc); one_db::mp_app_table, where, sid, eid, desc);
@ -164,13 +164,13 @@ public:
* @param zone pointer to Zone * @param zone pointer to Zone
* @return 0 on success * @return 0 on success
*/ */
int update(PoolObjectSQL * objsql); int update(PoolObjectSQL * objsql) override;
/** /**
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new MarketPlaceApp(-1,-1,"","", 0, 0); return new MarketPlaceApp(-1,-1,"","", 0, 0);
}; };

View File

@ -86,7 +86,7 @@ public:
* @param objsql points to the market * @param objsql points to the market
* @return 0 on success * @return 0 on success
*/ */
int update(PoolObjectSQL * objsql); int update(PoolObjectSQL * objsql) override;
/** /**
* Drops the MarketPlace data in the data base. The object mutex SHOULD be * Drops the MarketPlace data in the data base. The object mutex SHOULD be
@ -95,7 +95,7 @@ public:
* @param error_msg Error reason, if any * @param error_msg Error reason, if any
* @return 0 on success, -1 DB error -3 MarketPlace's App ID set not empty * @return 0 on success, -1 DB error -3 MarketPlace's App ID set not empty
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Bootstraps the database table(s) associated to the MarketPlace pool * Bootstraps the database table(s) associated to the MarketPlace pool
@ -118,7 +118,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "MARKETPLACE_POOL", "body", one_db::mp_table, return PoolSQL::dump(oss, "MARKETPLACE_POOL", "body", one_db::mp_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -139,7 +139,7 @@ public:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new MarketPlace(-1,-1,"","", 0, 0); return new MarketPlace(-1,-1,"","", 0, 0);
}; };

View File

@ -49,7 +49,7 @@ public:
const std::string& _database, const std::string& _database,
const std::string& _encoding, const std::string& _encoding,
int _connections, int _connections,
std::string& _compare_binary); const std::string& _compare_binary);
~MySqlDB(); ~MySqlDB();
@ -60,13 +60,13 @@ public:
* @param str the string to be escaped * @param str the string to be escaped
* @return a valid SQL string or NULL in case of failure * @return a valid SQL string or NULL in case of failure
*/ */
char * escape_str(const std::string& str) const; char * escape_str(const std::string& str) const override;
/** /**
* Frees a previously scaped string * Frees a previously scaped string
* @param str pointer to the str * @param str pointer to the str
*/ */
void free_str(char * str) const void free_str(char * str) const override
{ {
delete[] str; delete[] str;
} }

View File

@ -265,13 +265,15 @@ public:
* Frees a vector of XMLNodes, as returned by the get_nodes function * Frees a vector of XMLNodes, as returned by the get_nodes function
* @param content the vector of xmlNodePtr * @param content the vector of xmlNodePtr
*/ */
void free_nodes(std::vector<xmlNodePtr>& content) const static void free_nodes(std::vector<xmlNodePtr>& content)
{ {
for (auto it : content) for (auto it : content)
{ {
xmlFreeNode(it); xmlFreeNode(it);
} }
};
content.clear();
}
/** /**
* Updates the object representation with a new XML document. Previous * Updates the object representation with a new XML document. Previous

View File

@ -48,7 +48,7 @@ public:
/** /**
* Parse and loads the configuration in the template * Parse and loads the configuration in the template
*/ */
virtual int load_configuration(); int load_configuration() override;
/** /**
* Returns action set from a string of actions seperated by commas * Returns action set from a string of actions seperated by commas
@ -84,12 +84,12 @@ private:
/** /**
* Sets the defaults value for the template * Sets the defaults value for the template
*/ */
void set_conf_default(); void set_conf_default() override;
/** /**
* Sets the defaults value for multiple attributes * Sets the defaults value for multiple attributes
*/ */
void set_multiple_conf_default(); void set_multiple_conf_default() override;
/** /**
* register the multiple configuration attributes and clean the * register the multiple configuration attributes and clean the

View File

@ -88,32 +88,32 @@ protected:
*/ */
class QuotaDecorator : public QuotaInterface class QuotaDecorator : public QuotaInterface
{ {
virtual bool check(Template* tmpl, Quotas& default_quotas, std::string& error) bool check(Template* tmpl, Quotas& default_quotas, std::string& error) override
{ {
return quota->check(tmpl, default_quotas, error); return quota->check(tmpl, default_quotas, error);
} }
virtual void del(Template* tmpl) void del(Template* tmpl) override
{ {
return quota->del(tmpl); return quota->del(tmpl);
} }
virtual int set(std::vector<VectorAttribute*> * quotas, std::string& error) int set(std::vector<VectorAttribute*> * quotas, std::string& error) override
{ {
return quota->set(quotas, error); return quota->set(quotas, error);
} }
virtual bool update(Template * tmpl, Quotas& default_quotas, std::string& error) bool update(Template * tmpl, Quotas& default_quotas, std::string& error) override
{ {
return quota->update(tmpl, default_quotas, error); return quota->update(tmpl, default_quotas, error);
} }
virtual const char * get_quota_name() const const char * get_quota_name() const override
{ {
return quota->get_quota_name(); return quota->get_quota_name();
} }
virtual int get_quota(const std::string& id, VectorAttribute **va) int get_quota(const std::string& id, VectorAttribute **va) override
{ {
return quota->get_quota(id, va); return quota->get_quota(id, va);
} }
@ -142,7 +142,7 @@ public:
* *
* @return 0 on success -1 otherwise * @return 0 on success -1 otherwise
*/ */
int set(std::vector<VectorAttribute*> * quotas, std::string& error); int set(std::vector<VectorAttribute*> * quotas, std::string& error) override;
/** /**
* Check if a resource update in usage counters will exceed the * Check if a resource update in usage counters will exceed the
@ -152,7 +152,7 @@ public:
* @param error string * @param error string
* @return true if the operation can be performed * @return true if the operation can be performed
*/ */
virtual bool update(Template * tmpl, Quotas& default_quotas, std::string& error) bool update(Template * tmpl, Quotas& default_quotas, std::string& error) override
{ {
error = "Update operation for quotas not supported."; error = "Update operation for quotas not supported.";
return false; return false;
@ -161,7 +161,7 @@ public:
/** /**
* Returns the name that identifies the quota in a template * Returns the name that identifies the quota in a template
*/ */
const char * get_quota_name() const const char * get_quota_name() const override
{ {
return template_name; return template_name;
} }
@ -172,7 +172,7 @@ public:
* @param va The quota, if it is found * @param va The quota, if it is found
* @return 0 on success, -1 if not found * @return 0 on success, -1 if not found
*/ */
virtual int get_quota(const std::string& id, VectorAttribute **va) int get_quota(const std::string& id, VectorAttribute **va) override
{ {
std::map<std::string, Attribute *>::iterator it; std::map<std::string, Attribute *>::iterator it;
return get_quota(id, va, it); return get_quota(id, va, it);

View File

@ -54,13 +54,13 @@ public:
* @param error string * @param error string
* @return true if the operation can be performed * @return true if the operation can be performed
*/ */
bool check(Template* tmpl, Quotas& default_quotas, std::string& error); bool check(Template* tmpl, Quotas& default_quotas, std::string& error) override;
/** /**
* Decrement usage counters when deallocating image * Decrement usage counters when deallocating image
* @param tmpl template for the resource * @param tmpl template for the resource
*/ */
void del(Template* tmpl); void del(Template* tmpl) override;
protected: protected:
@ -75,7 +75,7 @@ protected:
*/ */
int get_default_quota(const std::string& id, int get_default_quota(const std::string& id,
Quotas& default_quotas, Quotas& default_quotas,
VectorAttribute **va); VectorAttribute **va) override;
static const char * DS_METRICS[]; static const char * DS_METRICS[];

View File

@ -52,13 +52,13 @@ public:
* @param error string * @param error string
* @return true if the operation can be performed * @return true if the operation can be performed
*/ */
bool check(Template* tmpl, Quotas& default_quotas, std::string& error); bool check(Template* tmpl, Quotas& default_quotas, std::string& error) override;
/** /**
* Decrement usage counters when deallocating image * Decrement usage counters when deallocating image
* @param tmpl template for the resource * @param tmpl template for the resource
*/ */
void del(Template* tmpl); void del(Template* tmpl) override;
protected: protected:
@ -73,7 +73,7 @@ protected:
*/ */
int get_default_quota(const std::string& id, int get_default_quota(const std::string& id,
Quotas& default_quotas, Quotas& default_quotas,
VectorAttribute **va); VectorAttribute **va) override;
static const char * IMAGE_METRICS[]; static const char * IMAGE_METRICS[];

View File

@ -46,7 +46,7 @@ public:
* @param error string * @param error string
* @return true if the operation can be performed * @return true if the operation can be performed
*/ */
bool check(Template* tmpl, Quotas& default_quotas, std::string& err) bool check(Template* tmpl, Quotas& default_quotas, std::string& err) override
{ {
return check(PoolObjectSQL::VM, tmpl, default_quotas, err); return check(PoolObjectSQL::VM, tmpl, default_quotas, err);
} }
@ -56,7 +56,7 @@ public:
* the object type to accounto for FLOATING IP addresses or not * the object type to accounto for FLOATING IP addresses or not
* @param tmpl template for the resource * @param tmpl template for the resource
*/ */
void del(Template* tmpl) void del(Template* tmpl) override
{ {
del(PoolObjectSQL::VM, tmpl); del(PoolObjectSQL::VM, tmpl);
} }
@ -73,7 +73,7 @@ protected:
*/ */
int get_default_quota(const std::string& id, int get_default_quota(const std::string& id,
Quotas& default_quotas, Quotas& default_quotas,
VectorAttribute **va); VectorAttribute **va) override;
static const char * NET_METRICS[]; static const char * NET_METRICS[];
@ -120,14 +120,14 @@ public:
virtual ~QuotaNetworkVirtualRouter(){}; virtual ~QuotaNetworkVirtualRouter(){};
bool check(Template* tmpl, Quotas& default_quotas, std::string& err) bool check(Template* tmpl, Quotas& default_quotas, std::string& err) override
{ {
QuotaNetwork * qn = static_cast<QuotaNetwork *>(quota); QuotaNetwork * qn = static_cast<QuotaNetwork *>(quota);
return qn->check(PoolObjectSQL::VROUTER, tmpl, default_quotas, err); return qn->check(PoolObjectSQL::VROUTER, tmpl, default_quotas, err);
} }
void del(Template* tmpl) void del(Template* tmpl) override
{ {
QuotaNetwork * qn = static_cast<QuotaNetwork *>(quota); QuotaNetwork * qn = static_cast<QuotaNetwork *>(quota);

View File

@ -63,7 +63,7 @@ public:
* @param error string * @param error string
* @return true if the operation can be performed * @return true if the operation can be performed
*/ */
bool check(Template* tmpl, Quotas& default_quotas, std::string& error); bool check(Template* tmpl, Quotas& default_quotas, std::string& error) override;
/** /**
* Check if the resource update (change in MEMORY or CPU) will exceed the * Check if the resource update (change in MEMORY or CPU) will exceed the
@ -73,13 +73,13 @@ public:
* @param error string * @param error string
* @return true if the operation can be performed * @return true if the operation can be performed
*/ */
bool update(Template * tmpl, Quotas& default_quotas, std::string& error); bool update(Template * tmpl, Quotas& default_quotas, std::string& error) override;
/** /**
* Decrement usage counters when deallocating image * Decrement usage counters when deallocating image
* @param tmpl template for the resource * @param tmpl template for the resource
*/ */
void del(Template* tmpl); void del(Template* tmpl) override;
/** /**
* Gets a quota, overrides base to not to use ID. * Gets a quota, overrides base to not to use ID.
@ -88,7 +88,7 @@ public:
* *
* @return a pointer to the quota or 0 if not found * @return a pointer to the quota or 0 if not found
*/ */
int get_quota(const std::string& id, VectorAttribute **va); int get_quota(const std::string& id, VectorAttribute **va) override;
protected: protected:
@ -104,7 +104,7 @@ protected:
int get_quota( int get_quota(
const std::string& id, const std::string& id,
VectorAttribute **va, VectorAttribute **va,
std::map<std::string, Attribute *>::iterator& it) std::map<std::string, Attribute *>::iterator& it) override
{ {
it = attributes.begin(); it = attributes.begin();
return get_quota(id, va); return get_quota(id, va);
@ -122,7 +122,7 @@ protected:
int get_default_quota( int get_default_quota(
const std::string& id, const std::string& id,
Quotas& default_quotas, Quotas& default_quotas,
VectorAttribute **va); VectorAttribute **va) override;
static const char * VM_METRICS[]; static const char * VM_METRICS[];

View File

@ -63,7 +63,7 @@ public:
* @param db pointer to the db * @param db pointer to the db
* @return 0 on success * @return 0 on success
*/ */
int drop(SqlDB * db); int drop(SqlDB * db) override;
protected: protected:
@ -96,14 +96,14 @@ private:
* @param db pointer to the db * @param db pointer to the db
* @return 0 on success * @return 0 on success
*/ */
int select(SqlDB * db); int select(SqlDB * db) override;
/** /**
* Writes the Quotas in the database. * Writes the Quotas in the database.
* @param db pointer to the db * @param db pointer to the db
* @return 0 on success * @return 0 on success
*/ */
int insert(SqlDB *db, std::string& error_str) int insert(SqlDB *db, std::string& error_str) override
{ {
return insert_replace(db, false, error_str); return insert_replace(db, false, error_str);
}; };
@ -113,7 +113,7 @@ private:
* @param db pointer to the db * @param db pointer to the db
* @return 0 on success * @return 0 on success
*/ */
int update(SqlDB *db) int update(SqlDB *db) override
{ {
std::string error_str; std::string error_str;
return insert_replace(db, true, error_str); return insert_replace(db, true, error_str);
@ -173,17 +173,17 @@ public:
protected: protected:
const char * table() const const char * table() const override
{ {
return one_db::group_quotas_db_table; return one_db::group_quotas_db_table;
}; };
const char * table_names() const const char * table_names() const override
{ {
return one_db::group_quotas_db_names; return one_db::group_quotas_db_names;
}; };
const char * table_oid_column() const const char * table_oid_column() const override
{ {
return one_db::group_quotas_db_oid_column; return one_db::group_quotas_db_oid_column;
}; };
@ -219,17 +219,17 @@ public:
protected: protected:
const char * table() const const char * table() const override
{ {
return one_db::user_quotas_db_table; return one_db::user_quotas_db_table;
}; };
const char * table_names() const const char * table_names() const override
{ {
return one_db::user_quotas_db_names; return one_db::user_quotas_db_names;
}; };
const char * table_oid_column() const const char * table_oid_column() const override
{ {
return one_db::user_quotas_db_oid_column; return one_db::user_quotas_db_oid_column;
}; };

View File

@ -38,7 +38,7 @@ public:
delete rp_vm; delete rp_vm;
}; };
void register_policies(const SchedulerTemplate& conf) void register_policies(const SchedulerTemplate& conf) override
{ {
rp_host = new RankHostPolicy(hpool, conf.get_policy(), 1.0); rp_host = new RankHostPolicy(hpool, conf.get_policy(), 1.0);

View File

@ -101,7 +101,7 @@ public:
virtual ~RaftReplicaManager(){}; virtual ~RaftReplicaManager(){};
private: private:
ReplicaThread * thread_factory(int follower_id); ReplicaThread * thread_factory(int follower_id) override;
}; };
class HeartBeatManager : public ReplicaManager class HeartBeatManager : public ReplicaManager
@ -112,7 +112,7 @@ public:
virtual ~HeartBeatManager(){}; virtual ~HeartBeatManager(){};
private: private:
ReplicaThread * thread_factory(int follower_id); ReplicaThread * thread_factory(int follower_id) override;
}; };
#endif /*REPLICA_MANAGER_H_*/ #endif /*REPLICA_MANAGER_H_*/

View File

@ -106,7 +106,7 @@ private:
/** /**
* Specific logic for the replicate process * Specific logic for the replicate process
*/ */
int replicate(); int replicate() override;
/** /**
* Pointers to other components * Pointers to other components
@ -133,7 +133,7 @@ private:
/** /**
* Specific logic for the replicate process * Specific logic for the replicate process
*/ */
int replicate(); int replicate() override;
/** /**
* Pointers to other components * Pointers to other components
@ -162,7 +162,7 @@ private:
/** /**
* Specific logic for the replicate process * Specific logic for the replicate process
*/ */
int replicate(); int replicate() override;
/** /**
* Pointers to other components * Pointers to other components

View File

@ -455,7 +455,7 @@ protected:
* @return true if the user is authorized. * @return true if the user is authorized.
*/ */
static bool quota_authorization(Template * tmpl, Quotas::QuotaType qtype, static bool quota_authorization(Template * tmpl, Quotas::QuotaType qtype,
RequestAttributes& att, std::string& error_str); const RequestAttributes& att, std::string& error_str);
/** /**
* Performs rollback on usage counters for a previous quota check operation * Performs rollback on usage counters for a previous quota check operation
@ -464,7 +464,7 @@ protected:
* @param att the specific request attributes * @param att the specific request attributes
*/ */
static void quota_rollback(Template * tmpl, Quotas::QuotaType qtype, static void quota_rollback(Template * tmpl, Quotas::QuotaType qtype,
RequestAttributes& att); const RequestAttributes& att);
/** /**
* @param tmpl describing the object * @param tmpl describing the object
@ -477,16 +477,16 @@ private:
/* Functions to manage user and group quotas */ /* Functions to manage user and group quotas */
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static bool user_quota_authorization(Template * tmpl, Quotas::QuotaType qtype, static bool user_quota_authorization(Template * tmpl, Quotas::QuotaType qtype,
RequestAttributes& att, std::string& error_str); const RequestAttributes& att, std::string& error_str);
static bool group_quota_authorization(Template * tmpl, Quotas::QuotaType qtype, static bool group_quota_authorization(Template * tmpl, Quotas::QuotaType qtype,
RequestAttributes& att, std::string& error_str); const RequestAttributes& att, std::string& error_str);
static void user_quota_rollback(Template * tmpl, Quotas::QuotaType qtype, static void user_quota_rollback(Template * tmpl, Quotas::QuotaType qtype,
RequestAttributes& att); const RequestAttributes& att);
static void group_quota_rollback(Template * tmpl, Quotas::QuotaType qtype, static void group_quota_rollback(Template * tmpl, Quotas::QuotaType qtype,
RequestAttributes& att); const RequestAttributes& att);
/** /**
* Builds an XML-RPC response updating retval. After calling this function * Builds an XML-RPC response updating retval. After calling this function

View File

@ -43,11 +43,6 @@ protected:
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
/* -------------------------------------------------------------------- */
AclManager * aclm; AclManager * aclm;
}; };

View File

@ -588,7 +588,7 @@ public:
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& paramList, Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& paramList,
std::unique_ptr<Template> tmpl, std::unique_ptr<Template> tmpl,
int& id, int& id,
RequestAttributes& att); RequestAttributes& att) override;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -781,7 +781,7 @@ public:
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
std::unique_ptr<Template> get_object_template() const std::unique_ptr<Template> get_object_template() const override
{ {
return std::make_unique<Template>(); return std::make_unique<Template>();
}; };
@ -789,7 +789,7 @@ public:
Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList, Request::ErrorCode pool_allocate(xmlrpc_c::paramList const& _paramList,
std::unique_ptr<Template> tmpl, std::unique_ptr<Template> tmpl,
int& id, int& id,
RequestAttributes& att); RequestAttributes& att) override;
}; };

View File

@ -103,7 +103,7 @@ protected:
ErrorCode chmod(PoolSQL * pool, int oid, int owner_u, int owner_m, 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 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 other_m, int other_a, bool recursive, RequestAttributes& att) override;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -54,9 +54,6 @@ protected:
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& paramList,
RequestAttributes& att) = 0;
void add_generic( void add_generic(
int cluster_id, int cluster_id,
int object_id, int object_id,

View File

@ -39,12 +39,8 @@ protected:
auth_object = PoolObjectSQL::DATASTORE; auth_object = PoolObjectSQL::DATASTORE;
auth_op = AuthRequest::MANAGE; auth_op = AuthRequest::MANAGE;
}; };
~RequestManagerDatastore() = default; ~RequestManagerDatastore() = default;
/* --------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -39,9 +39,6 @@ protected:
}; };
~RequestManagerGroup(){}; ~RequestManagerGroup(){};
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -40,11 +40,6 @@ protected:
}; };
~RequestManagerHook() = default; ~RequestManagerHook() = default;
/* -------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -62,8 +57,7 @@ public:
~HookRetry() = default; ~HookRetry() = default;
void request_execute(xmlrpc_c::paramList const& _paramList, void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att); RequestAttributes& att) override;
}; };
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */

View File

@ -40,11 +40,6 @@ protected:
}; };
~RequestManagerHost(){}; ~RequestManagerHost(){};
/* -------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -41,11 +41,6 @@ protected:
}; };
~RequestManagerImage(){}; ~RequestManagerImage(){};
/* --------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -439,7 +439,7 @@ public:
protected: protected:
void to_xml(RequestAttributes& att, PoolObjectSQL * object, void to_xml(RequestAttributes& att, PoolObjectSQL * object,
std::string& str) std::string& str) override
{ {
(static_cast<Hook *>(object))->to_xml_extended(str); (static_cast<Hook *>(object))->to_xml_extended(str);
}; };

View File

@ -29,11 +29,6 @@ protected:
const std::string& help, const std::string& params); const std::string& help, const std::string& params);
~RequestManagerMarketPlaceApp() = default; ~RequestManagerMarketPlaceApp() = default;
/* --------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -515,7 +515,7 @@ public:
~HookRename() = default; ~HookRename() = default;
int exist(const std::string& name, int uid) int exist(const std::string& name, int uid) override
{ {
return pool->exist(name, uid); return pool->exist(name, uid);
} }

View File

@ -36,11 +36,6 @@ protected:
}; };
~RequestManagerSystem(){}; ~RequestManagerSystem(){};
/* -------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -157,7 +157,6 @@ public:
if ( ec == SUCCESS ) if ( ec == SUCCESS )
{ {
std::vector<int> zids;
success_response(oid, att); success_response(oid, att);
} }
else else

View File

@ -40,11 +40,6 @@ protected:
}; };
~RequestManagerVMTemplate(){}; ~RequestManagerVMTemplate(){};
/* -------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -31,9 +31,6 @@ protected:
const std::string& params); const std::string& params);
~RequestManagerVNTemplate() = default; ~RequestManagerVNTemplate() = default;
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -34,7 +34,7 @@ class VdcEditGroup : public Request
{ {
public: public:
void request_execute(xmlrpc_c::paramList const& _paramList, void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att); RequestAttributes& att) override;
protected: protected:
VdcEditGroup(const std::string& method_name, VdcEditGroup(const std::string& method_name,
@ -99,7 +99,7 @@ class VdcEditResource : public Request
{ {
public: public:
void request_execute(xmlrpc_c::paramList const& _paramList, void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att); RequestAttributes& att) override;
protected: protected:
VdcEditResource(const std::string& method_name, VdcEditResource(const std::string& method_name,

View File

@ -44,9 +44,6 @@ protected:
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
// Authorize the request, set failure_response message // Authorize the request, set failure_response message
bool vm_authorization(int id, bool vm_authorization(int id,
ImageTemplate * tmpl, ImageTemplate * tmpl,

View File

@ -31,9 +31,6 @@ protected:
const std::string& params); const std::string& params);
~RequestManagerVirtualRouter() = default; ~RequestManagerVirtualRouter() = default;
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -41,11 +41,6 @@ protected:
}; };
~RequestManagerZone(){}; ~RequestManagerZone(){};
/* -------------------------------------------------------------------- */
virtual void request_execute(xmlrpc_c::paramList const& _paramList,
RequestAttributes& att) = 0;
}; };
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */

View File

@ -112,7 +112,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "SECURITY_GROUP_POOL", "body", one_db::sg_table, return PoolSQL::dump(oss, "SECURITY_GROUP_POOL", "body", one_db::sg_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -126,7 +126,7 @@ public:
* @param sgs security group ID set * @param sgs security group ID set
* @param rules Security Group rules will be added at the end of this vector * @param rules Security Group rules will be added at the end of this vector
*/ */
void get_security_group_rules(int vmid, std::set<int>& sgs, void get_security_group_rules(int vmid, const std::set<int>& sgs,
std::vector<VectorAttribute*> &rules) std::vector<VectorAttribute*> &rules)
{ {
for (auto sg : sgs) for (auto sg : sgs)
@ -153,7 +153,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new SecurityGroup(-1,-1,"","",0,0); return new SecurityGroup(-1,-1,"","",0,0);
}; };

View File

@ -80,7 +80,7 @@ public:
line_sz += rc; line_sz += rc;
const char * eom = strchr(cur_ptr, '\n'); eom = strchr(cur_ptr, '\n');
if ( eom == 0) if ( eom == 0)
{ {

View File

@ -672,7 +672,7 @@ private:
} }
template<typename T> template<typename T>
void _set(std::vector<T *>& values) void _set(const std::vector<T *>& values)
{ {
for (auto v : values) for (auto v : values)
{ {

View File

@ -79,8 +79,8 @@ public:
int prolog_transfer_command( int prolog_transfer_command(
VirtualMachine * vm, VirtualMachine * vm,
const VirtualMachineDisk* disk, const VirtualMachineDisk* disk,
std::string& system_tm_mad, const std::string& system_tm_mad,
std::string& opennebula_hostname, const std::string& opennebula_hostname,
std::ostream& xfr, std::ostream& xfr,
std::ostringstream& error); std::ostringstream& error);
@ -98,7 +98,7 @@ public:
int prolog_context_command( int prolog_context_command(
VirtualMachine * vm, VirtualMachine * vm,
const std::string& token_password, const std::string& token_password,
std::string& system_tm_mad, const std::string& system_tm_mad,
int& disk_id, int& disk_id,
std::ostream& xfr); std::ostream& xfr);
@ -214,7 +214,7 @@ private:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
static const int drivers_timeout = 10; static const int drivers_timeout = 10;
void finalize_action() void finalize_action() override
{ {
DriverManager::stop(drivers_timeout); DriverManager::stop(drivers_timeout);
}; };

View File

@ -40,8 +40,8 @@ class UserPool : public PoolSQL
public: public:
UserPool(SqlDB * db, time_t __session_expiration_time, bool is_slave, UserPool(SqlDB * db, time_t __session_expiration_time, bool is_slave,
std::vector<const SingleAttribute *>& restricted_attrs, const std::vector<const SingleAttribute *>& restricted_attrs,
std::vector<const SingleAttribute *>& encrypted_attrs); const std::vector<const SingleAttribute *>& encrypted_attrs);
~UserPool() = default; ~UserPool() = default;
@ -68,7 +68,7 @@ public:
* @param error_msg Error reason, if any * @param error_msg Error reason, if any
* @return 0 on success, -1 DB error * @return 0 on success, -1 DB error
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Gets an object from the pool (if needed the object is loaded from the * Gets an object from the pool (if needed the object is loaded from the
@ -160,7 +160,7 @@ public:
* @param user pointer to User * @param user pointer to User
* @return 0 on success * @return 0 on success
*/ */
int update(PoolObjectSQL * objsql); int update(PoolObjectSQL * objsql) override;
/** /**
* Update a particular User's Quotas * Update a particular User's Quotas
@ -218,7 +218,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int dump(std::string& oss, const std::string& where,
int sid, int eid, bool desc); int sid, int eid, bool desc) override;
/** /**
* Name for the OpenNebula core authentication process * Name for the OpenNebula core authentication process
@ -316,7 +316,7 @@ private:
* Factory method to produce User objects * Factory method to produce User objects
* @return a pointer to the new User * @return a pointer to the new User
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new User(-1,-1,"","","",UserPool::CORE_AUTH,true); return new User(-1,-1,"","","",UserPool::CORE_AUTH,true);
}; };

View File

@ -42,7 +42,7 @@ public:
return Template::check_restricted(rs_attr, restricted); return Template::check_restricted(rs_attr, restricted);
} }
static void parse_restricted(std::vector<const SingleAttribute *>& ra) static void parse_restricted(const std::vector<const SingleAttribute *>& ra)
{ {
Template::parse_restricted(ra, restricted); Template::parse_restricted(ra, restricted);
} }
@ -50,17 +50,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Encrypted attributes interface implementation // Encrypted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual void encrypt(const std::string& one_key) void encrypt(const std::string& one_key) override
{ {
Template::encrypt(one_key, encrypted); Template::encrypt(one_key, encrypted);
} }
virtual void decrypt(const std::string& one_key) void decrypt(const std::string& one_key) override
{ {
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
Template::parse_encrypted(ea, encrypted); Template::parse_encrypted(ea, encrypted);
} }

View File

@ -108,7 +108,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VM_GROUP_POOL", "body", return PoolSQL::dump(oss, "VM_GROUP_POOL", "body",
one_db::vm_group_table, where, sid, eid, desc); one_db::vm_group_table, where, sid, eid, desc);
@ -146,7 +146,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new VMGroup(-1,-1,"","",0,0); return new VMGroup(-1,-1,"","",0,0);
}; };

View File

@ -90,7 +90,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VMTEMPLATE_POOL", "body", return PoolSQL::dump(oss, "VMTEMPLATE_POOL", "body",
one_db::vm_template_table, where, sid, eid, desc); one_db::vm_template_table, where, sid, eid, desc);
@ -110,7 +110,7 @@ private:
* Factory method to produce Image objects * Factory method to produce Image objects
* @return a pointer to the new Image * @return a pointer to the new Image
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new VMTemplate(-1,-1,-1,"","",0,0); return new VMTemplate(-1,-1,-1,"","",0,0);
}; };

View File

@ -90,7 +90,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VNTEMPLATE_POOL", "body", return PoolSQL::dump(oss, "VNTEMPLATE_POOL", "body",
one_db::vn_template_table, where, sid, eid, desc); one_db::vn_template_table, where, sid, eid, desc);
@ -110,7 +110,7 @@ private:
* Factory method to produce VNTemplate objects * Factory method to produce VNTemplate objects
* @return a pointer to the new VNTemplate * @return a pointer to the new VNTemplate
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new VNTemplate(-1,-1,-1,"","",0,0); return new VNTemplate(-1,-1,-1,"","",0,0);
}; };

View File

@ -63,7 +63,7 @@ public:
* @param vdc pointer to Vdc * @param vdc pointer to Vdc
* @return 0 on success * @return 0 on success
*/ */
int update(PoolObjectSQL * objsql); int update(PoolObjectSQL * objsql) override;
/** /**
* Drops the Vdc from the data base. The object mutex SHOULD be * Drops the Vdc from the data base. The object mutex SHOULD be
@ -74,7 +74,7 @@ public:
* -1 DB error, * -1 DB error,
* -2 object is a default Vdc (ID < 100) * -2 object is a default Vdc (ID < 100)
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Bootstraps the database table(s) associated to the Vdc pool * Bootstraps the database table(s) associated to the Vdc pool
@ -97,7 +97,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VDC_POOL", "body", one_db::vdc_table, return PoolSQL::dump(oss, "VDC_POOL", "body", one_db::vdc_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -130,7 +130,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Vdc(-1,0); return new Vdc(-1,0);
}; };

View File

@ -987,7 +987,7 @@ public:
* @param message Message string * @param message Message string
*/ */
void set_template_error_message(const std::string& name, void set_template_error_message(const std::string& name,
const std::string& message); const std::string& message) override;
/** /**
* Deletes the error message from the template * Deletes the error message from the template

View File

@ -126,15 +126,6 @@ protected:
* @return the attribute for which the flag was cleared, 0 if none * @return the attribute for which the flag was cleared, 0 if none
*/ */
VirtualMachineAttribute * clear_flag(const std::string& flag_name); VirtualMachineAttribute * clear_flag(const std::string& flag_name);
/* ---------------------------------------------------------------------- */
/* Attribute map interface */
/* ---------------------------------------------------------------------- */
/**
* Abstract method to create the VirtualMachineAttributes for this set
*/
virtual ExtendedAttribute * attribute_factory(VectorAttribute * va,
int id) const = 0;
}; };
#endif /*VIRTUAL_MACHINE_ATTRIBUTE_H_*/ #endif /*VIRTUAL_MACHINE_ATTRIBUTE_H_*/

View File

@ -328,7 +328,7 @@ private:
static const int drivers_timeout = 10; static const int drivers_timeout = 10;
void finalize_action() void finalize_action() override
{ {
DriverManager::stop(drivers_timeout); DriverManager::stop(drivers_timeout);
}; };

View File

@ -31,8 +31,8 @@ class VirtualMachinePool : public PoolSQL
public: public:
VirtualMachinePool(SqlDB * db, VirtualMachinePool(SqlDB * db,
std::vector<const SingleAttribute *>& restricted_attrs, const std::vector<const SingleAttribute *>& restricted_attrs,
std::vector<const SingleAttribute *>& encrypted_attrs, const std::vector<const SingleAttribute *>& encrypted_attrs,
bool on_hold, bool on_hold,
float default_cpu_cost, float default_cpu_cost,
float default_mem_cost, float default_mem_cost,
@ -252,7 +252,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VM_POOL", "short_body", one_db::vm_table, where, return PoolSQL::dump(oss, "VM_POOL", "short_body", one_db::vm_table, where,
sid, eid, desc); sid, eid, desc);
@ -272,7 +272,7 @@ public:
*/ */
int dump_extended(std::string& oss, const std::string& where, int dump_extended(std::string& oss, const std::string& where,
int sid, int eid, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VM_POOL", "body", one_db::vm_table, where, return PoolSQL::dump(oss, "VM_POOL", "body", one_db::vm_table, where,
sid, eid, desc); sid, eid, desc);
@ -415,7 +415,7 @@ private:
* Factory method to produce VM objects * Factory method to produce VM objects
* @return a pointer to the new VM * @return a pointer to the new VM
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new VirtualMachine(-1,-1,-1,"","",0,0); return new VirtualMachine(-1,-1,-1,"","",0,0);
}; };

View File

@ -70,17 +70,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Restricted attributes interface implementation // Restricted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual bool check_restricted(std::string& rs_attr, const Template* base) bool check_restricted(std::string& rs_attr, const Template* base) override
{ {
return Template::check_restricted(rs_attr, base, restricted); return Template::check_restricted(rs_attr, base, restricted);
} }
virtual bool check_restricted(std::string& rs_attr) bool check_restricted(std::string& rs_attr) override
{ {
return Template::check_restricted(rs_attr, restricted); return Template::check_restricted(rs_attr, restricted);
} }
static void parse_restricted(std::vector<const SingleAttribute *>& ra) static void parse_restricted(const std::vector<const SingleAttribute *>& ra)
{ {
Template::parse_restricted(ra, restricted); Template::parse_restricted(ra, restricted);
} }
@ -101,17 +101,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Encrypted attributes interface implementation // Encrypted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual void encrypt(const std::string& one_key) void encrypt(const std::string& one_key) override
{ {
Template::encrypt(one_key, encrypted); Template::encrypt(one_key, encrypted);
} }
virtual void decrypt(const std::string& one_key) void decrypt(const std::string& one_key) override
{ {
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
Template::parse_encrypted(ea, encrypted); Template::parse_encrypted(ea, encrypted);
} }

View File

@ -83,7 +83,7 @@ public:
/** /**
* Drops a Virtual Network and the associated VLAN_ID if needed * Drops a Virtual Network and the associated VLAN_ID if needed
*/ */
int drop(PoolObjectSQL * vn, std::string& error_msg) int drop(PoolObjectSQL * vn, std::string& error_msg) override
{ {
release_vlan_id(static_cast<VirtualNetwork *>(vn)); release_vlan_id(static_cast<VirtualNetwork *>(vn));
@ -168,7 +168,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VNET_POOL", "body", one_db::vn_table, return PoolSQL::dump(oss, "VNET_POOL", "body", one_db::vn_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -394,7 +394,7 @@ private:
* Factory method to produce VN objects * Factory method to produce VN objects
* @return a pointer to the new VN * @return a pointer to the new VN
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
std::set <int> empty; std::set <int> empty;
return new VirtualNetwork(-1,-1,"","",0,-1,empty,0); return new VirtualNetwork(-1,-1,"","",0,-1,empty,0);

View File

@ -39,17 +39,17 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Restricted attributes interface implementation // Restricted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual bool check_restricted(std::string& rs_attr, const Template* base) bool check_restricted(std::string& rs_attr, const Template* base) override
{ {
return Template::check_restricted(rs_attr, base, restricted); return Template::check_restricted(rs_attr, base, restricted);
} }
virtual bool check_restricted(std::string& rs_attr) bool check_restricted(std::string& rs_attr) override
{ {
return Template::check_restricted(rs_attr, restricted); return Template::check_restricted(rs_attr, restricted);
} }
static void parse_restricted(std::vector<const SingleAttribute *>& ra) static void parse_restricted(const std::vector<const SingleAttribute *>& ra)
{ {
Template::parse_restricted(ra, restricted); Template::parse_restricted(ra, restricted);
} }
@ -57,18 +57,18 @@ public:
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Encrypted attributes interface implementation // Encrypted attributes interface implementation
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
virtual void encrypt(const std::string& one_key) void encrypt(const std::string& one_key) override
{ {
Template::encrypt(one_key, encrypted); Template::encrypt(one_key, encrypted);
} }
virtual void decrypt(const std::string& one_key) void decrypt(const std::string& one_key) override
{ {
Template::decrypt(one_key, encrypted); Template::decrypt(one_key, encrypted);
} }
// One-time execution // One-time execution
static void parse_encrypted(std::vector<const SingleAttribute *>& ea) static void parse_encrypted(const std::vector<const SingleAttribute *>& ea)
{ {
auto eas = const_cast<std::map<std::string, std::set<std::string>> *>(&encrypted); auto eas = const_cast<std::map<std::string, std::set<std::string>> *>(&encrypted);

View File

@ -214,7 +214,7 @@ private:
* *
* @return 0 on success, -1 otherwise * @return 0 on success, -1 otherwise
*/ */
int from_xml(const std::string &xml_str); int from_xml(const std::string &xml_str) override;
// ************************************************************************* // *************************************************************************
// Constructor // Constructor

View File

@ -97,7 +97,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "VROUTER_POOL", "body", one_db::vr_table, return PoolSQL::dump(oss, "VROUTER_POOL", "body", one_db::vr_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -128,7 +128,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new VirtualRouter(-1,-1,-1,"","",0,0); return new VirtualRouter(-1,-1,-1,"","",0,0);
}; };

View File

@ -74,7 +74,7 @@ public:
* @param zone pointer to Zone * @param zone pointer to Zone
* @return 0 on success * @return 0 on success
*/ */
int update(PoolObjectSQL * objsql); int update(PoolObjectSQL * objsql) override;
/** /**
* Drops the Zone from the data base. The object mutex SHOULD be * Drops the Zone from the data base. The object mutex SHOULD be
@ -85,7 +85,7 @@ public:
* -1 DB error, * -1 DB error,
* -2 object is a default Zone (ID < 100) * -2 object is a default Zone (ID < 100)
*/ */
int drop(PoolObjectSQL * objsql, std::string& error_msg); int drop(PoolObjectSQL * objsql, std::string& error_msg) override;
/** /**
* Bootstraps the database table(s) associated to the Zone pool * Bootstraps the database table(s) associated to the Zone pool
@ -108,7 +108,7 @@ public:
* @return 0 on success * @return 0 on success
*/ */
int dump(std::string& oss, const std::string& where, int sid, int eid, int dump(std::string& oss, const std::string& where, int sid, int eid,
bool desc) bool desc) override
{ {
return PoolSQL::dump(oss, "ZONE_POOL", "body", one_db::zone_table, return PoolSQL::dump(oss, "ZONE_POOL", "body", one_db::zone_table,
where, sid, eid, desc); where, sid, eid, desc);
@ -143,7 +143,7 @@ private:
* Factory method to produce objects * Factory method to produce objects
* @return a pointer to the new object * @return a pointer to the new object
*/ */
PoolObjectSQL * create() PoolObjectSQL * create() override
{ {
return new Zone(-1,0); return new Zone(-1,0);
}; };

View File

@ -197,7 +197,7 @@ public:
} }
protected: protected:
ExtendedAttribute * attribute_factory(VectorAttribute * va, int id) const ExtendedAttribute * attribute_factory(VectorAttribute * va, int id) const override
{ {
return new ZoneServer(va, id); return new ZoneServer(va, id);
}; };

View File

@ -20,7 +20,31 @@
<id>shadowFunction</id> <id>shadowFunction</id>
<fileName>*</fileName> <fileName>*</fileName>
</suppress> </suppress>
<suppress>
<id>constParameter</id>
<fileName>*</fileName>
</suppress>
<suppress>
<id>constVariable</id>
<fileName>*</fileName>
</suppress>
<suppress>
<id>useStlAlgorithm</id>
<fileName>*</fileName>
</suppress>
<!-- Suppresions specific per file, false positives --> <!-- Suppresions specific per file, false positives -->
<suppress>
<id>knownConditionTrueFalse</id>
<fileName>src/monitor/src/data_model/VMRPCPool.cc</fileName>
</suppress>
<suppress>
<id>nullPointer</id>
<fileName>src/scheduler/include/Scheduler.h</fileName>
</suppress>
<suppress>
<id>uninitMemberVar</id>
<fileName>include/Callbackable.h</fileName>
</suppress>
<suppress> <suppress>
<id>containerOutOfBounds</id> <id>containerOutOfBounds</id>
<fileName>src/hm/HookLog.cc</fileName> <fileName>src/hm/HookLog.cc</fileName>
@ -54,38 +78,9 @@
<id>uninitMemberVar</id> <id>uninitMemberVar</id>
<fileName>include/Callbackable.h</fileName> <fileName>include/Callbackable.h</fileName>
</suppress> </suppress>
<!-- Temporary suppressions, we may want to solve them in the future -->
<suppress>
<id>unusedVariable</id>
<fileName>*</fileName>
</suppress>
<suppress> <suppress>
<id>noConstructor</id> <id>noConstructor</id>
<fileName>*</fileName> <fileName>include/Callbackable.h</fileName>
</suppress>
<suppress>
<id>constVariable</id>
<fileName>*</fileName>
</suppress>
<suppress>
<id>missingOverride</id>
<fileName>*</fileName>
</suppress>
<suppress>
<id>shadowVariable</id>
<fileName>*</fileName>
</suppress>
<suppress>
<id>unreadVariable</id>
<fileName>*</fileName>
</suppress>
<suppress>
<id>constParameter</id>
<fileName>*</fileName>
</suppress>
<suppress>
<id>useStlAlgorithm</id>
<fileName>*</fileName>
</suppress> </suppress>
</suppressions> </suppressions>

View File

@ -41,7 +41,7 @@ const int ClusterPool::DEFAULT_CLUSTER_ID = 0;
ClusterPool::ClusterPool(SqlDB * db, ClusterPool::ClusterPool(SqlDB * db,
const VectorAttribute * _vnc_conf, const VectorAttribute * _vnc_conf,
vector<const SingleAttribute *>& encrypted_attrs): const vector<const SingleAttribute *>& encrypted_attrs):
PoolSQL(db, one_db::cluster_table), vnc_conf(_vnc_conf) PoolSQL(db, one_db::cluster_table), vnc_conf(_vnc_conf)
{ {
ostringstream oss; ostringstream oss;
@ -99,7 +99,6 @@ error_bootstrap:
int ClusterPool::allocate(string name, int * oid, string& error_str) int ClusterPool::allocate(string name, int * oid, string& error_str)
{ {
Cluster * cluster; Cluster * cluster;
string error;
ostringstream oss; ostringstream oss;
@ -364,7 +363,7 @@ int ClusterPool::del_from_cluster(PoolObjectSQL::ObjectType type, Cluster* clust
oss << "DELETE FROM " << table << " WHERE cid = " oss << "DELETE FROM " << table << " WHERE cid = "
<< cluster->get_oid() << " AND oid = " << resource_id; << cluster->get_oid() << " AND oid = " << resource_id;
int rc = db->exec_wr(oss); rc = db->exec_wr(oss);
if (rc != 0) if (rc != 0)
{ {

View File

@ -96,7 +96,6 @@ void Datastore::disk_attribute(
{ {
string st, tm_mad; string st, tm_mad;
string inherit_val; string inherit_val;
string current_val;
disk->replace("DATASTORE", get_name()); disk->replace("DATASTORE", get_name());
disk->replace("DATASTORE_ID", oid); disk->replace("DATASTORE_ID", oid);
@ -378,7 +377,6 @@ int Datastore::set_tm_mad(const string &tm_mad, string &error_str)
std::vector<std::string> modes; std::vector<std::string> modes;
ostringstream oss; ostringstream oss;
std::stringstream ss;
string orph; string orph;
@ -433,8 +431,6 @@ int Datastore::set_tm_mad(const string &tm_mad, string &error_str)
modes = one_util::split(st, ',', true); modes = one_util::split(st, ',', true);
string s;
for (const auto &mode : modes) for (const auto &mode : modes)
{ {
string tm = one_util::trim(mode); string tm = one_util::trim(mode);
@ -609,7 +605,6 @@ int Datastore::insert(SqlDB *db, string& error_str)
{ {
string s_disk_type; string s_disk_type;
string s_ds_type; string s_ds_type;
string datastore_location;
string safe_dirs; string safe_dirs;
string restricted_dirs; string restricted_dirs;
@ -943,8 +938,6 @@ int Datastore::post_update_template(string& error_str)
string new_tm_mad; string new_tm_mad;
string s_ds_type; string s_ds_type;
string new_disk_type; string new_disk_type;
string new_base_path;
string vcenter_password;
DatastoreType new_ds_type; DatastoreType new_ds_type;

View File

@ -46,7 +46,7 @@ const int DatastorePool::FILE_DS_ID = 2;
DatastorePool::DatastorePool( DatastorePool::DatastorePool(
SqlDB * db, SqlDB * db,
const vector<const SingleAttribute *>& _inherit_attrs, const vector<const SingleAttribute *>& _inherit_attrs,
vector<const SingleAttribute *>& encrypted_attrs) : const vector<const SingleAttribute *>& encrypted_attrs) :
PoolSQL(db, one_db::ds_table) PoolSQL(db, one_db::ds_table)
{ {

View File

@ -108,7 +108,6 @@ error:
int DispatchManager::import(unique_ptr<VirtualMachine> vm, const RequestAttributes& ra) int DispatchManager::import(unique_ptr<VirtualMachine> vm, const RequestAttributes& ra)
{ {
ostringstream oss;
string import_state; string import_state;
int uid; int uid;
@ -1180,8 +1179,6 @@ int DispatchManager::delete_vm(int vid, const RequestAttributes& ra,
int DispatchManager::delete_recreate(unique_ptr<VirtualMachine> vm, int DispatchManager::delete_recreate(unique_ptr<VirtualMachine> vm,
const RequestAttributes& ra, string& error) const RequestAttributes& ra, string& error)
{ {
ostringstream oss;
int rc = 0; int rc = 0;
Template vm_quotas_snp; Template vm_quotas_snp;
@ -1804,7 +1801,6 @@ int DispatchManager::detach_nic(int vid, int nic_id, const RequestAttributes& ra
string& error_str) string& error_str)
{ {
ostringstream oss; ostringstream oss;
string tmp_error;
auto vm = vmpool->get(vid); auto vm = vmpool->get(vid);

View File

@ -41,7 +41,7 @@ const int GroupPool::USERS_ID = 1;
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
GroupPool::GroupPool(SqlDB * db, bool is_slave, GroupPool::GroupPool(SqlDB * db, bool is_slave,
vector<const SingleAttribute *>& restricted_attrs) const vector<const SingleAttribute *>& restricted_attrs)
: PoolSQL(db, one_db::group_table) : PoolSQL(db, one_db::group_table)
{ {
ostringstream oss; ostringstream oss;

View File

@ -32,7 +32,6 @@
ExecuteHook::ExecuteHook(const std::string& _name, const std::string& _cmd, ExecuteHook::ExecuteHook(const std::string& _name, const std::string& _cmd,
const std::string& _arg, const std::string& rl): name(_name), cmd(_cmd) const std::string& _arg, const std::string& rl): name(_name), cmd(_cmd)
{ {
std::string s(_arg);
std::istringstream iss(_arg); std::istringstream iss(_arg);
if (cmd[0] != '/') if (cmd[0] != '/')

View File

@ -95,7 +95,7 @@ string& Hook::_to_xml(string& xml, bool log) const
int Hook::from_xml(const std::string& xml) int Hook::from_xml(const std::string& xml)
{ {
vector<xmlNodePtr> content; vector<xmlNodePtr> content;
std::string type_str, remote_str; std::string type_str;
std::string error_msg; std::string error_msg;
int rc = 0; int rc = 0;
@ -139,8 +139,6 @@ int Hook::from_xml(const std::string& xml)
ObjectXML::free_nodes(content); ObjectXML::free_nodes(content);
content.clear();
if (rc != 0) if (rc != 0)
{ {
return -1; return -1;
@ -197,7 +195,6 @@ int Hook::bootstrap(SqlDB * db)
int Hook::insert(SqlDB *db, std::string& error_str) int Hook::insert(SqlDB *db, std::string& error_str)
{ {
std::string type_str; std::string type_str;
std::string remote_str;
int rc; int rc;
@ -350,7 +347,6 @@ error_common:
int Hook::set_hook(HookType hook_type, string& error) int Hook::set_hook(HookType hook_type, string& error)
{ {
std::string type_str;
std::string resource; std::string resource;
if (hook_type == UNDEFINED) if (hook_type == UNDEFINED)

View File

@ -71,7 +71,8 @@ const string HookAPI::unsupported_calls[] = {"one.vm.info",
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
std::string HookAPI::format_message(const std::string& method, ParamList& paramList, std::string HookAPI::format_message(const std::string& method,
const ParamList& paramList,
const RequestAttributes& att) const RequestAttributes& att)
{ {
ostringstream oss; ostringstream oss;

View File

@ -140,7 +140,7 @@ int HookLog::drop(SqlDB *db, const int hook_id)
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
int HookLog::add(int hkid, int hkrc, std::string &xml_result) int HookLog::add(int hkid, int hkrc, const std::string &xml_result)
{ {
std::ostringstream oss; std::ostringstream oss;

View File

@ -462,8 +462,6 @@ int Host::from_xml(const string& xml)
ObjectXML::free_nodes(content); ObjectXML::free_nodes(content);
content.clear();
// ------------ Host Template --------------- // ------------ Host Template ---------------
ObjectXML::get_nodes("/HOST/TEMPLATE", content); ObjectXML::get_nodes("/HOST/TEMPLATE", content);
@ -477,8 +475,6 @@ int Host::from_xml(const string& xml)
ObjectXML::free_nodes(content); ObjectXML::free_nodes(content);
content.clear();
// ------------ VMS collection --------------- // ------------ VMS collection ---------------
rc += vm_collection.from_xml(this, "/HOST/"); rc += vm_collection.from_xml(this, "/HOST/");

View File

@ -107,7 +107,6 @@ int NUMAMonitoring::from_xml(ObjectXML& xml, const std::string& xpath_prefix)
} }
xml.free_nodes(content); xml.free_nodes(content);
content.clear();
return 0; return 0;
} }
@ -291,7 +290,6 @@ int HostMonitoringTemplate::from_xml(const std::string& xml_string)
capacity.from_xml_node(content[0]); capacity.from_xml_node(content[0]);
xml.free_nodes(content); xml.free_nodes(content);
content.clear();
} }
// ------------ System --------------- // ------------ System ---------------
@ -302,7 +300,6 @@ int HostMonitoringTemplate::from_xml(const std::string& xml_string)
system.from_xml_node(content[0]); system.from_xml_node(content[0]);
xml.free_nodes(content); xml.free_nodes(content);
content.clear();
} }
// ------------ NUMA --------------- // ------------ NUMA ---------------

View File

@ -35,7 +35,7 @@ using namespace std;
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
HostPool::HostPool(SqlDB * db, vector<const SingleAttribute *>& ea) : HostPool::HostPool(SqlDB * db, const vector<const SingleAttribute *>& ea) :
PoolSQL(db, one_db::host_table) PoolSQL(db, one_db::host_table)
{ {
HostTemplate::parse_encrypted(ea); HostTemplate::parse_encrypted(ea);
@ -53,7 +53,7 @@ int HostPool::allocate (
const string& cluster_name, const string& cluster_name,
string& error_str) string& error_str)
{ {
Host * host; Host * host_ptr;
ostringstream oss; ostringstream oss;
int db_oid; int db_oid;
@ -82,7 +82,7 @@ int HostPool::allocate (
// Build a new Host object // Build a new Host object
host = new Host( host_ptr = new Host(
-1, -1,
hostname, hostname,
im_mad_name, im_mad_name,
@ -92,7 +92,7 @@ int HostPool::allocate (
// Insert the Object in the pool // Insert the Object in the pool
*oid = PoolSQL::allocate(host, error_str); *oid = PoolSQL::allocate(host_ptr, error_str);
if (*oid >= 0) if (*oid >= 0)
{ {

View File

@ -114,8 +114,6 @@ int HostShare::from_xml_node(const xmlNodePtr node)
ObjectXML::free_nodes(content); ObjectXML::free_nodes(content);
content.clear();
if (rc != 0) if (rc != 0)
{ {
return -1; return -1;
@ -134,8 +132,6 @@ int HostShare::from_xml_node(const xmlNodePtr node)
ObjectXML::free_nodes(content); ObjectXML::free_nodes(content);
content.clear();
if (rc != 0) if (rc != 0)
{ {
return -1; return -1;
@ -151,8 +147,6 @@ int HostShare::from_xml_node(const xmlNodePtr node)
ObjectXML::free_nodes(content); ObjectXML::free_nodes(content);
content.clear();
if (rc != 0) if (rc != 0)
{ {
return -1; return -1;

View File

@ -496,7 +496,6 @@ int HostShareNode::allocate_ht_cpus(int id, unsigned int tcpus, unsigned int tc,
void HostShareNode::del_cpu(const std::string &cpu_ids, unsigned int vmid) void HostShareNode::del_cpu(const std::string &cpu_ids, unsigned int vmid)
{ {
std::vector<unsigned int> ids; std::vector<unsigned int> ids;
std::set<unsigned int> core_ids;
one_util::split(cpu_ids, ',', ids); one_util::split(cpu_ids, ',', ids);
@ -793,8 +792,7 @@ void HostShareNUMA::set_monitorization(Template &ht, unsigned int _vt)
for (auto it = pages.begin(); it != pages.end(); ++it) for (auto it = pages.begin(); it != pages.end(); ++it)
{ {
unsigned int pages = 0; unsigned int nr = 0;
unsigned long size = 0; unsigned long size = 0;
if ( (*it)->vector_value("NODE_ID", node_id) == -1 ) if ( (*it)->vector_value("NODE_ID", node_id) == -1 )
@ -803,11 +801,11 @@ void HostShareNUMA::set_monitorization(Template &ht, unsigned int _vt)
} }
(*it)->vector_value("SIZE", size); (*it)->vector_value("SIZE", size);
(*it)->vector_value("PAGES",pages); (*it)->vector_value("PAGES",nr);
HostShareNode& node = get_node(node_id); HostShareNode& node = get_node(node_id);
node.set_hugepage(size, pages, 0, true); node.set_hugepage(size, nr, 0, true);
} }
std::vector<VectorAttribute *> memory; std::vector<VectorAttribute *> memory;
@ -1027,7 +1025,6 @@ bool HostShareNUMA::schedule_nodes(NUMANodeRequest &nr, unsigned int threads,
int HostShareNUMA::make_topology(HostShareCapacity &sr, int vm_id, bool do_alloc) int HostShareNUMA::make_topology(HostShareCapacity &sr, int vm_id, bool do_alloc)
{ {
unsigned int t_max; //Max threads per core for this topology
std::set<int> t_valid; //Viable threads per core combinations for all nodes std::set<int> t_valid; //Viable threads per core combinations for all nodes
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -1088,13 +1085,11 @@ int HostShareNUMA::make_topology(HostShareCapacity &sr, int vm_id, bool do_alloc
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
if ( dedicated ) if ( dedicated )
{ {
t_max = 1;
t_valid.insert(1); t_valid.insert(1);
} }
else else
{ {
t_max = v_t; unsigned int t_max = v_t; //Max threads per core for this topology
if ( t_max > threads_core || t_max == 0 ) if ( t_max > threads_core || t_max == 0 )
{ {

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