From d5807d9bb941116b6542596489675d732144b19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Czern=C3=BD?= Date: Tue, 24 Nov 2026 12:08:06 +0100 Subject: [PATCH] L #-: cppcheck version 2.19 (#4714) * Remove empty destructors, keep only those which change private/public contract * Remove unused variables * Use static methods whenever possible * Delete copy and assign constructor if cppcheck complains * Disable AStyle linting --- include/AclManager.h | 6 ++--- include/AddressRange.h | 4 ++-- include/AddressRangeIPAM.h | 2 -- include/AddressRangeInternal.h | 2 -- include/Attribute.h | 4 ---- include/AuthRequest.h | 2 -- include/BackupIncrements.h | 6 ----- include/BitMap.h | 5 +++- include/Callbackable.h | 2 +- include/Cluster.h | 2 -- include/ClusterPool.h | 2 -- include/ClusterTemplate.h | 2 -- include/Datastore.h | 2 -- include/DatastorePool.h | 2 -- include/DatastoreTemplate.h | 2 -- include/DefaultQuotas.h | 2 -- include/DispatchManager.h | 2 -- include/Document.h | 2 -- include/DocumentPool.h | 2 -- include/DocumentTemplate.h | 2 -- include/ExtendedAttribute.h | 2 +- include/FedReplicaManager.h | 2 +- include/Group.h | 2 -- include/GroupPool.h | 2 -- include/GroupTemplate.h | 2 -- include/GroupVlans.h | 2 -- include/History.h | 2 -- include/Hook.h | 5 +++- include/HookAPI.h | 4 ++-- include/HookManager.h | 6 ++--- include/HookPool.h | 2 -- include/HookStateHost.h | 2 +- include/HookStateImage.h | 2 +- include/HookStateVM.h | 2 +- include/HookStateVirtualNetwork.h | 2 +- include/Host.h | 2 -- include/HostPool.h | 19 ++------------- include/HostShare.h | 2 -- include/HostShareDatastore.h | 2 -- include/HostShareNUMA.h | 2 -- include/HostSharePCI.h | 6 ++--- include/HostTemplate.h | 2 -- include/IPAMManager.h | 6 ++--- include/IPAMRequest.h | 2 -- include/Image.h | 2 -- include/ImageManager.h | 2 -- include/ImagePool.h | 2 -- include/ImageTemplate.h | 2 -- include/InformationManager.h | 2 -- include/LibVirtDriver.h | 2 -- include/LifeCycleManager.h | 2 -- include/Log.h | 8 ------- include/LogDB.h | 7 +++--- include/LoginToken.h | 2 -- include/MarketPlace.h | 2 -- include/MarketPlaceApp.h | 2 -- include/MarketPlaceAppPool.h | 2 -- include/MarketPlaceAppTemplate.h | 1 - include/MarketPlaceManager.h | 2 -- include/MarketPlacePool.h | 2 -- include/MarketPlaceTemplate.h | 1 - include/MySqlDB.h | 2 +- include/Nebula.h | 5 ++-- include/NebulaTemplate.h | 2 -- include/ObjectSQL.h | 2 -- include/OpenNebulaTemplate.h | 2 -- include/Plan.h | 2 +- include/PoolObjectSQL.h | 4 ++-- include/Quota.h | 10 ++++---- include/QuotaDatastore.h | 2 -- include/QuotaImage.h | 2 -- include/QuotaNetwork.h | 4 ---- include/QuotaVirtualMachine.h | 2 -- include/QuotasSQL.h | 4 +--- include/RaftManager.h | 2 +- include/ReplicaManager.h | 4 ---- include/ReplicaRequest.h | 2 -- include/ReplicaThread.h | 6 ----- include/Request.h | 2 +- include/SchedulerManager.h | 6 ++--- include/SecurityGroup.h | 2 -- include/SecurityGroupPool.h | 2 -- include/SqliteDB.h | 2 +- include/StringBuffer.h | 3 +++ include/SyncRequest.h | 2 -- include/SystemDB.h | 2 +- include/Template.h | 15 ++++-------- include/TransferManager.h | 2 -- include/User.h | 2 -- include/UserPool.h | 6 ++--- include/UserTemplate.h | 2 -- include/VMActions.h | 4 ++-- include/VMGroup.h | 2 -- include/VMGroupPool.h | 2 -- include/VMTemplate.h | 2 -- include/VMTemplatePool.h | 2 -- include/VNTemplate.h | 2 -- include/VNTemplatePool.h | 2 -- include/Vdc.h | 2 -- include/VdcPool.h | 2 -- include/VirtualMachine.h | 5 +++- include/VirtualMachineAttribute.h | 4 ++-- include/VirtualMachineDisk.h | 9 +++---- include/VirtualMachineManager.h | 12 ++++------ include/VirtualMachineNic.h | 4 ---- include/VirtualMachinePool.h | 2 -- include/VirtualMachineTemplate.h | 2 -- include/VirtualNetwork.h | 2 -- include/VirtualNetworkPool.h | 2 -- include/VirtualNetworkTemplate.h | 2 -- include/VirtualRouter.h | 2 -- include/VirtualRouterPool.h | 2 -- include/XMLDriver.h | 2 -- include/XenDriver.h | 2 -- include/Zone.h | 5 +++- include/ZonePool.h | 2 -- include/ZoneServer.h | 6 ----- .../config/cppcheck-suppressions.xml | 17 +++++++++++++ .../{tests => disabled_tests}/05-astyle.sh | 0 share/smoke_tests/tests/04-cppcheck.sh | 2 +- src/acl/AclManager.cc | 2 +- src/common/NebulaUtil.cc | 2 +- src/dm/DispatchManagerActions.cc | 1 - src/hm/HookLog.cc | 2 -- src/hm/HookManager.cc | 4 ++-- src/host/HostSharePCI.cc | 2 +- src/image/ImageManagerActions.cc | 1 - src/ipamm/IPAMManager.cc | 4 ++-- src/lcm/LifeCycleActions.cc | 6 ----- src/lcm/LifeCycleStates.cc | 4 ---- src/log/Log.cc | 5 ---- src/monitor/include/BaseObject.h | 2 -- src/monitor/include/MonitorConfigTemplate.h | 2 -- src/monitor/include/MonitorDriver.h | 2 +- src/monitor/include/OneMonitorDriver.h | 8 +++---- src/monitor/include/TCPMonitorDriver.h | 1 - src/monitor/include/TCPStream.h | 4 +--- src/monitor/include/UDPMonitorDriver.h | 1 - src/monitor/include/UDPStream.h | 4 +--- src/monitor/include/VirtualMachineBase.h | 2 -- src/monitor/src/monitor/onemonitord.cc | 11 ++++----- src/rm/api/BackupJobAPI.h | 2 +- src/rm/api/DocumentAPI.h | 2 +- src/rm/api/GroupAPI.h | 6 ++--- src/rm/api/HookPoolAPI.h | 12 +++++----- src/rm/api/RMHookAPI.h | 2 +- src/rm/api/SecurityGroupAPI.h | 2 +- src/rm/api/SystemAPI.h | 10 ++++---- src/rm/api/UserAPI.h | 6 ++--- src/rm/api/VMGroupAPI.h | 2 +- src/rm/api/VdcAPI.h | 2 +- src/rm/api/VirtualMachineAPI.h | 8 +++---- src/rm/api/VirtualNetworkAPI.cc | 2 +- src/rm/api/VirtualNetworkAPI.h | 6 ++--- src/rm/api/VirtualRouterAPI.h | 2 +- src/rm/api/ZoneAPI.h | 24 +++++++++---------- src/rm/grpc/RequestGRPC.cc | 2 +- src/rm/grpc/RequestGRPC.h | 6 ++--- src/rm/grpc/RequestLoggerGRPC.h | 2 -- src/rm/xml-rpc/RequestLoggerXRPC.cc | 4 ++-- src/rm/xml-rpc/RequestLoggerXRPC.h | 6 ++--- src/rm/xml-rpc/RequestManagerXRPC.cc | 4 ++-- src/rm/xml-rpc/RequestXRPC.cc | 2 +- src/rm/xml-rpc/RequestXRPC.h | 2 -- src/sam/ScheduledAction.cc | 2 +- src/schedm/SchedulerManager.cc | 8 +++---- src/tm/TransferManager.cc | 6 ----- src/um/Quota.cc | 2 +- src/vmm/VirtualMachineManager.cc | 13 +++------- src/vnm/AddressRange.cc | 3 ++- 170 files changed, 188 insertions(+), 421 deletions(-) rename share/smoke_tests/{tests => disabled_tests}/05-astyle.sh (100%) diff --git a/include/AclManager.h b/include/AclManager.h index 423ac3c875..08192e7e53 100644 --- a/include/AclManager.h +++ b/include/AclManager.h @@ -40,7 +40,7 @@ public: */ AclManager(SqlDB * _db, int zone_id, bool is_federation_slave, time_t timer); - virtual ~AclManager(); + ~AclManager() override; /** * Loads the ACL rule set from the DB, and starts the refresh loop is @@ -89,8 +89,8 @@ public: * @param op The operation to be authorized * @return true if the authorization is granted for oneadmin */ - bool oneadmin_authorize(const PoolObjectAuth& obj_perms, - AuthRequest::Operation op) const; + static bool oneadmin_authorize(const PoolObjectAuth& obj_perms, + AuthRequest::Operation op); /** * Adds a new rule to the ACL rule set diff --git a/include/AddressRange.h b/include/AddressRange.h index 36d2b7fa1f..39d116d19f 100644 --- a/include/AddressRange.h +++ b/include/AddressRange.h @@ -825,7 +825,7 @@ private: /** * Deletes all restricted attributes */ - void remove_restricted(VectorAttribute* va); + static void remove_restricted(VectorAttribute* va); /** * Checks if an update changes any restricted attribute @@ -835,7 +835,7 @@ private: /** * Deletes all the attributes, except the restricted ones */ - void remove_all_except_restricted(VectorAttribute* va); + static void remove_all_except_restricted(VectorAttribute* va); /* ---------------------------------------------------------------------- */ /* Address Range data */ diff --git a/include/AddressRangeIPAM.h b/include/AddressRangeIPAM.h index 7640c8bb64..916652dae0 100644 --- a/include/AddressRangeIPAM.h +++ b/include/AddressRangeIPAM.h @@ -29,8 +29,6 @@ public: AddressRangeIPAM(unsigned int _vid, unsigned int _id) : AddressRange(_vid, _id) {}; - virtual ~AddressRangeIPAM() {}; - /* ---------------------------------------------------------------------- */ /* AddressRange Interface */ /* ---------------------------------------------------------------------- */ diff --git a/include/AddressRangeInternal.h b/include/AddressRangeInternal.h index a53a6f1929..1699a7a900 100644 --- a/include/AddressRangeInternal.h +++ b/include/AddressRangeInternal.h @@ -29,8 +29,6 @@ public: AddressRangeInternal(unsigned int _vid, unsigned int _id) : AddressRange(_vid, _id) {}; - virtual ~AddressRangeInternal() {}; - /* ---------------------------------------------------------------------- */ /* AddressRange Interface */ /* ---------------------------------------------------------------------- */ diff --git a/include/Attribute.h b/include/Attribute.h index edd2a91e43..9b97a511da 100644 --- a/include/Attribute.h +++ b/include/Attribute.h @@ -150,8 +150,6 @@ public: , attribute_value(sa.attribute_value) {} - ~SingleAttribute() {}; - /** * Returns the attribute value, a string. */ @@ -308,8 +306,6 @@ public: VectorAttribute& operator=(const VectorAttribute& va) = default; - ~VectorAttribute() {}; - /** * Returns the attribute value, a string. */ diff --git a/include/AuthRequest.h b/include/AuthRequest.h index 8138479b47..1edb48b6f4 100644 --- a/include/AuthRequest.h +++ b/include/AuthRequest.h @@ -40,8 +40,6 @@ public: , self_authorize(true) {} - ~AuthRequest() {}; - /** * Authorization Request Type */ diff --git a/include/BackupIncrements.h b/include/BackupIncrements.h index 4eb56cffc2..cdd560caa4 100644 --- a/include/BackupIncrements.h +++ b/include/BackupIncrements.h @@ -38,8 +38,6 @@ class Increment : public ExtendedAttribute public: Increment(VectorAttribute *va, int id): ExtendedAttribute(va, id) {}; - ~Increment() = default; - enum Type { FULL = 0, /** < Full backup*/ @@ -123,8 +121,6 @@ class IncrementSet : public ExtendedAttributeSet public: IncrementSet(): ExtendedAttributeSet(false) {}; - ~IncrementSet() = default; - void init(Template * tmpl) { std::vector incs; @@ -185,8 +181,6 @@ public: IncIterator():AttributeIterator() {}; IncIterator(const AttributeIterator& dit):AttributeIterator(dit) {}; - virtual ~IncIterator() {}; - Increment * operator*() const { return static_cast(map_it->second); diff --git a/include/BitMap.h b/include/BitMap.h index 7e8da3e631..3a9d1e6dc8 100644 --- a/include/BitMap.h +++ b/include/BitMap.h @@ -75,7 +75,10 @@ public: : id(_id), start_bit(0), bs(0), db_table(_db_table) {}; - virtual ~BitMap() + BitMap(const BitMap&) = delete; + BitMap& operator=(const BitMap&) = delete; + + ~BitMap() override { delete bs; }; diff --git a/include/Callbackable.h b/include/Callbackable.h index fbdc5c83a4..81d0b45737 100644 --- a/include/Callbackable.h +++ b/include/Callbackable.h @@ -358,7 +358,7 @@ private: class empty_cb : public Callbackable { public: - void set_callback(Callback _cb, void * _arg = 0) {}; + static void set_callback(Callback, void * = nullptr) {}; bool isCallBackSet() override { diff --git a/include/Cluster.h b/include/Cluster.h index 8df8a5b1d2..047020b9d4 100644 --- a/include/Cluster.h +++ b/include/Cluster.h @@ -36,8 +36,6 @@ public: FULL = 2 }; - virtual ~Cluster() = default; - // ************************************************************************* // Object Collections (Public) // ************************************************************************* diff --git a/include/ClusterPool.h b/include/ClusterPool.h index a8efec5f91..6837d74a04 100644 --- a/include/ClusterPool.h +++ b/include/ClusterPool.h @@ -28,8 +28,6 @@ public: const VectorAttribute * vnc_conf, const std::vector& encrypted_attrs); - ~ClusterPool() {}; - /* ---------------------------------------------------------------------- */ /* Constants for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/ClusterTemplate.h b/include/ClusterTemplate.h index e85b49d646..6fa1a57278 100644 --- a/include/ClusterTemplate.h +++ b/include/ClusterTemplate.h @@ -29,8 +29,6 @@ public: ClusterTemplate(): Template(true, '=', "TEMPLATE") {}; - ~ClusterTemplate() {}; - ClusterTemplate(ClusterTemplate& ct):Template(ct) {}; // ------------------------------------------------------------------------- diff --git a/include/Datastore.h b/include/Datastore.h index 9e251b121d..6132d0111e 100644 --- a/include/Datastore.h +++ b/include/Datastore.h @@ -90,8 +90,6 @@ public: } }; - virtual ~Datastore() = default; - /** * Function to print the Datastore object into a string in XML format * @param xml the resulting XML string diff --git a/include/DatastorePool.h b/include/DatastorePool.h index 8f8a1e2e4f..6f3ed1d9ae 100644 --- a/include/DatastorePool.h +++ b/include/DatastorePool.h @@ -29,8 +29,6 @@ public: const std::vector& _inherit_attrs, const std::vector& encrypted_attrs); - ~DatastorePool() {}; - /* ---------------------------------------------------------------------- */ /* Constants for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/DatastoreTemplate.h b/include/DatastoreTemplate.h index 83450508f1..3b828ca182 100644 --- a/include/DatastoreTemplate.h +++ b/include/DatastoreTemplate.h @@ -29,8 +29,6 @@ public: DatastoreTemplate(): Template(false, '=', "TEMPLATE") {}; - ~DatastoreTemplate() {}; - DatastoreTemplate(DatastoreTemplate& dt):Template(dt) {}; // ------------------------------------------------------------------------- diff --git a/include/DefaultQuotas.h b/include/DefaultQuotas.h index f511992bff..bad64404bd 100644 --- a/include/DefaultQuotas.h +++ b/include/DefaultQuotas.h @@ -32,8 +32,6 @@ public: root_elem(_root_elem) {}; - ~DefaultQuotas() {}; - /** * Generates a string representation of the quotas in XML format * @param xml the string to store the XML diff --git a/include/DispatchManager.h b/include/DispatchManager.h index a9e5efbe19..1c4ffe1b35 100644 --- a/include/DispatchManager.h +++ b/include/DispatchManager.h @@ -47,8 +47,6 @@ public: { } - ~DispatchManager() = default; - /** * Initializes internal pointers to other managers. Must be called when * all the other managers exist in Nebula::instance diff --git a/include/Document.h b/include/Document.h index d44792ad2b..076d7e71bb 100644 --- a/include/Document.h +++ b/include/Document.h @@ -30,8 +30,6 @@ class Document : public PoolObjectSQL { public: - virtual ~Document() = default; - /** * Function to print the Document object into a string in XML format * @param xml the resulting XML string diff --git a/include/DocumentPool.h b/include/DocumentPool.h index 74827d57a2..fb84739dc7 100644 --- a/include/DocumentPool.h +++ b/include/DocumentPool.h @@ -34,8 +34,6 @@ public: DocumentTemplate::parse_encrypted(ea); }; - ~DocumentPool() {}; - /** * Allocates a new object, writing it in the pool database. No memory is * allocated for the object. diff --git a/include/DocumentTemplate.h b/include/DocumentTemplate.h index b967004abe..2367f0051c 100644 --- a/include/DocumentTemplate.h +++ b/include/DocumentTemplate.h @@ -27,8 +27,6 @@ class DocumentTemplate : public Template public: DocumentTemplate() : Template(false, '=', "TEMPLATE") {}; - ~DocumentTemplate() {}; - DocumentTemplate(DocumentTemplate& dt):Template(dt) {}; DocumentTemplate(const Template& tmpl):Template(tmpl) {}; diff --git a/include/ExtendedAttribute.h b/include/ExtendedAttribute.h index 3d0b3c1764..13f04f8a1a 100644 --- a/include/ExtendedAttribute.h +++ b/include/ExtendedAttribute.h @@ -116,7 +116,7 @@ protected: ExtendedAttribute(VectorAttribute *_va, int _id): Attribute(_va->name()), va(_va), id(_id) {}; - virtual ~ExtendedAttribute() {}; + ~ExtendedAttribute() override = default; /* ---------------------------------------------------------------------- */ /* Attribute Interface */ diff --git a/include/FedReplicaManager.h b/include/FedReplicaManager.h index c5cb080b7b..d94fc4e9c2 100644 --- a/include/FedReplicaManager.h +++ b/include/FedReplicaManager.h @@ -37,7 +37,7 @@ public: */ FedReplicaManager(LogDB * d); - virtual ~FedReplicaManager(); + ~FedReplicaManager() override; /** * Sends the replication event to the replica threads. [MASTER] diff --git a/include/Group.h b/include/Group.h index 07eba59e98..1717cfdc83 100644 --- a/include/Group.h +++ b/include/Group.h @@ -32,8 +32,6 @@ class Group : public PoolObjectSQL { public: - virtual ~Group() = default; - static const std::string INVALID_NAME_CHARS; /** diff --git a/include/GroupPool.h b/include/GroupPool.h index b885e5af67..e950c13d3d 100644 --- a/include/GroupPool.h +++ b/include/GroupPool.h @@ -28,8 +28,6 @@ public: GroupPool(SqlDB * db, bool is_federation_slave, const std::vector& restricted_attrs); - ~GroupPool() = default; - /* ---------------------------------------------------------------------- */ /* Constants for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/GroupTemplate.h b/include/GroupTemplate.h index 519f89d6db..8b704fc7c2 100644 --- a/include/GroupTemplate.h +++ b/include/GroupTemplate.h @@ -27,8 +27,6 @@ class GroupTemplate : public Template public: GroupTemplate() : Template(false, '=', "TEMPLATE") {} - ~GroupTemplate() = default; - // ------------------------------------------------------------------------- // Restricted attributes interface implementation // ------------------------------------------------------------------------- diff --git a/include/GroupVlans.h b/include/GroupVlans.h index 87b3da24ff..8cdd4cd155 100644 --- a/include/GroupVlans.h +++ b/include/GroupVlans.h @@ -34,8 +34,6 @@ class GroupVlans : public ObjectSQL public: GroupVlans(): ObjectSQL(), oid(-1), vlan_template(false, '=', "VLAN_RULES") {}; - virtual ~GroupVlans() {}; - /** * Parsed representation of a group VLAN rule. It normalizes the SCOPE, * VLAN ID ranges, and optional VN Template ranges so validation and diff --git a/include/History.h b/include/History.h index 8a1093ef66..67815bcffb 100644 --- a/include/History.h +++ b/include/History.h @@ -44,8 +44,6 @@ public: int action_id, const std::string& vm_info); - ~History() {}; - /** * Function to write the History Record in an output stream */ diff --git a/include/Hook.h b/include/Hook.h index b89a180a7e..e0bd76e0b1 100644 --- a/include/Hook.h +++ b/include/Hook.h @@ -29,7 +29,10 @@ class Hook : public PoolObjectSQL { public: - ~Hook(); + Hook(const Hook&) = delete; + Hook& operator=(const Hook&) = delete; + + ~Hook() override; /** * Defines the hook type, so a whole hook class can be masked diff --git a/include/HookAPI.h b/include/HookAPI.h index dea2607feb..ea8e5f5d36 100644 --- a/include/HookAPI.h +++ b/include/HookAPI.h @@ -55,7 +55,7 @@ private: HookAPI(const std::string& _call): call(_call) {}; - virtual ~HookAPI() = default; + ~HookAPI() override = default; /** * Check if type dependent attributes are well defined. @@ -87,7 +87,7 @@ private: * * @return true if the call exists, false otherwise */ - bool call_exist(const std::string& api_call); + static bool call_exist(const std::string& api_call); // ------------------------------------------------------------------------- // Hook API Attributes diff --git a/include/HookManager.h b/include/HookManager.h index a82146d2d7..e41c0a7306 100644 --- a/include/HookManager.h +++ b/include/HookManager.h @@ -38,8 +38,6 @@ public: { } - virtual ~HookManager() = default; - /** * This functions starts the associated listener thread, and creates a * new thread for the Hook Manager. This thread will wait in @@ -99,12 +97,12 @@ private: /** * */ - void _execute(std::unique_ptr msg); + static void _execute(std::unique_ptr msg); /** * */ - void _retry(std::unique_ptr msg); + static void _retry(std::unique_ptr msg); /** * diff --git a/include/HookPool.h b/include/HookPool.h index 0cc89fef20..432bd008ed 100644 --- a/include/HookPool.h +++ b/include/HookPool.h @@ -31,8 +31,6 @@ public: HookPool(SqlDB * db) : PoolSQL(db, one_db::hook_table) {}; - ~HookPool() {}; - /** * Function to allocate a new Hook object * @param oid the id assigned to the Hook diff --git a/include/HookStateHost.h b/include/HookStateHost.h index 7530dd17fc..b152e8a34c 100644 --- a/include/HookStateHost.h +++ b/include/HookStateHost.h @@ -42,7 +42,7 @@ private: HookStateHost():state(Host::INIT) {}; - virtual ~HookStateHost() = default; + ~HookStateHost() override = default; /** * Check if type dependent attributes are well defined. diff --git a/include/HookStateImage.h b/include/HookStateImage.h index 486b321e22..cbfc535eca 100644 --- a/include/HookStateImage.h +++ b/include/HookStateImage.h @@ -42,7 +42,7 @@ private: HookStateImage():state(Image::INIT) {}; - virtual ~HookStateImage() = default; + ~HookStateImage() override = default; /** * Check if type dependent attributes are well defined. diff --git a/include/HookStateVM.h b/include/HookStateVM.h index aa2591f098..938c2c75f5 100644 --- a/include/HookStateVM.h +++ b/include/HookStateVM.h @@ -43,7 +43,7 @@ private: HookStateVM():state(VirtualMachine::INIT), lcm_state(VirtualMachine::LCM_INIT) {}; - virtual ~HookStateVM() = default; + ~HookStateVM() override = default; /** * Check if type dependent attributes are well defined. diff --git a/include/HookStateVirtualNetwork.h b/include/HookStateVirtualNetwork.h index 234953dada..7a82d336fc 100644 --- a/include/HookStateVirtualNetwork.h +++ b/include/HookStateVirtualNetwork.h @@ -42,7 +42,7 @@ private: HookStateVirtualNetwork():state(VirtualNetwork::INIT) {}; - virtual ~HookStateVirtualNetwork() = default; + ~HookStateVirtualNetwork() override = default; /** * Check if type dependent attributes are well defined. diff --git a/include/Host.h b/include/Host.h index ce7c565b22..ac494c1da6 100644 --- a/include/Host.h +++ b/include/Host.h @@ -122,8 +122,6 @@ public: return st; } - virtual ~Host() = default; - /** * Function to print the Host object into a string in XML format * @param xml the resulting XML string diff --git a/include/HostPool.h b/include/HostPool.h index 55391e98d8..d7660e8c32 100644 --- a/include/HostPool.h +++ b/include/HostPool.h @@ -34,8 +34,6 @@ class HostPool : public PoolSQL public: HostPool(SqlDB * db, const std::vector& secrets); - ~HostPool() = default; - /** * Function to allocate a new Host object * @param oid the id assigned to the Host @@ -91,7 +89,7 @@ public: */ std::unique_ptr get(const std::string& name) { - // The owner is set to -1, because it is not used in the key() method + // Host names are unique, so look up by name alone. return PoolSQL::get(name, -1); } @@ -103,23 +101,10 @@ public: */ std::unique_ptr get_ro(const std::string& name) { - // The owner is set to -1, because it is not used in the key() method + // Host names are unique, so look up by name alone. return PoolSQL::get_ro(name, -1); } - /** - * Generate an index key for the object - * @param name of the object - * @param uid owner of the object, only used if needed - * - * @return the key, a string - */ - std::string key(const std::string& name, int uid) - { - // Name is enough key because Hosts can't repeat names. - return name; - }; - /** * Bootstraps the database table(s) associated to the Host pool * @return 0 on success diff --git a/include/HostShare.h b/include/HostShare.h index 330d08206b..ffd4015fdd 100644 --- a/include/HostShare.h +++ b/include/HostShare.h @@ -52,8 +52,6 @@ class HostShare : public ObjectXML public: HostShare(); - ~HostShare() {}; - /** * Pin policy for the host */ diff --git a/include/HostShareDatastore.h b/include/HostShareDatastore.h index a6a819b320..88f81c7562 100644 --- a/include/HostShareDatastore.h +++ b/include/HostShareDatastore.h @@ -30,8 +30,6 @@ public: HostShareDatastore() : Template(false, '=', "DATASTORES"), disk_usage(0), max_disk(0), free_disk(0), used_disk(0) {}; - virtual ~HostShareDatastore() {}; - /** * Updates the Datastore information from the monitorization template. * @param ht monitoring template. DS information will be removed. diff --git a/include/HostShareNUMA.h b/include/HostShareNUMA.h index 84ace52626..3ddd7a7599 100644 --- a/include/HostShareNUMA.h +++ b/include/HostShareNUMA.h @@ -62,8 +62,6 @@ public: replace("NODE_ID", i); } - virtual ~HostShareNode() = default; - /** * Builds the node from its XML representation. This function is used when * loading the host from the DB. diff --git a/include/HostSharePCI.h b/include/HostSharePCI.h index 4a42b7a7fd..d54c16ea08 100644 --- a/include/HostSharePCI.h +++ b/include/HostSharePCI.h @@ -55,7 +55,7 @@ public: HostSharePCI(const HostSharePCI& src); - virtual ~HostSharePCI() + ~HostSharePCI() override { HostSharePCI::clear(); }; @@ -190,7 +190,7 @@ private: * Checks whether the device is free and monitoring allows passthrough. * An absent PASSTHROUGH attribute is allowed for older probes. */ - bool is_allocatable(const PCIDevice* pci) const; + static bool is_allocatable(const PCIDevice* pci); /** * Test if there is a suitable PCI device for the VM request. The test @@ -256,7 +256,7 @@ private: * @param pci Host device * @param sp if true set the "PREVIOUS_ADDRESS" attribute */ - void pci_attribute(VectorAttribute *device, PCIDevice *pci, bool sp, + static void pci_attribute(VectorAttribute *device, PCIDevice *pci, bool sp, const std::string& vprofile); }; diff --git a/include/HostTemplate.h b/include/HostTemplate.h index b8c4a886eb..1cc5295edf 100644 --- a/include/HostTemplate.h +++ b/include/HostTemplate.h @@ -28,8 +28,6 @@ class HostTemplate : public Template public: HostTemplate() : Template(false, '=', "TEMPLATE") {}; - ~HostTemplate() {}; - HostTemplate(HostTemplate& ht):Template(ht) {}; // ------------------------------------------------------------------------- diff --git a/include/IPAMManager.h b/include/IPAMManager.h index 9b6b425521..5b8425f00d 100644 --- a/include/IPAMManager.h +++ b/include/IPAMManager.h @@ -43,8 +43,6 @@ public: { } - ~IPAMManager() = default; - /** * This functions starts the associated listener thread, and creates a * new thread for the IPAMManager. This thread will wait in @@ -147,9 +145,9 @@ private: */ void _notify_request(std::unique_ptr msg); - void _vnet_create(std::unique_ptr msg); + static void _vnet_create(std::unique_ptr msg); - void _vnet_delete(std::unique_ptr msg); + static void _vnet_delete(std::unique_ptr msg); /** * diff --git a/include/IPAMRequest.h b/include/IPAMRequest.h index 1a31c86f58..07c315c450 100644 --- a/include/IPAMRequest.h +++ b/include/IPAMRequest.h @@ -46,8 +46,6 @@ public: IPAMRequest(AddressRange * _ar, const std::string& _address_xml); - virtual ~IPAMRequest() {}; - /* ---------------------------------------------------------------------- */ /* Driver message formatting and processing */ /* ---------------------------------------------------------------------- */ diff --git a/include/Image.h b/include/Image.h index b7c6e8e60f..9ed7c3aed1 100644 --- a/include/Image.h +++ b/include/Image.h @@ -173,8 +173,6 @@ public: // Image Public Methods // ************************************************************************* - virtual ~Image() = default; - /** * Function to print the Image object into a string in XML format * @param xml the resulting XML string diff --git a/include/ImageManager.h b/include/ImageManager.h index 0ab446f773..e18da891af 100644 --- a/include/ImageManager.h +++ b/include/ImageManager.h @@ -48,8 +48,6 @@ public: { } - ~ImageManager() = default; - /** * This functions starts the associated listener thread, and creates a * new thread for the Information Manager. This thread will wait in diff --git a/include/ImagePool.h b/include/ImagePool.h index c4663bba55..4476e7f9cf 100644 --- a/include/ImagePool.h +++ b/include/ImagePool.h @@ -43,8 +43,6 @@ public: const std::vector& encrypted_attrs, const std::vector& inherit_attrs); - ~ImagePool() {}; - /** * Function to allocate a new Image object * @param uid the user id of the image's owner diff --git a/include/ImageTemplate.h b/include/ImageTemplate.h index fd28e9ae79..592d9d7555 100644 --- a/include/ImageTemplate.h +++ b/include/ImageTemplate.h @@ -29,8 +29,6 @@ public: ImageTemplate(const Template& tmpl):Template(tmpl) {}; - ~ImageTemplate() {}; - bool is_saving() { bool save_as_hot; diff --git a/include/InformationManager.h b/include/InformationManager.h index 91c932165d..72715d2cd1 100644 --- a/include/InformationManager.h +++ b/include/InformationManager.h @@ -39,8 +39,6 @@ public: { } - ~InformationManager() = default; - /** * This functions starts the associated listener thread, and creates a * new thread for the Information Manager. This thread will wait in diff --git a/include/LibVirtDriver.h b/include/LibVirtDriver.h index a8bb4ce8bf..d4b362ea19 100644 --- a/include/LibVirtDriver.h +++ b/include/LibVirtDriver.h @@ -31,8 +31,6 @@ public: : VirtualMachineManagerDriver(mad_location, attrs), emulator(emu) {} - ~LibVirtDriver() = default; - int validate_raw(const std::string& raw_section, std::string& error) const override; diff --git a/include/LifeCycleManager.h b/include/LifeCycleManager.h index 3dea6283d2..bbbb7e82bc 100644 --- a/include/LifeCycleManager.h +++ b/include/LifeCycleManager.h @@ -52,8 +52,6 @@ public: { }; - ~LifeCycleManager() = default; - /** * This functions starts a new thread for the Life-cycle Manager. This * thread will wait in an action loop till it receives ACTION_FINALIZE. diff --git a/include/Log.h b/include/Log.h index 457473d58b..50ec8b9161 100644 --- a/include/Log.h +++ b/include/Log.h @@ -114,8 +114,6 @@ public: const MessageType level = WARNING, std::ios_base::openmode mode = std::ios_base::app); - virtual ~FileLog(); - void log( const char * module, const MessageType type, @@ -138,8 +136,6 @@ public: { } - ~FileLogTS() = default; - void log( const char * module, const MessageType type, @@ -169,8 +165,6 @@ public: int oid, const PoolObjectSQL::ObjectType obj_type); - ~StdLog() {}; - void log( const char * module, const MessageType type, @@ -196,8 +190,6 @@ public: int oid, const PoolObjectSQL::ObjectType obj_type); - ~SysLog() {}; - void log( const char * module, const MessageType type, diff --git a/include/LogDB.h b/include/LogDB.h index 875424e589..3bb92e1bed 100644 --- a/include/LogDB.h +++ b/include/LogDB.h @@ -85,7 +85,10 @@ public: LogDB(SqlDB * _db, bool solo, bool cache, uint64_t log_retention, uint64_t limit_purge); - virtual ~LogDB(); + LogDB(const LogDB&) = delete; + LogDB& operator=(const LogDB&) = delete; + + ~LogDB() override; // ------------------------------------------------------------------------- // Interface to access Log records @@ -395,8 +398,6 @@ class FedLogDB: public SqlDB public: FedLogDB(LogDB *db):_logdb(db) {}; - virtual ~FedLogDB() {}; - int exec_wr(std::ostringstream& cmd) override; int exec_local_wr(std::ostringstream& cmd) override diff --git a/include/LoginToken.h b/include/LoginToken.h index 919d3369d2..f52c2d5e85 100644 --- a/include/LoginToken.h +++ b/include/LoginToken.h @@ -91,8 +91,6 @@ public: LoginToken():SessionToken(), egid(-1) {}; - virtual ~LoginToken() {}; - /** * Check if the token is valid (same as the one provided, and not expired) * @param utk provided by the user diff --git a/include/MarketPlace.h b/include/MarketPlace.h index 883f1b8595..253ccf26c8 100644 --- a/include/MarketPlace.h +++ b/include/MarketPlace.h @@ -78,8 +78,6 @@ public: return st; } - virtual ~MarketPlace() = default; - /** * Function to print the MarketPlace object into a string in XML format * @param xml the resulting XML string diff --git a/include/MarketPlaceApp.h b/include/MarketPlaceApp.h index 11eb7fd703..8e164649c8 100644 --- a/include/MarketPlaceApp.h +++ b/include/MarketPlaceApp.h @@ -127,8 +127,6 @@ public: */ static Type str_to_type(std::string& str_type); - virtual ~MarketPlaceApp() = default; - /** * Function to print the MarketPlaceApp object into a string in XML format * @param xml the resulting XML string diff --git a/include/MarketPlaceAppPool.h b/include/MarketPlaceAppPool.h index 9a51295f9f..70413b31a4 100644 --- a/include/MarketPlaceAppPool.h +++ b/include/MarketPlaceAppPool.h @@ -27,8 +27,6 @@ class MarketPlaceAppPool : public PoolSQL public: MarketPlaceAppPool(SqlDB * db):PoolSQL(db, one_db::mp_app_table) {}; - ~MarketPlaceAppPool() {}; - /* ---------------------------------------------------------------------- */ /* Methods for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/MarketPlaceAppTemplate.h b/include/MarketPlaceAppTemplate.h index 36297999ec..34fd193742 100644 --- a/include/MarketPlaceAppTemplate.h +++ b/include/MarketPlaceAppTemplate.h @@ -28,7 +28,6 @@ public: MarketPlaceAppTemplate(): Template(false, '=', "TEMPLATE") {}; - ~MarketPlaceAppTemplate() {}; }; /* -------------------------------------------------------------------------- */ diff --git a/include/MarketPlaceManager.h b/include/MarketPlaceManager.h index 4178c54d76..c18e4bd637 100644 --- a/include/MarketPlaceManager.h +++ b/include/MarketPlaceManager.h @@ -43,8 +43,6 @@ public: */ MarketPlaceManager(time_t t, time_t m, const std::string& _mad_location); - ~MarketPlaceManager() = default; - /** * Initializes internal pointers to other managers. Must be called when * all the other managers exist in Nebula::instance diff --git a/include/MarketPlacePool.h b/include/MarketPlacePool.h index d99f438daa..e149c68eb5 100644 --- a/include/MarketPlacePool.h +++ b/include/MarketPlacePool.h @@ -29,8 +29,6 @@ public: MarketPlacePool(SqlDB * db, bool is_federation_slave); - ~MarketPlacePool() {}; - /* ---------------------------------------------------------------------- */ /* Methods for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/MarketPlaceTemplate.h b/include/MarketPlaceTemplate.h index b0535da235..67f503d14c 100644 --- a/include/MarketPlaceTemplate.h +++ b/include/MarketPlaceTemplate.h @@ -28,7 +28,6 @@ public: MarketPlaceTemplate(): Template(false, '=', "TEMPLATE") {}; - ~MarketPlaceTemplate() {}; }; /* -------------------------------------------------------------------------- */ diff --git a/include/MySqlDB.h b/include/MySqlDB.h index ef57bbf258..85b8f7e5e2 100644 --- a/include/MySqlDB.h +++ b/include/MySqlDB.h @@ -50,7 +50,7 @@ public: int _connections, const std::string& _compare_binary); - ~MySqlDB(); + ~MySqlDB() override; /** * This function returns a legal SQL string that can be used in an SQL diff --git a/include/Nebula.h b/include/Nebula.h index 835396508b..c06fe79ea9 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -679,10 +679,11 @@ public: { }; - ~Nebula(); + ~Nebula() override; private: - Nebula& operator=(Nebula const&) = delete; + Nebula(const Nebula&) = delete; + Nebula& operator=(const Nebula&) = delete; // --------------------------------------------------------------- // Environment variables diff --git a/include/NebulaTemplate.h b/include/NebulaTemplate.h index 56ebf960bb..b56161dec0 100644 --- a/include/NebulaTemplate.h +++ b/include/NebulaTemplate.h @@ -45,8 +45,6 @@ public: } } - virtual ~NebulaTemplate() = default; - /** * Parse and loads the configuration in the template */ diff --git a/include/ObjectSQL.h b/include/ObjectSQL.h index f74e246144..144167c593 100644 --- a/include/ObjectSQL.h +++ b/include/ObjectSQL.h @@ -30,8 +30,6 @@ public: ObjectSQL() = default; - virtual ~ObjectSQL() = default; - protected: /** * Reads the ObjectSQL (identified with its OID) from the database. diff --git a/include/OpenNebulaTemplate.h b/include/OpenNebulaTemplate.h index cf43bf959b..334842d63d 100644 --- a/include/OpenNebulaTemplate.h +++ b/include/OpenNebulaTemplate.h @@ -36,8 +36,6 @@ public: var_location(_var_location) {}; - ~OpenNebulaTemplate() = default; - /** * Read or Generate the master key file to encrypt DB data when needed * this key is added to the configuration of OpenNebula and can be obtained diff --git a/include/Plan.h b/include/Plan.h index d6449b1690..b7b9e79a29 100644 --- a/include/Plan.h +++ b/include/Plan.h @@ -120,7 +120,7 @@ public: */ Plan(int cid):_cid(cid) {}; - ~Plan() + ~Plan() override { if (!ro && _mutex != nullptr) { diff --git a/include/PoolObjectSQL.h b/include/PoolObjectSQL.h index 0a3dcd8018..134983ce6f 100644 --- a/include/PoolObjectSQL.h +++ b/include/PoolObjectSQL.h @@ -192,7 +192,7 @@ public: { }; - virtual ~PoolObjectSQL() + ~PoolObjectSQL() override { if (!ro && _mutex != nullptr) { @@ -701,7 +701,7 @@ protected: * must be checked before * @param new_perm the new value. If it is -1, it will be ignored */ - void set_perm(int &perm, const int &new_perm) + static void set_perm(int &perm, const int &new_perm) { if ( new_perm != -1 ) { diff --git a/include/Quota.h b/include/Quota.h index 977ee90a23..466d470bc7 100644 --- a/include/Quota.h +++ b/include/Quota.h @@ -122,7 +122,7 @@ class QuotaDecorator : public QuotaInterface protected: QuotaDecorator(QuotaInterface * _quota):quota(_quota) {}; - virtual ~QuotaDecorator() {}; + ~QuotaDecorator() override = default; QuotaInterface * quota; }; @@ -201,7 +201,7 @@ protected: metrics(_metrics), is_default(_is_default) {}; - virtual ~Quota() {}; + ~Quota() override = default; /** * Generic Quota Names @@ -320,9 +320,9 @@ protected: * @param va_name name of the quota in the vector attribute * @param num value to add to the current quota; */ - void add_to_quota(VectorAttribute * attr, - const std::string& va_name, - float num); + static void add_to_quota(VectorAttribute * attr, + const std::string& va_name, + float num); /** * Sets new limit values for the quota diff --git a/include/QuotaDatastore.h b/include/QuotaDatastore.h index 51ce2aca4a..e317c7c946 100644 --- a/include/QuotaDatastore.h +++ b/include/QuotaDatastore.h @@ -43,8 +43,6 @@ public: is_default) {}; - ~QuotaDatastore() {}; - /** * Check if the resource allocation will exceed the quota limits. If not * the usage counters are updated diff --git a/include/QuotaImage.h b/include/QuotaImage.h index 170f7c3162..c51b8e2bdd 100644 --- a/include/QuotaImage.h +++ b/include/QuotaImage.h @@ -41,8 +41,6 @@ public: is_default) {}; - ~QuotaImage() {}; - /** * Check if the resource allocation will exceed the quota limits. If not * the usage counters are updated diff --git a/include/QuotaNetwork.h b/include/QuotaNetwork.h index dc4a8d83a6..d75f9c03f4 100644 --- a/include/QuotaNetwork.h +++ b/include/QuotaNetwork.h @@ -37,8 +37,6 @@ public: : Quota("NETWORK_QUOTA", "NETWORK", NET_METRICS, is_default) {} - virtual ~QuotaNetwork() {}; - /** * Check if the resource allocation will exceed the quota limits. If not * the usage counters are updated. Assumes calling object is a VM @@ -117,8 +115,6 @@ class QuotaNetworkVirtualRouter: public QuotaDecorator public: QuotaNetworkVirtualRouter(QuotaNetwork *qn):QuotaDecorator(qn) {}; - virtual ~QuotaNetworkVirtualRouter() {}; - bool check(Template* tmpl, Quotas& default_quotas, std::string& err) override { QuotaNetwork * qn = static_cast(quota); diff --git a/include/QuotaVirtualMachine.h b/include/QuotaVirtualMachine.h index fc1b5f9c87..af68bc4ca7 100644 --- a/include/QuotaVirtualMachine.h +++ b/include/QuotaVirtualMachine.h @@ -61,8 +61,6 @@ public: is_default) {}; - ~QuotaVirtualMachine() {}; - int get_quota(const std::string& id, VectorAttribute **va) override { std::map::iterator it; diff --git a/include/QuotasSQL.h b/include/QuotasSQL.h index ea61ac05ae..ccda936135 100644 --- a/include/QuotasSQL.h +++ b/include/QuotasSQL.h @@ -75,7 +75,7 @@ protected: ObjectSQL(), oid(-1) {}; - virtual ~QuotasSQL() {}; + ~QuotasSQL() override = default; virtual const char * table() const = 0; @@ -158,8 +158,6 @@ public: "/QUOTAS/IMAGE_QUOTA", "/QUOTAS/VM_QUOTA") {}; - virtual ~GroupQuotas() {}; - /** * Bootstraps the database table for group quotas * @return 0 on success diff --git a/include/RaftManager.h b/include/RaftManager.h index 2506a96ab3..3c7ee1a9ca 100644 --- a/include/RaftManager.h +++ b/include/RaftManager.h @@ -456,7 +456,7 @@ private: /** * Init the raft state status row. */ - int init_raft_state(const std::string& raft_xml); + static int init_raft_state(const std::string& raft_xml); }; #endif /*RAFT_MANAGER_H_*/ diff --git a/include/ReplicaManager.h b/include/ReplicaManager.h index 81fa83fbac..92406e088b 100644 --- a/include/ReplicaManager.h +++ b/include/ReplicaManager.h @@ -98,8 +98,6 @@ class RaftReplicaManager : public ReplicaManager public: RaftReplicaManager():ReplicaManager() {}; - virtual ~RaftReplicaManager() {}; - private: ReplicaThread * thread_factory(int follower_id) override; }; @@ -109,8 +107,6 @@ class HeartBeatManager : public ReplicaManager public: HeartBeatManager():ReplicaManager() {}; - virtual ~HeartBeatManager() {}; - private: ReplicaThread * thread_factory(int follower_id) override; }; diff --git a/include/ReplicaRequest.h b/include/ReplicaRequest.h index acfbfbb4b6..0e9a57183d 100644 --- a/include/ReplicaRequest.h +++ b/include/ReplicaRequest.h @@ -29,8 +29,6 @@ class ReplicaRequest : public SyncRequest public: ReplicaRequest(uint64_t i):_index(i), _to_commit(-1), _replicas(1) {}; - ~ReplicaRequest() {}; - /** * This function updates the number of replicas of the record and decrement * the number of servers left to reach majority consensus. If it reaches 0, diff --git a/include/ReplicaThread.h b/include/ReplicaThread.h index 1b747acf0a..7f95154a23 100644 --- a/include/ReplicaThread.h +++ b/include/ReplicaThread.h @@ -100,8 +100,6 @@ class RaftReplicaThread : public ReplicaThread public: RaftReplicaThread(int follower_id); - virtual ~RaftReplicaThread() {}; - private: /** * Specific logic for the replicate process @@ -127,8 +125,6 @@ class FedReplicaThread : public ReplicaThread public: FedReplicaThread(int zone_id); - virtual ~FedReplicaThread() {}; - private: /** * Specific logic for the replicate process @@ -149,8 +145,6 @@ class HeartBeatThread : public ReplicaThread public: HeartBeatThread(int follower_id); - virtual ~HeartBeatThread() {}; - private: /** * Error statistics for follower diff --git a/include/Request.h b/include/Request.h index 005f4c441b..84aaa808d8 100644 --- a/include/Request.h +++ b/include/Request.h @@ -219,7 +219,7 @@ protected: /* ---------------------------------------------------------------------- */ template - void make_parameter(std::ostringstream& oss, int pos, const T& val) + static void make_parameter(std::ostringstream& oss, int pos, const T& val) { oss << "" << "" << pos << "" diff --git a/include/SchedulerManager.h b/include/SchedulerManager.h index 5a9121311f..9fb886869f 100644 --- a/include/SchedulerManager.h +++ b/include/SchedulerManager.h @@ -38,8 +38,6 @@ public: SchedulerManager( time_t wtime, unsigned int wlength, time_t retry, const std::string& mad_location); - virtual ~SchedulerManager() = default; - /** * This functions starts the associated listener thread, and creates a * new thread for the Scheduler Manager. This thread will wait in @@ -123,12 +121,12 @@ private: /** * */ - void _place(std::unique_ptr msg); + static void _place(std::unique_ptr msg); /** * */ - void _optimize(std::unique_ptr msg); + static void _optimize(std::unique_ptr msg); /** * diff --git a/include/SecurityGroup.h b/include/SecurityGroup.h index 4db708c0fb..8d19368654 100644 --- a/include/SecurityGroup.h +++ b/include/SecurityGroup.h @@ -27,8 +27,6 @@ class SecurityGroup : public PoolObjectSQL { public: - virtual ~SecurityGroup() = default; - /** * Function to print the SecurityGroup object into a string in XML format * @param xml the resulting XML string diff --git a/include/SecurityGroupPool.h b/include/SecurityGroupPool.h index 95e3d314b1..09fdf1293d 100644 --- a/include/SecurityGroupPool.h +++ b/include/SecurityGroupPool.h @@ -27,8 +27,6 @@ class SecurityGroupPool : public PoolSQL public: SecurityGroupPool(SqlDB * db); - ~SecurityGroupPool() {}; - /* ---------------------------------------------------------------------- */ /* Methods for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/SqliteDB.h b/include/SqliteDB.h index 5831a3ee84..000a9623f7 100644 --- a/include/SqliteDB.h +++ b/include/SqliteDB.h @@ -39,7 +39,7 @@ public: SqliteDB(const std::string& db_name, int timeout); - ~SqliteDB(); + ~SqliteDB() override; /** * This function returns a legal SQL string that can be used in an SQL diff --git a/include/StringBuffer.h b/include/StringBuffer.h index ffecce371e..76b11fafa3 100644 --- a/include/StringBuffer.h +++ b/include/StringBuffer.h @@ -36,6 +36,9 @@ public: memset(static_cast(buffer), 0, STRING_BUFFER_SIZE); } + StringBuffer(const StringBuffer&) = delete; + StringBuffer& operator=(const StringBuffer&) = delete; + ~StringBuffer() { free(buffer); diff --git a/include/SyncRequest.h b/include/SyncRequest.h index 234dca1910..256124e653 100644 --- a/include/SyncRequest.h +++ b/include/SyncRequest.h @@ -38,8 +38,6 @@ public: { } - virtual ~SyncRequest() = default; - /** * The result of the request, true if the operation succeeded */ diff --git a/include/SystemDB.h b/include/SystemDB.h index 8f1f45b6d7..887313cad6 100644 --- a/include/SystemDB.h +++ b/include/SystemDB.h @@ -70,7 +70,7 @@ private: SystemDB(SqlDB *_db):db(_db) {}; - ~SystemDB() {}; + ~SystemDB() override = default; // Pool control table static const char * pc_names; diff --git a/include/Template.h b/include/Template.h index 1c6f96229b..dc7b938bb9 100644 --- a/include/Template.h +++ b/include/Template.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -414,7 +415,8 @@ public: inline VectorAttribute * get(std::string_view name) { - return __get(name); + // Const cast to be able to reuse const method + return const_cast(std::as_const(*this).get(name)); } /** @@ -531,7 +533,7 @@ protected: * * @return the attribute, or 0 if the node doesn't contain a single att. */ - Attribute* single_xml_att(const xmlNode * node); + static Attribute* single_xml_att(const xmlNode * node); /** * Builds a VectorAttribute from the given node @@ -539,7 +541,7 @@ protected: * * @return the attribute, or 0 if the node doesn't contain a vector att. */ - Attribute* vector_xml_att(const xmlNode * node); + static Attribute* vector_xml_att(const xmlNode * node); /** * Parses a list of restricted attributes in the form ATTRIBUTE_NAME or @@ -709,13 +711,6 @@ private: return nullptr; } - - template - T * __get(const K& s) - { - return const_cast( - static_cast(*this).__get(s)); - } }; /* -------------------------------------------------------------------------- */ diff --git a/include/TransferManager.h b/include/TransferManager.h index a8d6f24d58..74d5825a7d 100644 --- a/include/TransferManager.h +++ b/include/TransferManager.h @@ -47,8 +47,6 @@ public: { }; - ~TransferManager() = default; - /** * This functions starts the associated listener thread, and creates a * new thread for the Information Manager. This thread will wait in diff --git a/include/User.h b/include/User.h index 65977852b8..5ec391999c 100644 --- a/include/User.h +++ b/include/User.h @@ -35,8 +35,6 @@ class User : public PoolObjectSQL { public: - virtual ~User() = default; - /** * Characters that can not be in a name */ diff --git a/include/UserPool.h b/include/UserPool.h index 7f06a6db8d..f6c7071a61 100644 --- a/include/UserPool.h +++ b/include/UserPool.h @@ -43,8 +43,6 @@ public: const std::vector& restricted_attrs, const std::vector& encrypted_attrs); - ~UserPool() = default; - /** * Function to allocate a new User object * @param oid the id assigned to the User @@ -116,7 +114,7 @@ public: */ std::unique_ptr get(const std::string& name) { - // The owner is set to -1, because it is not used in the key() method + // Look up the user by name alone. auto u = PoolSQL::get(name, -1); if (u) @@ -135,7 +133,7 @@ public: */ std::unique_ptr get_ro(const std::string& name) { - // The owner is set to -1, because it is not used in the key() method + // Look up the user by name alone. auto u = PoolSQL::get_ro(name, -1); if (u) diff --git a/include/UserTemplate.h b/include/UserTemplate.h index 63153f3f47..6e1f12dfdd 100644 --- a/include/UserTemplate.h +++ b/include/UserTemplate.h @@ -27,8 +27,6 @@ class UserTemplate : public Template public: UserTemplate() : Template(true, '=', "TEMPLATE") {} - ~UserTemplate() = default; - // ------------------------------------------------------------------------- // Restricted attributes interface implementation // ------------------------------------------------------------------------- diff --git a/include/VMActions.h b/include/VMActions.h index 151672dde9..ae7e1f78e5 100644 --- a/include/VMActions.h +++ b/include/VMActions.h @@ -154,8 +154,8 @@ private: /** * Returns action set from a string of actions seperated by commas */ - int set_auth_ops(const std::string& ops_str, - ActionSet& ops_set, std::string& error); + static int set_auth_ops(const std::string& ops_str, + ActionSet& ops_set, std::string& error); }; #endif /*VMACTIONS_H*/ diff --git a/include/VMGroup.h b/include/VMGroup.h index a3401740a0..91a4befaf2 100644 --- a/include/VMGroup.h +++ b/include/VMGroup.h @@ -51,8 +51,6 @@ enum class VMGroupPolicy; class VMGroup : public PoolObjectSQL { public: - virtual ~VMGroup() = default; - /** * Function to print the VMGroup object into a string in XML format * @param xml the resulting XML string diff --git a/include/VMGroupPool.h b/include/VMGroupPool.h index d650095d13..ee25610b6e 100644 --- a/include/VMGroupPool.h +++ b/include/VMGroupPool.h @@ -28,8 +28,6 @@ class VMGroupPool : public PoolSQL public: VMGroupPool(SqlDB * db):PoolSQL(db, one_db::vm_group_table) {}; - ~VMGroupPool() {}; - /* ---------------------------------------------------------------------- */ /* Methods for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/VMTemplate.h b/include/VMTemplate.h index 0ff891b7d3..c239fbb5f5 100644 --- a/include/VMTemplate.h +++ b/include/VMTemplate.h @@ -30,8 +30,6 @@ class VMTemplate : public PoolObjectSQL { public: - virtual ~VMTemplate() = default; - /** * Function to print the VMTemplate object into a string in XML format * @param xml the resulting XML string diff --git a/include/VMTemplatePool.h b/include/VMTemplatePool.h index 66d7d361e7..58da486521 100644 --- a/include/VMTemplatePool.h +++ b/include/VMTemplatePool.h @@ -30,8 +30,6 @@ public: VMTemplatePool(SqlDB * db) : PoolSQL(db, one_db::vm_template_table) {}; - ~VMTemplatePool() {}; - /** * Allocates a new object, writting it in the pool database. No memory is * allocated for the object. diff --git a/include/VNTemplate.h b/include/VNTemplate.h index 0c2060adb3..bbb786b7c3 100644 --- a/include/VNTemplate.h +++ b/include/VNTemplate.h @@ -30,8 +30,6 @@ class VNTemplate : public PoolObjectSQL { public: - virtual ~VNTemplate() = default; - /** * Function to print the VNTemplate object into a string in XML format * @param xml the resulting XML string diff --git a/include/VNTemplatePool.h b/include/VNTemplatePool.h index b462560b08..18231832ad 100644 --- a/include/VNTemplatePool.h +++ b/include/VNTemplatePool.h @@ -30,8 +30,6 @@ public: VNTemplatePool(SqlDB * db) : PoolSQL(db, one_db::vn_template_table) {}; - ~VNTemplatePool() {}; - /** * Allocates a new object, writting it in the pool database. No memory is * allocated for the object. diff --git a/include/Vdc.h b/include/Vdc.h index d4f434ec66..6929190a2a 100644 --- a/include/Vdc.h +++ b/include/Vdc.h @@ -155,8 +155,6 @@ class Vdc : public PoolObjectSQL { public: - virtual ~Vdc() = default; - /** * Function to print the Vdc object into a string in XML format * @param xml the resulting XML string diff --git a/include/VdcPool.h b/include/VdcPool.h index 67a78be6ca..4ab453585d 100644 --- a/include/VdcPool.h +++ b/include/VdcPool.h @@ -28,8 +28,6 @@ public: VdcPool(SqlDB * db, bool is_federation_slave); - ~VdcPool() {}; - /* ---------------------------------------------------------------------- */ /* Methods for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index e100852966..173b0ab072 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -161,7 +161,10 @@ public: static std::string& lcm_state_to_str(std::string& st, LcmState state); - virtual ~VirtualMachine(); + VirtualMachine(const VirtualMachine&) = delete; + VirtualMachine& operator=(const VirtualMachine&) = delete; + + ~VirtualMachine() override; /** * Returns the VM state to string, using the lcm state if the current state diff --git a/include/VirtualMachineAttribute.h b/include/VirtualMachineAttribute.h index 14f43f406d..96818c12fe 100644 --- a/include/VirtualMachineAttribute.h +++ b/include/VirtualMachineAttribute.h @@ -41,7 +41,7 @@ protected: VirtualMachineAttribute(VectorAttribute *_va, int _id): ExtendedAttribute(_va, _id) {}; - virtual ~VirtualMachineAttribute() {}; + ~VirtualMachineAttribute() override = default; /* ---------------------------------------------------------------------- */ /* VirtualMachineAttribute Interface */ @@ -88,7 +88,7 @@ protected: */ VirtualMachineAttributeSet(bool _dispose):ExtendedAttributeSet(_dispose) {}; - virtual ~VirtualMachineAttributeSet() {}; + ~VirtualMachineAttributeSet() override = default; /* ---------------------------------------------------------------------- */ /* Methods to access attributes */ diff --git a/include/VirtualMachineDisk.h b/include/VirtualMachineDisk.h index 468ee1a1d9..1a7cf6458a 100644 --- a/include/VirtualMachineDisk.h +++ b/include/VirtualMachineDisk.h @@ -37,7 +37,10 @@ public: VirtualMachineDisk(VectorAttribute *va, int id): VirtualMachineAttribute(va, id), snapshots(0) {}; - virtual ~VirtualMachineDisk() + VirtualMachineDisk(const VirtualMachineDisk&) = delete; + VirtualMachineDisk& operator=(const VirtualMachineDisk&) = delete; + + ~VirtualMachineDisk() override { delete snapshots; }; @@ -452,8 +455,6 @@ public: VirtualMachineDisks(bool dispose): VirtualMachineAttributeSet(dispose) {}; - virtual ~VirtualMachineDisks() {}; - /** * Function used to initialize the attribute map based on a vector of DISK */ @@ -903,7 +904,7 @@ private: * with its bus (DEV_PREFIX) * @param used_targets that cannot be used */ - void assign_disk_targets( + static void assign_disk_targets( std::queue >& dqueue, std::set& used_targets); }; diff --git a/include/VirtualMachineManager.h b/include/VirtualMachineManager.h index e45db8f4f1..6ff83bac82 100644 --- a/include/VirtualMachineManager.h +++ b/include/VirtualMachineManager.h @@ -38,8 +38,6 @@ public: VirtualMachineManager( const std::string& _mads); - ~VirtualMachineManager() = default; - /** * This functions starts the associated listener thread, and creates a * new thread for the Virtual Machine Manager. This thread will wait in @@ -201,7 +199,7 @@ private: /** * */ - void _checkpoint(std::unique_ptr msg); + static void _checkpoint(std::unique_ptr msg); /** * @@ -281,7 +279,7 @@ private: /** * */ - void _driver_cancel(std::unique_ptr msg); + static void _driver_cancel(std::unique_ptr msg); /** * @@ -316,9 +314,9 @@ private: /** * */ - void log_error(VirtualMachine* vm_id, - const std::string& payload, - const std::string& msg); + static void log_error(VirtualMachine* vm, + const std::string& payload, + const std::string& msg); /** * diff --git a/include/VirtualMachineNic.h b/include/VirtualMachineNic.h index 93937ca195..6d6b850599 100644 --- a/include/VirtualMachineNic.h +++ b/include/VirtualMachineNic.h @@ -31,8 +31,6 @@ public: VirtualMachineNic(VectorAttribute *va, int id): VirtualMachineAttribute(va, id) {}; - virtual ~VirtualMachineNic() {}; - /* ---------------------------------------------------------------------- */ /* DISK get/set functions for boolean disk flags */ /* ATTACH */ @@ -316,8 +314,6 @@ public: VirtualMachineNics(bool dispose): VirtualMachineAttributeSet(dispose) {}; - virtual ~VirtualMachineNics() {}; - /** * Function used to initialize the attribute map based on a vector of NIC */ diff --git a/include/VirtualMachinePool.h b/include/VirtualMachinePool.h index 1d4433c091..4099188853 100644 --- a/include/VirtualMachinePool.h +++ b/include/VirtualMachinePool.h @@ -39,8 +39,6 @@ public: float default_disk_cost, bool showback_only_running); - ~VirtualMachinePool() {}; - /** * Function to allocate a new VM object * @param uid user id (the owner of the VM) diff --git a/include/VirtualMachineTemplate.h b/include/VirtualMachineTemplate.h index cd969fca2b..c5f117c3e5 100644 --- a/include/VirtualMachineTemplate.h +++ b/include/VirtualMachineTemplate.h @@ -36,8 +36,6 @@ public: const char * _xml_root): Template(_replace_mode, _separator, _xml_root) {}; - ~VirtualMachineTemplate() {}; - VirtualMachineTemplate(const Template& vmt):Template(vmt) {}; VirtualMachineTemplate(const VirtualMachineTemplate& t) = default; diff --git a/include/VirtualNetwork.h b/include/VirtualNetwork.h index b4a9c63744..e5268b3ec9 100644 --- a/include/VirtualNetwork.h +++ b/include/VirtualNetwork.h @@ -242,8 +242,6 @@ public: // Virtual Network Public Methods // ************************************************************************* - virtual ~VirtualNetwork() = default; - /** * Return state of Virtual Network */ diff --git a/include/VirtualNetworkPool.h b/include/VirtualNetworkPool.h index 8eefec32fe..f64ff43ba8 100644 --- a/include/VirtualNetworkPool.h +++ b/include/VirtualNetworkPool.h @@ -44,8 +44,6 @@ public: const VectorAttribute * vlan_conf, const VectorAttribute * vxlan_conf); - ~VirtualNetworkPool() {}; - //-------------------------------------------------------------------------- // Virtual Network DB access functions //-------------------------------------------------------------------------- diff --git a/include/VirtualNetworkTemplate.h b/include/VirtualNetworkTemplate.h index 3dbf2650de..2e9f436caf 100644 --- a/include/VirtualNetworkTemplate.h +++ b/include/VirtualNetworkTemplate.h @@ -32,8 +32,6 @@ public: const char * xml_root) : Template(replace_mode, separator, xml_root) {} - ~VirtualNetworkTemplate() {}; - VirtualNetworkTemplate(const Template& vnt):Template(vnt) {}; // ------------------------------------------------------------------------- diff --git a/include/VirtualRouter.h b/include/VirtualRouter.h index 512916e2a2..df169117fe 100644 --- a/include/VirtualRouter.h +++ b/include/VirtualRouter.h @@ -35,8 +35,6 @@ class VirtualRouter : public PoolObjectSQL { public: - virtual ~VirtualRouter() = default; - /** * Function to print the VirtualRouter object into a string in XML format * @param xml the resulting XML string diff --git a/include/VirtualRouterPool.h b/include/VirtualRouterPool.h index 43db448626..9830cd787d 100644 --- a/include/VirtualRouterPool.h +++ b/include/VirtualRouterPool.h @@ -30,8 +30,6 @@ public: VirtualRouterPool(SqlDB * db) : PoolSQL(db, one_db::vr_table) {}; - ~VirtualRouterPool() {}; - /** * Allocates a new object, writing it in the pool database. No memory is * allocated for the object. diff --git a/include/XMLDriver.h b/include/XMLDriver.h index 2a0df8766d..7a4af8a3c1 100644 --- a/include/XMLDriver.h +++ b/include/XMLDriver.h @@ -34,8 +34,6 @@ public: VirtualMachineManagerDriver(mad_location, attrs) {} - ~XMLDriver() = default; - private: /** * Generates a neutral XML deployment file: diff --git a/include/XenDriver.h b/include/XenDriver.h index 03764f2b9c..4114bd754b 100644 --- a/include/XenDriver.h +++ b/include/XenDriver.h @@ -34,8 +34,6 @@ public: VirtualMachineManagerDriver(mad_location, attrs) {} - ~XenDriver() = default; - private: /** * Generates a xen-specific deployment file seexmdomain.cfg(5): diff --git a/include/Zone.h b/include/Zone.h index d9fa2c6100..0cde63b608 100644 --- a/include/Zone.h +++ b/include/Zone.h @@ -76,7 +76,10 @@ public: return st; } - virtual ~Zone(); + Zone(const Zone&) = delete; + Zone& operator=(const Zone&) = delete; + + ~Zone() override; /** * Function to print the Zone object into a string in XML format diff --git a/include/ZonePool.h b/include/ZonePool.h index 2f05d55b12..e1128e3b4f 100644 --- a/include/ZonePool.h +++ b/include/ZonePool.h @@ -28,8 +28,6 @@ public: ZonePool(SqlDB * db, bool is_federation_slave); - ~ZonePool() {}; - /* ---------------------------------------------------------------------- */ /* Methods for DB management */ /* ---------------------------------------------------------------------- */ diff --git a/include/ZoneServer.h b/include/ZoneServer.h index 0d59295698..7007b9c5f6 100644 --- a/include/ZoneServer.h +++ b/include/ZoneServer.h @@ -28,8 +28,6 @@ public: ZoneServer(VectorAttribute *va, int id):ExtendedAttribute(va, id) {}; - virtual ~ZoneServer() {}; - /** * Initialized server metadata: * - NAME @@ -116,8 +114,6 @@ public: , next_id(-1) {} - virtual ~ZoneServers() = default; - /* ---------------------------------------------------------------------- */ /* Iterators */ /* ---------------------------------------------------------------------- */ @@ -126,8 +122,6 @@ public: public: ZoneIterator():AttributeIterator() {}; ZoneIterator(const AttributeIterator& dit):AttributeIterator(dit) {}; - virtual ~ZoneIterator() {}; - ZoneServer * operator*() const { return static_cast(map_it->second); diff --git a/share/smoke_tests/config/cppcheck-suppressions.xml b/share/smoke_tests/config/cppcheck-suppressions.xml index 0f6ca1b678..7ce53a2ab0 100644 --- a/share/smoke_tests/config/cppcheck-suppressions.xml +++ b/share/smoke_tests/config/cppcheck-suppressions.xml @@ -1,4 +1,21 @@ + + + ignoredReturnValue + *.* + one_util::tolower + + + + constParameterCallback + *.* + + + + unmatchedSuppression + *.* + variableScope diff --git a/share/smoke_tests/tests/05-astyle.sh b/share/smoke_tests/disabled_tests/05-astyle.sh similarity index 100% rename from share/smoke_tests/tests/05-astyle.sh rename to share/smoke_tests/disabled_tests/05-astyle.sh diff --git a/share/smoke_tests/tests/04-cppcheck.sh b/share/smoke_tests/tests/04-cppcheck.sh index 45c4feff9e..6f93a4c7a5 100755 --- a/share/smoke_tests/tests/04-cppcheck.sh +++ b/share/smoke_tests/tests/04-cppcheck.sh @@ -19,6 +19,6 @@ DEFINES="-DSQLITE_DB -DMYSQL_DB -DSYSTEMD" ENABLE="--enable=performance,information,warning,portability,style,missingInclude" IGNORE="-i .xmlrpc_test/ -i src/sunstone/ -i src/svncterm_server/ -i src/fireedge -i src/parsers -i src/vmm/LibVirtDriverKVM.cc -i src/rm/grpc/src" SUPRESS="--inline-suppr --suppress-xml=share/smoke_tests/config/cppcheck-suppressions.xml" -OTHERS="--std=c++17 --error-exitcode=2 -q -j 4" +OTHERS="--std=c++17 --check-level=exhaustive --error-exitcode=2 -q -j 4" cppcheck $SOURCES $INCLUDES $DEFINES $IGNORE $ENABLE $SUPRESS $OTHERS diff --git a/src/acl/AclManager.cc b/src/acl/AclManager.cc index 7ff760f1cf..56294b9104 100644 --- a/src/acl/AclManager.cc +++ b/src/acl/AclManager.cc @@ -384,7 +384,7 @@ bool AclManager::authorize( bool AclManager::oneadmin_authorize( const PoolObjectAuth& obj_perms, - AuthRequest::Operation op) const + AuthRequest::Operation op) { if (op & 0x10LL) //No lockable object { diff --git a/src/common/NebulaUtil.cc b/src/common/NebulaUtil.cc index d8473f695b..c28f58c199 100644 --- a/src/common/NebulaUtil.cc +++ b/src/common/NebulaUtil.cc @@ -472,7 +472,7 @@ string one_util::uuid() // Generate from random numbers to avoid adding a dependency ostringstream oss; - oss.fill('0'); + oss << std::setfill('0'); oss << hex << setw(4) << random() << setw(4) << random() diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc index 23e6119fdf..c69e896c61 100644 --- a/src/dm/DispatchManagerActions.cc +++ b/src/dm/DispatchManagerActions.cc @@ -192,7 +192,6 @@ void DispatchManager::free_vm_resources(unique_ptr vm, int vmid; int uid; int gid; - string deploy_id; int vrid = -1; VirtualMachineTemplate quota_tmpl; diff --git a/src/hm/HookLog.cc b/src/hm/HookLog.cc index 83718d56ea..2b62b564bc 100644 --- a/src/hm/HookLog.cc +++ b/src/hm/HookLog.cc @@ -150,8 +150,6 @@ int HookLog::add(int hkid, int hkrc, const std::string &xml_result) char * sql_xml; - std::string xml_body; - cb.set_callback(&query_output); oss << "SELECT coalesce(MAX(exeid), -1), COUNT(*) FROM " << one_db::hook_log_table << " WHERE hkid = " << hkid; diff --git a/src/hm/HookManager.cc b/src/hm/HookManager.cc index d0b6c279bd..db9659fc45 100644 --- a/src/hm/HookManager.cc +++ b/src/hm/HookManager.cc @@ -32,10 +32,10 @@ int HookManager::start() &HookManager::_undefined); register_action(HookManagerMessages::EXECUTE, - bind(&HookManager::_execute, this, _1)); + &HookManager::_execute); register_action(HookManagerMessages::RETRY, - bind(&HookManager::_retry, this, _1)); + &HookManager::_retry); register_action(HookManagerMessages::LOG, &HookManager::_log); diff --git a/src/host/HostSharePCI.cc b/src/host/HostSharePCI.cc index e312d507ea..450ea2027e 100644 --- a/src/host/HostSharePCI.cc +++ b/src/host/HostSharePCI.cc @@ -83,7 +83,7 @@ void HostSharePCI::init() /* Function to test PCI availability at the host */ /* -------------------------------------------------------------------------- */ -bool HostSharePCI::is_allocatable(const PCIDevice* pci) const +bool HostSharePCI::is_allocatable(const PCIDevice* pci) { return pci->vmid == -1 && pci->attrs->vector_value("PASSTHROUGH") != "NO"; diff --git a/src/image/ImageManagerActions.cc b/src/image/ImageManagerActions.cc index 928eab5814..324c4d09ff 100644 --- a/src/image/ImageManagerActions.cc +++ b/src/image/ImageManagerActions.cc @@ -786,7 +786,6 @@ int ImageManager::clone_image(int new_id, ostringstream oss; - string path; string img_tmpl; if ( imd == nullptr ) diff --git a/src/ipamm/IPAMManager.cc b/src/ipamm/IPAMManager.cc index 219406b5ea..1f88c32268 100644 --- a/src/ipamm/IPAMManager.cc +++ b/src/ipamm/IPAMManager.cc @@ -49,10 +49,10 @@ int IPAMManager::start() bind(&IPAMManager::_notify_request, this, _1)); register_action(IPAMManagerMessages::VNET_CREATE, - bind(&IPAMManager::_vnet_create, this, _1)); + &IPAMManager::_vnet_create); register_action(IPAMManagerMessages::VNET_DELETE, - bind(&IPAMManager::_vnet_delete, this, _1)); + &IPAMManager::_vnet_delete); register_action(IPAMManagerMessages::LOG, &IPAMManager::_log); diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 7f6d8824b6..bb84f06d29 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -32,8 +32,6 @@ void LifeCycleManager::trigger_deploy(int vid) { trigger([this, vid] { - ostringstream os; - auto vm = vmpool->get(vid); if ( vm == nullptr ) @@ -397,8 +395,6 @@ void LifeCycleManager::trigger_live_migrate(int vid, const RequestAttributes& ra trigger([this, vid, uid, gid, req_id] { - ostringstream os; - auto vm = vmpool->get(vid); if ( vm == nullptr ) @@ -780,8 +776,6 @@ void LifeCycleManager::trigger_restore(int vid, const RequestAttributes& ra) trigger([this, vid, uid, gid, req_id] { - ostringstream os; - auto vm = vmpool->get(vid); if ( vm == nullptr ) diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 37f601aceb..17d6820d4f 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -167,8 +167,6 @@ void LifeCycleManager::trigger_save_success(int vid) { trigger([this, vid] { - ostringstream os; - auto vm = vmpool->get(vid); if ( vm == nullptr ) @@ -666,7 +664,6 @@ void LifeCycleManager::trigger_prolog_success(int vid) trigger([this, vid] { time_t the_time = time(0); - ostringstream os; auto vm = vmpool->get(vid); @@ -1268,7 +1265,6 @@ void LifeCycleManager::trigger_monitor_poweron(int vid) vm->get_state() == VirtualMachine::SUSPENDED ) { VirtualMachineTemplate quota_tmpl; - string error; time_t the_time = time(0); diff --git a/src/log/Log.cc b/src/log/Log.cc index 476f688ca5..6c5e424e19 100644 --- a/src/log/Log.cc +++ b/src/log/Log.cc @@ -59,11 +59,6 @@ FileLog::FileLog(const string& file_name, /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ -FileLog::~FileLog() { } - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - void FileLog::log( const char * module, const MessageType type, diff --git a/src/monitor/include/BaseObject.h b/src/monitor/include/BaseObject.h index 4c226cff1d..d374dde4e5 100644 --- a/src/monitor/include/BaseObject.h +++ b/src/monitor/include/BaseObject.h @@ -33,8 +33,6 @@ public: { } - virtual ~BaseObject() = default; - int oid() const { return _oid; diff --git a/src/monitor/include/MonitorConfigTemplate.h b/src/monitor/include/MonitorConfigTemplate.h index ed0cb26237..a832073df3 100644 --- a/src/monitor/include/MonitorConfigTemplate.h +++ b/src/monitor/include/MonitorConfigTemplate.h @@ -28,8 +28,6 @@ public: NebulaTemplate(etc, filename.c_str(), "MONITOR_CONFIGURATION") {}; - ~MonitorConfigTemplate() = default; - private: /** * Sets the defaults value for the template diff --git a/src/monitor/include/MonitorDriver.h b/src/monitor/include/MonitorDriver.h index 5586d5dc51..f049929ad7 100644 --- a/src/monitor/include/MonitorDriver.h +++ b/src/monitor/include/MonitorDriver.h @@ -84,7 +84,7 @@ public: private: - std::string format_message(const std::string& value) const + static std::string format_message(const std::string& value) { return "" + value + ""; } diff --git a/src/monitor/include/OneMonitorDriver.h b/src/monitor/include/OneMonitorDriver.h index 2d9183c116..05ec4cc669 100644 --- a/src/monitor/include/OneMonitorDriver.h +++ b/src/monitor/include/OneMonitorDriver.h @@ -36,19 +36,19 @@ public: * @param oid host id * @param state for the host */ - void host_state(int oid, const std::string& state); + static void host_state(int oid, const std::string& state); /** * Send a VM state message to oned * @param oid host id * @param state for the host */ - void vm_state(int oid, const std::string& state); + static void vm_state(int oid, const std::string& state); /** * Send a message with the VM command execution result to oned */ - void vm_exec(int oid, const std::string& qemu_ga_exec); + static void vm_exec(int oid, const std::string& qemu_ga_exec); /** * Send host system information to oned @@ -56,7 +56,7 @@ public: * @param status result of the system monitor * @param payload system data */ - void host_system_info(int oid, const std::string& status, const std::string& payload); + static void host_system_info(int oid, const std::string& status, const std::string& payload); private: //-------------------------------------------------------------------------- diff --git a/src/monitor/include/TCPMonitorDriver.h b/src/monitor/include/TCPMonitorDriver.h index 480be3b683..8232083a3f 100644 --- a/src/monitor/include/TCPMonitorDriver.h +++ b/src/monitor/include/TCPMonitorDriver.h @@ -50,7 +50,6 @@ public: &MonitorDriverProtocol::_exec_vm); }; - ~TCPMonitorDriver() = default; }; #endif // TCP_MONITOR_DRIVER_H_ diff --git a/src/monitor/include/TCPStream.h b/src/monitor/include/TCPStream.h index 6dca84d762..7fbac60f06 100644 --- a/src/monitor/include/TCPStream.h +++ b/src/monitor/include/TCPStream.h @@ -54,8 +54,6 @@ public: { } - virtual ~TCPStream() = default; - /** * This functions initializes the UDP socket for the stream. It must be * called once before using the streamer @@ -240,7 +238,7 @@ int TCPStream line.clear(); - int sd = accept(_socket, (struct sockaddr *) &addr, &addr_size); + int sd = accept(_socket, reinterpret_cast(&addr), &addr_size); if ( sd == -1 ) { diff --git a/src/monitor/include/UDPMonitorDriver.h b/src/monitor/include/UDPMonitorDriver.h index 2b2d726ab2..c6e2270f83 100644 --- a/src/monitor/include/UDPMonitorDriver.h +++ b/src/monitor/include/UDPMonitorDriver.h @@ -50,7 +50,6 @@ public: &MonitorDriverProtocol::_exec_vm); }; - ~UDPMonitorDriver() = default; }; #endif // UDP_MONITOR_DRIVER_H_ diff --git a/src/monitor/include/UDPStream.h b/src/monitor/include/UDPStream.h index e79e50e2ba..79114a4af2 100644 --- a/src/monitor/include/UDPStream.h +++ b/src/monitor/include/UDPStream.h @@ -54,8 +54,6 @@ public: { } - virtual ~UDPStream() = default; - /** * This functions initializes the UDP socket for the stream. It must be * called once before using the streamer @@ -194,7 +192,7 @@ int UDPStream socklen_t addr_size = sizeof(struct sockaddr_storage); ssize_t rc = recvfrom(_socket, buffer, MESSAGE_SIZE, 0, - (struct sockaddr *) &addr, &addr_size); + reinterpret_cast(&addr), &addr_size); if (rc > 0 && rc < MESSAGE_SIZE) { diff --git a/src/monitor/include/VirtualMachineBase.h b/src/monitor/include/VirtualMachineBase.h index eb56807741..a31331db62 100644 --- a/src/monitor/include/VirtualMachineBase.h +++ b/src/monitor/include/VirtualMachineBase.h @@ -45,8 +45,6 @@ public: init_attributes(); } - virtual ~VirtualMachineBase() = default; - /** * Rebuilds the object from an xml formatted string * @param xml_str The xml-formatted string diff --git a/src/monitor/src/monitor/onemonitord.cc b/src/monitor/src/monitor/onemonitord.cc index ede620eff1..a18288a163 100644 --- a/src/monitor/src/monitor/onemonitord.cc +++ b/src/monitor/src/monitor/onemonitord.cc @@ -15,6 +15,7 @@ /* -------------------------------------------------------------------------- */ #include +#include #include #include "Monitor.h" @@ -94,17 +95,15 @@ int main(int argc, char **argv) int _argc = _argv.size() + 1; - char ** _argv_c = (char **) malloc(sizeof(char *) * (_argc + 1)); + std::vector _argv_c(_argc + 1); _argv_c[0] = argv[0]; for (int i=1 ; i < _argc ; ++i) { - _argv_c[i] = const_cast(_argv[i-1].c_str()); + _argv_c[i] = _argv[i-1].data(); } - _argv_c[_argc] = 0; - static struct option long_options[] = { {"version", no_argument, 0, 'v'}, @@ -117,7 +116,7 @@ int main(int argc, char **argv) int long_index = 0; int opt; - while ((opt = getopt_long(_argc, _argv_c, "vhc:o:", + while ((opt = getopt_long(_argc, _argv_c.data(), "vhc:o:", long_options, &long_index)) != -1) { switch(opt) @@ -142,8 +141,6 @@ int main(int argc, char **argv) break; } } - - free(_argv_c); } try diff --git a/src/rm/api/BackupJobAPI.h b/src/rm/api/BackupJobAPI.h index 972cf79a59..b2ac6e8047 100644 --- a/src/rm/api/BackupJobAPI.h +++ b/src/rm/api/BackupJobAPI.h @@ -40,7 +40,7 @@ protected: request.auth_op(AuthRequest::MANAGE); } - virtual ~BackupJobAPI() = default; + ~BackupJobAPI() override = default; /* API calls */ Request::ErrorCode backup(int oid, diff --git a/src/rm/api/DocumentAPI.h b/src/rm/api/DocumentAPI.h index 6a2c0c5b39..bb5d2471b2 100644 --- a/src/rm/api/DocumentAPI.h +++ b/src/rm/api/DocumentAPI.h @@ -37,7 +37,7 @@ protected: pool = docpool; }; - virtual ~DocumentAPI() = default; + ~DocumentAPI() override = default; /* API calls */ diff --git a/src/rm/api/GroupAPI.h b/src/rm/api/GroupAPI.h index 7001b06bfe..7dcfdbedbf 100644 --- a/src/rm/api/GroupAPI.h +++ b/src/rm/api/GroupAPI.h @@ -37,7 +37,7 @@ protected: pool = gpool; }; - virtual ~GroupAPI() = default; + ~GroupAPI() override = default; /* API calls */ Request::ErrorCode quota(int oid, @@ -48,8 +48,8 @@ protected: const std::string& vlan, RequestAttributes& att); - Request::ErrorCode quota_info(std::string& xml, - RequestAttributes& att); + static Request::ErrorCode quota_info(std::string& xml, + RequestAttributes& att); /* Helpers */ void to_xml(RequestAttributes& att, PoolObjectSQL * object, diff --git a/src/rm/api/HookPoolAPI.h b/src/rm/api/HookPoolAPI.h index d11dfd4d29..231bbbee98 100644 --- a/src/rm/api/HookPoolAPI.h +++ b/src/rm/api/HookPoolAPI.h @@ -37,12 +37,12 @@ protected: } /* API calls */ - Request::ErrorCode log_info(int min_ts, - int max_ts, - int hook_id, - int rc_hook, - std::string& xml, - RequestAttributes& att); + static Request::ErrorCode log_info(int min_ts, + int max_ts, + int hook_id, + int rc_hook, + std::string& xml, + RequestAttributes& att); /* Helpers */ }; diff --git a/src/rm/api/RMHookAPI.h b/src/rm/api/RMHookAPI.h index 52c722f442..37f16a853b 100644 --- a/src/rm/api/RMHookAPI.h +++ b/src/rm/api/RMHookAPI.h @@ -40,7 +40,7 @@ protected: request.auth_op(AuthRequest::MANAGE); } - virtual ~RMHookAPI() = default; + ~RMHookAPI() override = default; /* API calls */ Request::ErrorCode retry(int oid, diff --git a/src/rm/api/SecurityGroupAPI.h b/src/rm/api/SecurityGroupAPI.h index a7e6d74e90..d89ef153a0 100644 --- a/src/rm/api/SecurityGroupAPI.h +++ b/src/rm/api/SecurityGroupAPI.h @@ -37,7 +37,7 @@ protected: pool = sgpool; }; - virtual ~SecurityGroupAPI() = default; + ~SecurityGroupAPI() override = default; /* API calls */ Request::ErrorCode commit(int oid, diff --git a/src/rm/api/SystemAPI.h b/src/rm/api/SystemAPI.h index 0ffb54c701..2efa31c044 100644 --- a/src/rm/api/SystemAPI.h +++ b/src/rm/api/SystemAPI.h @@ -35,16 +35,16 @@ protected: request.auth_op(AuthRequest::ADMIN); }; - virtual ~SystemAPI() = default; + ~SystemAPI() override = default; /* API calls */ - Request::ErrorCode version(std::string& version, RequestAttributes& att); + static Request::ErrorCode version(std::string& version, RequestAttributes& att); - Request::ErrorCode config(std::string& config_xml, RequestAttributes& att); + static Request::ErrorCode config(std::string& config_xml, RequestAttributes& att); - Request::ErrorCode sql(const std::string& sql, bool federate, RequestAttributes& att); + static Request::ErrorCode sql(const std::string& sql, bool federate, RequestAttributes& att); - Request::ErrorCode sql_query(std::string& sql, RequestAttributes& att); + static Request::ErrorCode sql_query(std::string& sql, RequestAttributes& att); /* Helpers */ class select_cb : public Callbackable diff --git a/src/rm/api/UserAPI.h b/src/rm/api/UserAPI.h index 8695688490..26fba1f131 100644 --- a/src/rm/api/UserAPI.h +++ b/src/rm/api/UserAPI.h @@ -39,7 +39,7 @@ protected: pool = upool; }; - virtual ~UserAPI() = default; + ~UserAPI() override = default; /* API calls */ Request::ErrorCode edit_group(int oid, @@ -93,8 +93,8 @@ protected: return Request::SUCCESS; } - Request::ErrorCode quota_info(std::string& xml, - RequestAttributes& att); + static Request::ErrorCode quota_info(std::string& xml, + RequestAttributes& att); void to_xml(RequestAttributes& att, PoolObjectSQL * object, std::string& str) override diff --git a/src/rm/api/VMGroupAPI.h b/src/rm/api/VMGroupAPI.h index e98d18b402..3921bf2339 100644 --- a/src/rm/api/VMGroupAPI.h +++ b/src/rm/api/VMGroupAPI.h @@ -37,7 +37,7 @@ protected: pool = vmgpool; }; - virtual ~VMGroupAPI() = default; + ~VMGroupAPI() override = default; /* API calls */ Request::ErrorCode add_role(int oid, diff --git a/src/rm/api/VdcAPI.h b/src/rm/api/VdcAPI.h index 68cf4a7f93..6d0a1885bc 100644 --- a/src/rm/api/VdcAPI.h +++ b/src/rm/api/VdcAPI.h @@ -49,7 +49,7 @@ protected: request.auth_op(AuthRequest::ADMIN); }; - virtual ~VdcAPI() = default; + ~VdcAPI() override = default; /* API calls */ Request::ErrorCode add_group(int oid, diff --git a/src/rm/api/VirtualMachineAPI.h b/src/rm/api/VirtualMachineAPI.h index 5449904d3a..51e54c87c4 100644 --- a/src/rm/api/VirtualMachineAPI.h +++ b/src/rm/api/VirtualMachineAPI.h @@ -257,7 +257,7 @@ protected: RequestAttributes& att, PoolObjectAuth& vm_perms); - Request::ErrorCode get_host_information( + static Request::ErrorCode get_host_information( int hid, std::string& name, std::string& vmm, @@ -265,7 +265,7 @@ protected: PoolObjectAuth& host_perms, RequestAttributes& att); - Request::ErrorCode get_ds_information( + static Request::ErrorCode get_ds_information( int ds_id, std::set& ds_cluster_ids, std::string& tm_mad, @@ -274,13 +274,13 @@ protected: bool& ds_live_migr, bool& ds_migr_snap); - Request::ErrorCode get_default_ds_information( + static Request::ErrorCode get_default_ds_information( int cluster_id, int& ds_id, std::string& tm_mad, RequestAttributes& att); - bool check_host(int hid, + static bool check_host(int hid, bool enforce, VirtualMachine* vm, std::string& error); diff --git a/src/rm/api/VirtualNetworkAPI.cc b/src/rm/api/VirtualNetworkAPI.cc index 38d76c91da..2d319f0928 100644 --- a/src/rm/api/VirtualNetworkAPI.cc +++ b/src/rm/api/VirtualNetworkAPI.cc @@ -483,7 +483,7 @@ Request::ErrorCode VirtualNetworkAPI::update_ar(int oid, /* -------------------------------------------------------------------------- */ Request::ErrorCode VirtualNetworkAPI::authorize_mirror( - int oid, const string& ports, RequestAttributes& att) const + int oid, const string& ports, RequestAttributes& att) { set> selected; diff --git a/src/rm/api/VirtualNetworkAPI.h b/src/rm/api/VirtualNetworkAPI.h index 2208d6ed2a..ade00bde2e 100644 --- a/src/rm/api/VirtualNetworkAPI.h +++ b/src/rm/api/VirtualNetworkAPI.h @@ -142,9 +142,9 @@ private: bool force, RequestAttributes& att); - Request::ErrorCode authorize_mirror(int oid, - const std::string& ports, - RequestAttributes& att) const; + static Request::ErrorCode authorize_mirror(int oid, + const std::string& ports, + RequestAttributes& att); }; diff --git a/src/rm/api/VirtualRouterAPI.h b/src/rm/api/VirtualRouterAPI.h index 4c8e5d3e24..b3ae8b5733 100644 --- a/src/rm/api/VirtualRouterAPI.h +++ b/src/rm/api/VirtualRouterAPI.h @@ -37,7 +37,7 @@ protected: pool = vrpool; } - virtual ~VirtualRouterAPI() = default; + ~VirtualRouterAPI() override = default; /* API calls */ Request::ErrorCode instantiate(int oid, diff --git a/src/rm/api/ZoneAPI.h b/src/rm/api/ZoneAPI.h index 39917c741c..e9359d48e3 100644 --- a/src/rm/api/ZoneAPI.h +++ b/src/rm/api/ZoneAPI.h @@ -52,7 +52,7 @@ protected: pool = zpool; }; - virtual ~ZoneAPI() = default; + ~ZoneAPI() override = default; /* API calls */ Request::ErrorCode allocate(const std::string& str_tmpl, @@ -76,22 +76,22 @@ protected: bool enable, RequestAttributes& att); - Request::ErrorCode replicate_log(const ReplicateLogParams& params, - RequestAttributes& att); + static Request::ErrorCode replicate_log(const ReplicateLogParams& params, + RequestAttributes& att); - Request::ErrorCode vote(unsigned int candidate_term, - int candidate_id, - uint64_t candidate_log_index, - unsigned int candidate_log_term, - RequestAttributes& att); + static Request::ErrorCode vote(unsigned int candidate_term, + int candidate_id, + uint64_t candidate_log_index, + unsigned int candidate_log_term, + RequestAttributes& att); Request::ErrorCode raft_status(std::string& xml, RequestAttributes& att); - Request::ErrorCode replicate_fed_log(uint64_t index, - uint64_t prev, - std::string sql, - RequestAttributes& att); + static Request::ErrorCode replicate_fed_log(uint64_t index, + uint64_t prev, + std::string sql, + RequestAttributes& att); /* Helpers */ int drop(std::unique_ptr obj, diff --git a/src/rm/grpc/RequestGRPC.cc b/src/rm/grpc/RequestGRPC.cc index 6a589ca5b6..86df41af52 100644 --- a/src/rm/grpc/RequestGRPC.cc +++ b/src/rm/grpc/RequestGRPC.cc @@ -85,7 +85,7 @@ grpc::Status RequestGRPC::execute(grpc::ServerContext* context, if ( (raftm->is_follower() || nd.is_cache()) && _leader_only) { - std::string leader_endpoint, error; + std::string leader_endpoint; if ( nd.is_cache() ) { diff --git a/src/rm/grpc/RequestGRPC.h b/src/rm/grpc/RequestGRPC.h index 83918cc0e3..e60fbec8fa 100644 --- a/src/rm/grpc/RequestGRPC.h +++ b/src/rm/grpc/RequestGRPC.h @@ -36,9 +36,7 @@ public: , method_full_name(grpc_name) {} - virtual ~RequestGRPC() = default; - - ErrorCode to_error_code(grpc::StatusCode gsc) + static ErrorCode to_error_code(grpc::StatusCode gsc) { switch (gsc) { @@ -64,7 +62,7 @@ public: } } - grpc::StatusCode to_status_code(ErrorCode ec) + static grpc::StatusCode to_status_code(ErrorCode ec) { switch (ec) { diff --git a/src/rm/grpc/RequestLoggerGRPC.h b/src/rm/grpc/RequestLoggerGRPC.h index f99951dbe3..a73a378343 100644 --- a/src/rm/grpc/RequestLoggerGRPC.h +++ b/src/rm/grpc/RequestLoggerGRPC.h @@ -33,8 +33,6 @@ public: context(_context) {}; - virtual ~RequestLoggerGRPC() = default; - protected: void client_ip(char * const ip, char * const port) override; diff --git a/src/rm/xml-rpc/RequestLoggerXRPC.cc b/src/rm/xml-rpc/RequestLoggerXRPC.cc index aea2a2d0c8..1acdc48e0c 100644 --- a/src/rm/xml-rpc/RequestLoggerXRPC.cc +++ b/src/rm/xml-rpc/RequestLoggerXRPC.cc @@ -38,7 +38,7 @@ void RequestLoggerXRPC::client_ip(char * const ip, socklen_t addr_len = sizeof(addr_storage); // 2. This fills addr_storage with the remote address information. - if ( getpeername(client_fd, (struct sockaddr*)&addr_storage, &addr_len) != 0 ) + if ( getpeername(client_fd, reinterpret_cast(&addr_storage), &addr_len) != 0 ) { ip[0] = '-'; ip[1] = '\0'; @@ -50,7 +50,7 @@ void RequestLoggerXRPC::client_ip(char * const ip, } // 3. Read the IP and Port from addr_storage - int rc = getnameinfo((struct sockaddr*)&addr_storage, + int rc = getnameinfo(reinterpret_cast(&addr_storage), addr_len, ip, NI_MAXHOST, port, NI_MAXSERV, NI_NUMERICHOST|NI_NUMERICSERV); diff --git a/src/rm/xml-rpc/RequestLoggerXRPC.h b/src/rm/xml-rpc/RequestLoggerXRPC.h index 41f6e2bb2c..ff93b6d748 100644 --- a/src/rm/xml-rpc/RequestLoggerXRPC.h +++ b/src/rm/xml-rpc/RequestLoggerXRPC.h @@ -43,9 +43,9 @@ protected: * @param oss stream to write v * @param limit of characters to wirte */ - void log_xmlrpc_value(const xmlrpc_c::value& v, - std::ostringstream& oss, - const unsigned int limit); + static void log_xmlrpc_value(const xmlrpc_c::value& v, + std::ostringstream& oss, + const unsigned int limit); }; #endif //REQUEST_LOGGER_XRPC_H_ diff --git a/src/rm/xml-rpc/RequestManagerXRPC.cc b/src/rm/xml-rpc/RequestManagerXRPC.cc index 84d0c9a11c..c3d0934717 100644 --- a/src/rm/xml-rpc/RequestManagerXRPC.cc +++ b/src/rm/xml-rpc/RequestManagerXRPC.cc @@ -119,7 +119,7 @@ void RequestManagerXRPC::xml_server_loop() socklen_t addr_len = sizeof(struct sockaddr_storage); - int client_fd = accept(socket_fd, (struct sockaddr*) &addr, &addr_len); + int client_fd = accept(socket_fd, reinterpret_cast(&addr), &addr_len); if (client_fd == -1) { @@ -142,7 +142,7 @@ void RequestManagerXRPC::xml_server_loop() // The extra getpeername solves bug in xml-rpc, which crashes // if the socket is terminated immediatelly after creating connection - if (getpeername(client_fd, (struct sockaddr *)&addr, &addr_len) == 0) + if (getpeername(client_fd, reinterpret_cast(&addr), &addr_len) == 0) { xmlrpc_c::serverAbyss * as = create_abyss(); diff --git a/src/rm/xml-rpc/RequestXRPC.cc b/src/rm/xml-rpc/RequestXRPC.cc index 0be59da5e9..64cbfdf735 100644 --- a/src/rm/xml-rpc/RequestXRPC.cc +++ b/src/rm/xml-rpc/RequestXRPC.cc @@ -80,7 +80,7 @@ void RequestXRPC::execute( if ( (raftm->is_follower() || nd.is_cache()) && _leader_only) { - string leader_endpoint, error; + string leader_endpoint; if ( nd.is_cache() ) { diff --git a/src/rm/xml-rpc/RequestXRPC.h b/src/rm/xml-rpc/RequestXRPC.h index 07b70f8c46..2f777d60e0 100644 --- a/src/rm/xml-rpc/RequestXRPC.h +++ b/src/rm/xml-rpc/RequestXRPC.h @@ -37,8 +37,6 @@ public: _help = help; } - virtual ~RequestXRPC() = default; - /* ---------------------------------------------------------------------- */ /* Entry code for xml-rpc calls */ /* ---------------------------------------------------------------------- */ diff --git a/src/sam/ScheduledAction.cc b/src/sam/ScheduledAction.cc index 3b5086e7c3..bc4cef1555 100644 --- a/src/sam/ScheduledAction.cc +++ b/src/sam/ScheduledAction.cc @@ -297,7 +297,7 @@ int ScheduledAction::ends_in_range(std::string& error) { struct tm val_tm; - localtime_r((time_t *)&_end_value, &val_tm); + localtime_r(&_end_value, &val_tm); time_t out = mktime(&val_tm); diff --git a/src/schedm/SchedulerManager.cc b/src/schedm/SchedulerManager.cc index f2ea5328f9..e06f675909 100644 --- a/src/schedm/SchedulerManager.cc +++ b/src/schedm/SchedulerManager.cc @@ -46,11 +46,11 @@ int SchedulerManager::start() /** * Register protocol actions */ - register_action(SchedulerManagerMessages::PLACE, [this](auto msg) { - this->_place(std::move(msg));}); + register_action(SchedulerManagerMessages::PLACE, + &SchedulerManager::_place); - register_action(SchedulerManagerMessages::OPTIMIZE, [this](auto msg) { - this->_optimize(std::move(msg));}); + register_action(SchedulerManagerMessages::OPTIMIZE, + &SchedulerManager::_optimize); register_action(SchedulerManagerMessages::LOG, &SchedulerManager::_log); diff --git a/src/tm/TransferManager.cc b/src/tm/TransferManager.cc index daa8d976be..f446db318e 100644 --- a/src/tm/TransferManager.cc +++ b/src/tm/TransferManager.cc @@ -337,11 +337,9 @@ void TransferManager::trigger_prolog(VirtualMachine * vm) ostringstream os("prolog, "); string xfr_name; - string files; string vm_tm_mad; string opennebula_hostname; int rc; - string error_str; Nebula& nd = Nebula::instance(); @@ -826,11 +824,9 @@ void TransferManager::trigger_prolog_attach(VirtualMachine * vm) const VirtualMachineDisk * disk; - string files; string vm_tm_mad; string opennebula_hostname; int rc; - string error_str; Nebula& nd = Nebula::instance(); @@ -1045,7 +1041,6 @@ void TransferManager::trigger_epilog(bool local, VirtualMachine * vm) string xfr_name; string vm_tm_mad; - string error_str; string host; Nebula& nd = Nebula::instance(); @@ -1721,7 +1716,6 @@ void TransferManager::trigger_epilog_detach(VirtualMachine * vm) ostringstream os; string xfr_name; string vm_tm_mad; - string error_str; const VirtualMachineDisk * disk; diff --git a/src/um/Quota.cc b/src/um/Quota.cc index 7e511f716c..30762227b0 100644 --- a/src/um/Quota.cc +++ b/src/um/Quota.cc @@ -53,7 +53,7 @@ int Quota::get_quota( return -1; } - for ( it = attributes.begin(); it != attributes.end(); it++) + for ( it = attributes.begin(); it != attributes.end(); ++it) { q = static_cast(it->second); diff --git a/src/vmm/VirtualMachineManager.cc b/src/vmm/VirtualMachineManager.cc index 119dc4e7ea..013122cf1e 100644 --- a/src/vmm/VirtualMachineManager.cc +++ b/src/vmm/VirtualMachineManager.cc @@ -72,7 +72,7 @@ int VirtualMachineManager::start() bind(&VirtualMachineManager::_cleanup, this, _1)); register_action(VMManagerMessages::CHECKPOINT, - bind(&VirtualMachineManager::_checkpoint, this, _1)); + &VirtualMachineManager::_checkpoint); register_action(VMManagerMessages::SAVE, bind(&VirtualMachineManager::_save, this, _1)); @@ -117,7 +117,7 @@ int VirtualMachineManager::start() bind(&VirtualMachineManager::_updatesg, this, _1)); register_action(VMManagerMessages::DRIVER_CANCEL, - bind(&VirtualMachineManager::_driver_cancel, this, _1)); + &VirtualMachineManager::_driver_cancel); register_action(VMManagerMessages::RESIZE, bind(&VirtualMachineManager::_resize, this, _1)); @@ -132,7 +132,7 @@ int VirtualMachineManager::start() bind(&VirtualMachineManager::_updatenic, this, _1)); register_action(VMManagerMessages::BACKUPCANCEL, - bind(&VirtualMachineManager::_driver_cancel, this, _1)); + &VirtualMachineManager::_driver_cancel); register_action(VMManagerMessages::EXEC, bind(&VirtualMachineManager::_exec, this, _1)); @@ -1401,7 +1401,6 @@ void VirtualMachineManager::trigger_attach(int vid) string vm_tmpl; string drv_msg; - string tm_command; string vm_tm_mad; string opennebula_hostname; string prolog_cmd; @@ -1538,12 +1537,10 @@ void VirtualMachineManager::trigger_detach(int vid) ostringstream os; string vm_tmpl; string drv_msg; - string tm_command; string vm_tm_mad; string opennebula_hostname; string epilog_cmd; string disk_path; - string error_str; const VirtualMachineDisk * disk; int disk_id; @@ -1870,7 +1867,6 @@ void VirtualMachineManager::trigger_disk_snapshot_create(int vid) string vm_tmpl; string drv_msg; - string vm_tm_mad; string snap_cmd; string disk_path; @@ -2088,7 +2084,6 @@ void VirtualMachineManager::trigger_update_conf(int vid) string password; string prolog_cmd; - string resize_cmd; string disk_path; auto vm = vmpool->get(vid); @@ -2167,7 +2162,6 @@ void VirtualMachineManager::trigger_attach_nic(int vid) string vm_tmpl; string drv_msg; - string opennebula_hostname; string prolog_cmd; string disk_path; string password; @@ -2271,7 +2265,6 @@ void VirtualMachineManager::trigger_detach_nic(int vid) ostringstream os; string vm_tmpl; string drv_msg; - string error_str; string prolog_cmd; string disk_path; string password; diff --git a/src/vnm/AddressRange.cc b/src/vnm/AddressRange.cc index 8aa8dc4817..59006e7367 100644 --- a/src/vnm/AddressRange.cc +++ b/src/vnm/AddressRange.cc @@ -22,6 +22,7 @@ #include #include +#include #include using namespace std; @@ -1113,7 +1114,7 @@ string AddressRange::mac_to_s(const unsigned int i_mac[]) temp_byte &= 255; oss.width(2); - oss.fill('0'); + oss << std::setfill('0'); oss << hex << temp_byte; if(i!=0)