From 2fe396ae15921c497e86b2cc1ddac84a267085e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Czern=C3=BD?= Date: Mon, 3 Jun 2024 11:40:24 +0200 Subject: [PATCH] L #-: Add Astyle linting * Add AStyle to smoke tests * Format C++ files using AStyle --- .github/workflows/smoke_tests.yml | 2 + include/AclManager.h | 2 +- include/AclRule.h | 10 +- include/ActionSet.h | 4 +- include/AddressRange.h | 42 +- include/AddressRangeIPAM.h | 4 +- include/AddressRangeInternal.h | 4 +- include/AddressRangePool.h | 22 +- include/Attribute.h | 26 +- include/AuthManager.h | 20 +- include/AuthRequest.h | 12 +- include/BackupIncrements.h | 16 +- include/BackupJob.h | 10 +- include/BackupJobPool.h | 18 +- include/BitMap.h | 6 +- include/Callbackable.h | 14 +- include/Client.h | 20 +- include/Cluster.h | 20 +- include/ClusterPool.h | 10 +- include/ClusterTemplate.h | 6 +- include/Clusterable.h | 4 +- include/ClusterableSingle.h | 4 +- include/Datastore.h | 8 +- include/DatastorePool.h | 28 +- include/DatastoreTemplate.h | 6 +- include/DefaultQuotas.h | 6 +- include/DispatchManager.h | 62 +- include/DocumentPool.h | 15 +- include/DocumentTemplate.h | 8 +- include/Driver.h | 53 +- include/DriverManager.h | 13 +- include/EnumString.h | 8 +- include/ExecuteHook.h | 2 +- include/ExtendedAttribute.h | 22 +- include/FedReplicaManager.h | 8 +- include/GroupPool.h | 4 +- include/History.h | 26 +- include/HookAPI.h | 2 +- include/HookManager.h | 2 +- include/HookPool.h | 6 +- include/HookStateHost.h | 2 +- include/HookStateImage.h | 2 +- include/HookStateVM.h | 2 +- include/HookStateVirtualNetwork.h | 2 +- include/Host.h | 29 +- include/HostPool.h | 24 +- include/HostShare.h | 2 +- include/HostShareDatastore.h | 4 +- include/HostShareNUMA.h | 14 +- include/HostSharePCI.h | 6 +- include/HostTemplate.h | 6 +- include/IPAMManager.h | 4 +- include/IPAMRequest.h | 6 +- include/Image.h | 12 +- include/ImageManager.h | 120 +- include/ImagePool.h | 42 +- include/ImageTemplate.h | 6 +- include/InformationManager.h | 12 +- include/LifeCycleManager.h | 2 +- include/Listener.h | 16 +- include/Log.h | 49 +- include/LogDB.h | 18 +- include/LoginToken.h | 16 +- include/MarketPlace.h | 7 +- include/MarketPlaceAppPool.h | 8 +- include/MarketPlaceAppTemplate.h | 4 +- include/MarketPlaceManager.h | 20 +- include/MarketPlacePool.h | 14 +- include/MarketPlaceTemplate.h | 4 +- include/Message.h | 18 +- include/MySqlDB.h | 5 +- include/Nebula.h | 48 +- include/NebulaLog.h | 41 +- include/NebulaService.h | 12 +- include/NebulaTemplate.h | 9 +- include/NebulaUtil.h | 36 +- include/ObjectCollection.h | 9 +- include/ObjectSQL.h | 10 +- include/ObjectXML.h | 2 +- include/OpenNebulaTemplate.h | 4 +- include/PoolObjectSQL.h | 52 +- include/PoolSQL.h | 32 +- include/PostgreSqlDB.h | 29 +- include/Quota.h | 82 +- include/QuotaDatastore.h | 6 +- include/QuotaImage.h | 6 +- include/QuotaNetwork.h | 14 +- include/QuotaVirtualMachine.h | 8 +- include/Quotas.h | 171 +- include/QuotasSQL.h | 26 +- include/RaftManager.h | 15 +- include/RankScheduler.h | 2 +- include/ReplicaManager.h | 10 +- include/ReplicaRequest.h | 4 +- include/ReplicaThread.h | 6 +- include/Request.h | 37 +- include/RequestManagerAcl.h | 10 +- include/RequestManagerAllocate.h | 140 +- include/RequestManagerAllocateDB.h | 8 +- include/RequestManagerChmod.h | 72 +- include/RequestManagerChown.h | 34 +- include/RequestManagerClone.h | 44 +- include/RequestManagerCluster.h | 84 +- include/RequestManagerConnection.h | 6 +- include/RequestManagerDatastore.h | 8 +- include/RequestManagerDelete.h | 4 +- include/RequestManagerDropDB.h | 6 +- include/RequestManagerGroup.h | 20 +- include/RequestManagerHook.h | 4 +- include/RequestManagerHost.h | 12 +- include/RequestManagerImage.h | 36 +- include/RequestManagerInfo.h | 8 +- include/RequestManagerMarketPlaceApp.h | 6 +- include/RequestManagerPoolInfoFilter.h | 36 +- include/RequestManagerProxy.h | 2 +- include/RequestManagerRename.h | 10 +- include/RequestManagerSystem.h | 44 +- include/RequestManagerUpdateDB.h | 16 +- include/RequestManagerUpdateTemplate.h | 38 +- include/RequestManagerUser.h | 38 +- include/RequestManagerVMGroup.h | 2 +- include/RequestManagerVMTemplate.h | 14 +- include/RequestManagerVNTemplate.h | 6 +- include/RequestManagerVdc.h | 38 +- include/RequestManagerVirtualMachine.h | 208 +- include/RequestManagerVirtualNetwork.h | 48 +- include/RequestManagerVirtualRouter.h | 10 +- include/RequestManagerZone.h | 34 +- include/SSLUtil.h | 12 +- include/ScheduledAction.h | 6 +- include/ScheduledActionManager.h | 2 +- include/ScheduledActionPool.h | 4 +- include/SecurityGroup.h | 14 +- include/SecurityGroupPool.h | 8 +- include/Snapshots.h | 2 +- include/SqlDB.h | 19 +- include/StreamManager.h | 15 +- include/StringBuffer.h | 3 +- include/SystemDB.h | 16 +- include/Template.h | 36 +- include/TransferManager.h | 22 +- include/User.h | 8 +- include/UserPool.h | 26 +- include/UserTemplate.h | 2 +- include/VMActions.h | 5 +- include/VMGroup.h | 8 +- include/VMGroupPool.h | 16 +- include/VMGroupRole.h | 10 +- include/VMGroupRule.h | 2 +- include/VMTemplatePool.h | 10 +- include/VNTemplatePool.h | 8 +- include/Vdc.h | 10 +- include/VdcPool.h | 14 +- include/VirtualMachine.h | 58 +- include/VirtualMachineAttribute.h | 10 +- include/VirtualMachineDisk.h | 44 +- include/VirtualMachineManager.h | 48 +- include/VirtualMachineManagerDriver.h | 102 +- include/VirtualMachineMonitorInfo.h | 2 +- include/VirtualMachineNic.h | 28 +- include/VirtualMachinePool.h | 50 +- include/VirtualMachineTemplate.h | 10 +- include/VirtualNetwork.h | 38 +- include/VirtualNetworkPool.h | 60 +- include/VirtualNetworkTemplate.h | 6 +- include/VirtualRouter.h | 2 +- include/VirtualRouterPool.h | 14 +- include/XMLDriver.h | 4 +- include/XenDriver.h | 4 +- include/Zone.h | 11 +- include/ZonePool.h | 8 +- include/ZoneServer.h | 10 +- share/linters/.astylerc | 27 + share/smoke_tests/tests/05-astyle.sh | 26 + src/acl/AclManager.cc | 166 +- src/acl/AclRule.cc | 58 +- src/authm/AuthManager.cc | 22 +- src/client/Client.cc | 18 +- src/cluster/Cluster.cc | 16 +- src/cluster/ClusterPool.cc | 14 +- src/common/Attribute.cc | 22 +- src/common/ExtendedAttribute.cc | 2 +- src/common/NebulaUtil.cc | 29 +- src/common/SSLUtil.cc | 12 +- src/datastore/Datastore.cc | 38 +- src/datastore/DatastorePool.cc | 52 +- src/dm/DispatchManager.cc | 2 +- src/dm/DispatchManagerActions.cc | 227 +- src/dm/DispatchManagerStates.cc | 60 +- src/document/Document.cc | 24 +- src/group/Group.cc | 202 +- src/group/GroupPool.cc | 24 +- src/hm/ExecuteHook.cc | 7 +- src/hm/Hook.cc | 2 +- src/hm/HookAPI.cc | 23 +- src/hm/HookManager.cc | 28 +- src/hm/HookStateVM.cc | 4 +- src/host/Host.cc | 56 +- src/host/HostMonitoringTemplate.cc | 6 +- src/host/HostPool.cc | 16 +- src/host/HostShare.cc | 46 +- src/host/HostShareNUMA.cc | 36 +- src/host/HostSharePCI.cc | 28 +- src/im/InformationManager.cc | 40 +- src/image/BackupIncrements.cc | 4 +- src/image/Image.cc | 155 +- src/image/ImageManager.cc | 38 +- src/image/ImageManagerActions.cc | 184 +- src/image/ImageManagerProtocol.cc | 10 +- src/image/ImagePool.cc | 8 +- src/ipamm/IPAMManager.cc | 37 +- src/ipamm/IPAMManagerProtocol.cc | 16 +- src/lcm/LifeCycleActions.cc | 462 +- src/lcm/LifeCycleManager.cc | 2 +- src/lcm/LifeCycleStates.cc | 291 +- src/log/Log.cc | 34 +- src/market/MarketPlace.cc | 80 +- src/market/MarketPlaceApp.cc | 102 +- src/market/MarketPlaceAppPool.cc | 36 +- src/market/MarketPlaceManager.cc | 38 +- src/market/MarketPlaceManagerActions.cc | 56 +- src/market/MarketPlaceManagerProtocol.cc | 8 +- src/market/MarketPlacePool.cc | 52 +- src/monitor/include/HostMonitorManager.h | 8 +- src/monitor/include/MonitorConfigTemplate.h | 2 +- src/monitor/include/MonitorDriver.h | 14 +- src/monitor/include/RPCPool.h | 4 +- src/monitor/include/TCPMonitorDriver.h | 14 +- src/monitor/include/TCPStream.h | 12 +- src/monitor/include/UDPMonitorDriver.h | 14 +- src/monitor/include/UDPStream.h | 9 +- src/monitor/include/VirtualMachineBase.h | 2 +- src/monitor/src/data_model/HostRPCPool.cc | 7 +- src/monitor/src/data_model/VMRPCPool.cc | 4 +- .../src/data_model/VirtualMachineBase.cc | 2 +- src/monitor/src/monitor/HostMonitorManager.cc | 21 +- src/monitor/src/monitor/Monitor.cc | 18 +- .../src/monitor/MonitorConfigTemplate.cc | 22 +- .../src/monitor/MonitorDriverProtocol.cc | 47 +- src/monitor/src/monitor/OneMonitorDriver.cc | 18 +- src/monitor/src/monitor/onemonitord.cc | 7 +- src/nebula/Nebula.cc | 84 +- src/nebula/SystemDB.cc | 18 +- src/nebula/oned.cc | 10 +- src/pool/ObjectCollection.cc | 52 +- src/pool/PoolObjectSQL.cc | 48 +- src/pool/PoolSQL.cc | 14 +- src/protocol/Message.cc | 27 +- src/raft/FedReplicaManager.cc | 10 +- src/raft/RaftManager.cc | 41 +- src/raft/ReplicaManager.cc | 3 +- src/raft/ReplicaThread.cc | 22 +- src/rm/Request.cc | 62 +- src/rm/RequestManager.cc | 99 +- src/rm/RequestManagerAcl.cc | 14 +- src/rm/RequestManagerAllocate.cc | 58 +- src/rm/RequestManagerBackupJob.cc | 2 +- src/rm/RequestManagerChmod.cc | 40 +- src/rm/RequestManagerChown.cc | 28 +- src/rm/RequestManagerClone.cc | 14 +- src/rm/RequestManagerCluster.cc | 4 +- src/rm/RequestManagerDatastore.cc | 2 +- src/rm/RequestManagerDelete.cc | 48 +- src/rm/RequestManagerGroup.cc | 8 +- src/rm/RequestManagerHook.cc | 2 +- src/rm/RequestManagerImage.cc | 36 +- src/rm/RequestManagerInfo.cc | 12 +- src/rm/RequestManagerLock.cc | 4 +- src/rm/RequestManagerMarketPlace.cc | 4 +- src/rm/RequestManagerMarketPlaceApp.cc | 4 +- src/rm/RequestManagerPoolInfoFilter.cc | 50 +- src/rm/RequestManagerProxy.cc | 2 +- src/rm/RequestManagerRename.cc | 2 +- src/rm/RequestManagerSchedAction.cc | 2 +- src/rm/RequestManagerSecurityGroup.cc | 2 +- src/rm/RequestManagerSystem.cc | 18 +- src/rm/RequestManagerUpdateTemplate.cc | 8 +- src/rm/RequestManagerUser.cc | 40 +- src/rm/RequestManagerVMTemplate.cc | 52 +- src/rm/RequestManagerVNTemplate.cc | 14 +- src/rm/RequestManagerVdc.cc | 6 +- src/rm/RequestManagerVirtualMachine.cc | 171 +- src/rm/RequestManagerVirtualNetwork.cc | 56 +- src/rm/RequestManagerVirtualRouter.cc | 2 +- src/rm/RequestManagerZone.cc | 38 +- src/sam/ScheduledAction.cc | 23 +- src/sam/ScheduledActionManager.cc | 10 +- src/sam/ScheduledActionPool.cc | 4 +- src/scheduler/include/AclXML.h | 2 +- src/scheduler/include/ClusterPoolXML.h | 4 +- src/scheduler/include/DatastorePoolXML.h | 8 +- src/scheduler/include/HostPoolXML.h | 2 +- src/scheduler/include/HostXML.h | 4 +- src/scheduler/include/MonitorXML.h | 6 +- src/scheduler/include/PoolXML.h | 8 +- src/scheduler/include/RankPolicy.h | 26 +- src/scheduler/include/Resource.h | 9 +- src/scheduler/include/Scheduler.h | 2 +- src/scheduler/include/SchedulerPolicy.h | 10 +- src/scheduler/include/SchedulerTemplate.h | 4 +- src/scheduler/include/UserPoolXML.h | 4 +- src/scheduler/include/UserPriorityPolicy.h | 4 +- src/scheduler/include/UserXML.h | 2 +- src/scheduler/include/VMGroupPoolXML.h | 4 +- src/scheduler/include/VMGroupXML.h | 6 +- src/scheduler/include/VirtualMachinePoolXML.h | 8 +- src/scheduler/include/VirtualMachineXML.h | 6 +- src/scheduler/include/VirtualNetworkPoolXML.h | 2 +- src/scheduler/src/pool/AclXML.cc | 6 +- src/scheduler/src/pool/ClusterPoolXML.cc | 4 +- src/scheduler/src/pool/DatastorePoolXML.cc | 4 +- src/scheduler/src/pool/DatastoreXML.cc | 3 +- src/scheduler/src/pool/HostPoolXML.cc | 6 +- src/scheduler/src/pool/HostXML.cc | 6 +- src/scheduler/src/pool/UserPoolXML.cc | 4 +- src/scheduler/src/pool/VMGroupPoolXML.cc | 4 +- src/scheduler/src/pool/VMGroupXML.cc | 12 +- .../src/pool/VirtualMachinePoolXML.cc | 16 +- src/scheduler/src/pool/VirtualMachineXML.cc | 62 +- .../src/pool/VirtualNetworkPoolXML.cc | 6 +- src/scheduler/src/pool/VirtualNetworkXML.cc | 7 +- src/scheduler/src/sched/Scheduler.cc | 95 +- src/scheduler/src/sched/SchedulerTemplate.cc | 88 +- src/secgroup/SecurityGroup.cc | 27 +- src/secgroup/SecurityGroupPool.cc | 18 +- src/sql/LogDB.cc | 16 +- src/sql/MySqlDB.cc | 29 +- src/sql/OneDB.cc | 240 +- src/sql/PostgreSqlDB.cc | 15 +- src/sql/SqlDB.cc | 2 +- src/sql/SqliteDB.cc | 15 +- src/svncterm_server/glyphs.h | 144574 ++++++++------- src/svncterm_server/svncterm.h | 404 +- src/template/NebulaTemplate.cc | 6 +- src/template/OpenNebulaTemplate.cc | 460 +- src/template/Template.cc | 32 +- src/tm/TransferManager.cc | 553 +- src/um/Quota.cc | 10 +- src/um/QuotaImage.cc | 10 +- src/um/QuotaNetwork.cc | 6 +- src/um/QuotaVirtualMachine.cc | 9 +- src/um/Quotas.cc | 20 +- src/um/QuotasSQL.cc | 6 +- src/um/User.cc | 30 +- src/um/UserPool.cc | 153 +- src/vdc/Vdc.cc | 62 +- src/vdc/VdcPool.cc | 20 +- src/vm/BackupJob.cc | 53 +- src/vm/Backups.cc | 2 +- src/vm/History.cc | 244 +- src/vm/Snapshots.cc | 2 +- src/vm/VMActions.cc | 114 +- src/vm/VirtualMachine.cc | 495 +- src/vm/VirtualMachineContext.cc | 28 +- src/vm/VirtualMachineDisk.cc | 71 +- src/vm/VirtualMachineNic.cc | 26 +- src/vm/VirtualMachineParser.cc | 50 +- src/vm/VirtualMachinePool.cc | 120 +- src/vm/VirtualMachineSystemSnapshot.cc | 2 +- src/vm/VirtualMachineTemplate.cc | 127 +- src/vm_group/VMGroup.cc | 14 +- src/vm_group/VMGroupPool.cc | 8 +- src/vm_group/VMGroupRole.cc | 4 +- src/vm_group/VMGroupRule.cc | 2 +- src/vm_template/VMTemplate.cc | 24 +- src/vmm/LibVirtDriverKVM.cc | 121 +- src/vmm/VirtualMachineManager.cc | 1383 +- src/vmm/VirtualMachineManagerDriver.cc | 30 +- src/vmm/VirtualMachineManagerProtocol.cc | 56 +- src/vmm/XMLDriver.cc | 4 +- src/vmm/XenDriver.cc | 36 +- src/vn_template/VNTemplate.cc | 26 +- src/vnm/AddressRange.cc | 142 +- src/vnm/AddressRangeIPAM.cc | 4 +- src/vnm/AddressRangeInternal.cc | 2 +- src/vnm/AddressRangePool.cc | 60 +- src/vnm/VirtualNetwork.cc | 133 +- src/vnm/VirtualNetworkPool.cc | 48 +- src/vrouter/VirtualRouter.cc | 44 +- src/xml/ObjectXML.cc | 26 +- src/zone/Zone.cc | 14 +- src/zone/ZonePool.cc | 26 +- 382 files changed, 79574 insertions(+), 79104 deletions(-) create mode 100644 share/linters/.astylerc create mode 100755 share/smoke_tests/tests/05-astyle.sh diff --git a/.github/workflows/smoke_tests.yml b/.github/workflows/smoke_tests.yml index a7491079b8..b069eb8009 100644 --- a/.github/workflows/smoke_tests.yml +++ b/.github/workflows/smoke_tests.yml @@ -19,6 +19,8 @@ jobs: run: gem install rubocop - name: Install CppCheck run: sudo apt install -y cppcheck + - name: Install AStyle + run: sudo apt install -y astyle # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 diff --git a/include/AclManager.h b/include/AclManager.h index eb665666e9..7e96e8bf1f 100644 --- a/include/AclManager.h +++ b/include/AclManager.h @@ -90,7 +90,7 @@ public: * @return true if the authorization is granted for oneadmin */ bool oneadmin_authorize(const PoolObjectAuth& obj_perms, - AuthRequest::Operation op) const; + AuthRequest::Operation op) const; /** * Adds a new rule to the ACL rule set diff --git a/include/AclRule.h b/include/AclRule.h index 50cfd05705..b848bda18f 100644 --- a/include/AclRule.h +++ b/include/AclRule.h @@ -64,11 +64,11 @@ public: /** * Set the fields of the ACL, and updates its representation */ - void set(int _oid, - long long _user, - long long _resource, - long long _rights, - long long _zone) + void set(int _oid, + long long _user, + long long _resource, + long long _rights, + long long _zone) { oid = _oid; user = _user; diff --git a/include/ActionSet.h b/include/ActionSet.h index c9a56f22f3..683c9c269c 100644 --- a/include/ActionSet.h +++ b/include/ActionSet.h @@ -28,7 +28,7 @@ template class ActionSet { public: - ActionSet():action_set(0UL){}; + ActionSet():action_set(0UL) {}; ActionSet(const T * actions, int actions_len):action_set(0) { for (int i=0; i& vms, - const std::vector& vnets, const std::vector& vrs) const; + const std::vector& vnets, const std::vector& vrs) const; /** * Same as above but without the LEASES section @@ -194,7 +194,7 @@ public: * @return 0 if success */ int allocate_addr(PoolObjectSQL::ObjectType ot, int obid, - VectorAttribute * nic, const std::set &inherit); + VectorAttribute * nic, const std::set &inherit); /** * Returns the specific address by mac/ip if is not allocated. The NIC attr @@ -207,13 +207,13 @@ public: * @return 0 if success */ int allocate_by_mac(const std::string& mac, PoolObjectSQL::ObjectType ot, - int obid, VectorAttribute * nic, const std::set &inherit); + int obid, VectorAttribute * nic, const std::set &inherit); int allocate_by_ip(const std::string& ip, PoolObjectSQL::ObjectType ot, - int obid, VectorAttribute * nic, const std::set &inherit); + int obid, VectorAttribute * nic, const std::set &inherit); int allocate_by_ip6(const std::string& ip6, PoolObjectSQL::ObjectType ot, - int obid, VectorAttribute * nic, const std::set &inherit); + int obid, VectorAttribute * nic, const std::set &inherit); /** * Sets the given ip/mac on hold, the address is associated to a VM of @@ -237,7 +237,7 @@ public: int free_addr_by_ip(PoolObjectSQL::ObjectType ot, int id, const std::string& ip); - int free_addr_by_ip6(PoolObjectSQL::ObjectType ot, int id,const std::string& ip); + int free_addr_by_ip6(PoolObjectSQL::ObjectType ot, int id, const std::string& ip); /** * Frees all previous allocated address to the given object @@ -257,7 +257,7 @@ public: * @return the number of addresses freed */ int free_addr_by_range(PoolObjectSQL::ObjectType ot, int obid, - const std::string& mac, unsigned int rsize); + const std::string& mac, unsigned int rsize); /** * Adds the relevant AR definition attributes to the Security Group rule @@ -288,13 +288,13 @@ public: * @return 0 on success */ int reserve_addr_by_mac(int vid, unsigned int rsize, const std::string& mac, - AddressRange *rar); + AddressRange *rar); int reserve_addr_by_ip(int vid, unsigned int rsize, const std::string& ip, - AddressRange *rar); + AddressRange *rar); int reserve_addr_by_ip6(int vid, unsigned int rsize, const std::string& ip, - AddressRange *rar); + AddressRange *rar); // ************************************************************************* // Helpers @@ -437,7 +437,7 @@ protected: * Base constructor it cannot be called directly but from the * AddressRange factory constructor. */ - AddressRange(unsigned int _id):id(_id){}; + AddressRange(unsigned int _id):id(_id) {}; /* ---------------------------------------------------------------------- */ /* Address/AR helper functions to build/parse driver messages */ @@ -462,7 +462,7 @@ protected: * @param oss string stream to write the request to */ void addr_to_xml(unsigned int index, unsigned int size, - std::ostringstream& oss) const; + std::ostringstream& oss) const; /** * Check if the given MAC is valid for this address range by verifying: @@ -611,7 +611,7 @@ private: * @return 0 on success */ static int ip6_to_s(const unsigned int prefix[], const unsigned int mac[], - std::string& ip6_s); + std::string& ip6_s); static int ip6_to_s(const unsigned int ip6_i[], std::string& ip6_s); @@ -686,7 +686,7 @@ private: * Adds a new allocated address to the map. Updates the ALLOCATED attribute */ void set_allocated_addr(PoolObjectSQL::ObjectType ot, int obid, - unsigned int addr_index); + unsigned int addr_index); /** * Sets the address lease as used and fills a NIC attribute with the @@ -699,16 +699,16 @@ private: * @return 0 if success */ void allocate_by_index(unsigned int index, - PoolObjectSQL::ObjectType ot, - int obid, - VectorAttribute* nic, - const std::set& inherit); + PoolObjectSQL::ObjectType ot, + int obid, + VectorAttribute* nic, + const std::set& inherit); /** * Frees an address from the map. Updates the ALLOCATED attribute */ int free_allocated_addr(PoolObjectSQL::ObjectType ot, int obid, - unsigned int addr_index); + unsigned int addr_index); /** * Reserve a set of addresses from an starting one @@ -719,7 +719,7 @@ private: * @return 0 on success */ int reserve_addr_by_index(int vid, unsigned int rsize, unsigned int sindex, - AddressRange *rar); + AddressRange *rar); /* ---------------------------------------------------------------------- */ /* Restricted Attributes functions */ diff --git a/include/AddressRangeIPAM.h b/include/AddressRangeIPAM.h index 2ef740833e..e2b3e5cef0 100644 --- a/include/AddressRangeIPAM.h +++ b/include/AddressRangeIPAM.h @@ -26,9 +26,9 @@ class VectorAttribute; class AddressRangeIPAM : public AddressRange { public: - AddressRangeIPAM(unsigned int _id):AddressRange(_id){}; + AddressRangeIPAM(unsigned int _id):AddressRange(_id) {}; - virtual ~AddressRangeIPAM(){}; + virtual ~AddressRangeIPAM() {}; /* ---------------------------------------------------------------------- */ /* AddressRange Interface */ diff --git a/include/AddressRangeInternal.h b/include/AddressRangeInternal.h index 5d138019a9..07d3c2f4ad 100644 --- a/include/AddressRangeInternal.h +++ b/include/AddressRangeInternal.h @@ -26,9 +26,9 @@ class VectorAttribute; class AddressRangeInternal : public AddressRange { public: - AddressRangeInternal(unsigned int _id):AddressRange(_id), next(0){}; + AddressRangeInternal(unsigned int _id):AddressRange(_id), next(0) {}; - virtual ~AddressRangeInternal(){}; + virtual ~AddressRangeInternal() {}; /* ---------------------------------------------------------------------- */ /* AddressRange Interface */ diff --git a/include/AddressRangePool.h b/include/AddressRangePool.h index 9e0a0036cd..671e7173f5 100644 --- a/include/AddressRangePool.h +++ b/include/AddressRangePool.h @@ -89,8 +89,8 @@ public: * @return 0 on success */ int update_ar(std::vector ars, bool keep_restricted, - std::set& update_ids, std::unique_ptr& update_attr, - std::string& error_msg); + std::set& update_ids, std::unique_ptr& update_attr, + std::string& error_msg); /** * Allocates a new *empty* address range. It is not added to the pool as it * needs to be initialized. Only the AR_ID is set. @@ -121,7 +121,7 @@ public: * @return 0 if success */ int allocate_addr(PoolObjectSQL::ObjectType ot, int obid, - VectorAttribute * nic, const std::set &inherit); + VectorAttribute * nic, const std::set &inherit); /** * Allocates an address in a suitable address range from the pool by mac/ip @@ -175,13 +175,13 @@ public: * @param mac/ip the specific MAC/IP address requested */ void free_addr(unsigned int arid, PoolObjectSQL::ObjectType ot, int obid, - const std::string& mac); + const std::string& mac); void free_addr_by_ip(unsigned int arid, PoolObjectSQL::ObjectType ot, - int obid, const std::string& ip); + int obid, const std::string& ip); void free_addr_by_ip6(unsigned int arid, PoolObjectSQL::ObjectType ot, - int obid, const std::string& ip); + int obid, const std::string& ip); /** * Frees the given address by MAC/IP from all address ranges containing @@ -216,7 +216,7 @@ public: * @param rsize size of the address range */ int free_addr_by_range(unsigned int arid, PoolObjectSQL::ObjectType ot, - int obid, const std::string& mac, unsigned int rsize); + int obid, const std::string& mac, unsigned int rsize); /** * From a Security Group rule that uses this vnet, creates a new rule @@ -253,7 +253,7 @@ public: * @return 0 on success */ int reserve_addr(int vid, unsigned int rsize, unsigned int ar_id, - AddressRange *rar); + AddressRange *rar); /** * Reserve a number of addresses from an address range from a given ip/mac @@ -265,13 +265,13 @@ public: * @return 0 on success */ int reserve_addr_by_mac(int vid, unsigned int rsize, unsigned int ar_id, - const std::string& mac, AddressRange *rar); + const std::string& mac, AddressRange *rar); int reserve_addr_by_ip(int vid, unsigned int rsize, unsigned int ar_id, - const std::string& ip, AddressRange *rar); + const std::string& ip, AddressRange *rar); int reserve_addr_by_ip6(int vid, unsigned int rsize, unsigned int ar_id, - const std::string& ip, AddressRange *rar); + const std::string& ip, AddressRange *rar); // ************************************************************************* diff --git a/include/Attribute.h b/include/Attribute.h index dc44ecc93f..59beaa71f9 100644 --- a/include/Attribute.h +++ b/include/Attribute.h @@ -45,11 +45,11 @@ public: if ((size >0 && !(isalpha(aname[0]) || aname[0] == '_')) || (size >=3 && (aname[0]=='X' && aname[1]=='M' && aname[2]=='L'))) { - attribute_name.insert(0,"ONE_"); + attribute_name.insert(0, "ONE_"); } }; - virtual ~Attribute(){}; + virtual ~Attribute() {}; enum AttributeType { @@ -82,7 +82,7 @@ public: virtual void to_token(std::ostringstream& s) const = 0; virtual void to_xml(std::ostringstream& s, - const std::map> &hidden) const = 0; + const std::map> &hidden) const = 0; /** * Builds a new attribute from a string. @@ -145,7 +145,7 @@ public: , attribute_value(sa.attribute_value) {} - ~SingleAttribute(){}; + ~SingleAttribute() {}; /** * Returns the attribute value, a string. @@ -182,17 +182,17 @@ public: } void to_xml(std::ostringstream& s, - const std::map> &hidden) const override + const std::map> &hidden) const override { s << "<" << attribute_name << ">"; if (hidden.find(attribute_name) != hidden.end() ) { - s << "***"; + s << "***"; } else { - s << one_util::escape_xml(attribute_value); + s << one_util::escape_xml(attribute_value); } s << ""; @@ -282,7 +282,7 @@ public: {} VectorAttribute(const std::string& name, - const std::map& value) + const std::map& value) : Attribute(name) , attribute_value(value) {} @@ -296,12 +296,12 @@ public: VectorAttribute& operator=(const VectorAttribute& va) = default; - ~VectorAttribute(){}; + ~VectorAttribute() {}; /** * Returns the attribute value, a string. */ - const std::map& value() const + const std::map& value() const { return attribute_value; }; @@ -452,7 +452,7 @@ public: void to_xml(std::ostringstream& s) const override; void to_xml(std::ostringstream& s, - const std::map> &hidden) const override; + const std::map> &hidden) const override; void to_json(std::ostringstream& s) const override; @@ -467,7 +467,7 @@ public: /** * Replace the value of the given attribute with the provided map */ - void replace(const std::map& attr); + void replace(const std::map& attr); /** * The attributes from vattr will be copied to this vector @@ -560,7 +560,7 @@ private: static const int magic_sep_size; - std::map attribute_value; + std::map attribute_value; }; #endif /*ATTRIBUTE_H_*/ diff --git a/include/AuthManager.h b/include/AuthManager.h index 68dc136bf3..2c3142210a 100644 --- a/include/AuthManager.h +++ b/include/AuthManager.h @@ -29,17 +29,17 @@ class AuthRequest; class AuthManager : public DriverManager>, - public Listener + public Listener { public: AuthManager( - time_t timer, - const std::string& mads_location) - : DriverManager(mads_location) - , Listener("Authorization Manager") - , timer_thread(timer, [this](){timer_action();}) - , authz_enabled(false) + time_t timer, + const std::string& mads_location) + : DriverManager(mads_location) + , Listener("Authorization Manager") + , timer_thread(timer, [this]() {timer_action();}) + , authz_enabled(false) { } @@ -88,9 +88,9 @@ private: */ static const char * auth_driver_name; - /** - * True if there is an authorization driver enabled - */ + /** + * True if there is an authorization driver enabled + */ bool authz_enabled; /** diff --git a/include/AuthRequest.h b/include/AuthRequest.h index 0e2bbe4f4d..53619a6952 100644 --- a/include/AuthRequest.h +++ b/include/AuthRequest.h @@ -40,7 +40,7 @@ public: , self_authorize(true) {} - ~AuthRequest(){}; + ~AuthRequest() {}; /** * Authorization Request Type @@ -78,11 +78,11 @@ public: static Operation str_to_operation(const std::string& str) { - if (str == "USE") return USE; - else if (str == "MANAGE") return MANAGE; - else if (str == "ADMIN") return ADMIN; - else if (str == "CREATE") return CREATE; - else return NONE; + if (str == "USE") return USE; + else if (str == "MANAGE") return MANAGE; + else if (str == "ADMIN") return ADMIN; + else if (str == "CREATE") return CREATE; + else return NONE; }; /** diff --git a/include/BackupIncrements.h b/include/BackupIncrements.h index fe13f05186..f846821b16 100644 --- a/include/BackupIncrements.h +++ b/include/BackupIncrements.h @@ -36,7 +36,7 @@ class Increment : public ExtendedAttribute { public: - Increment(VectorAttribute *va, int id): ExtendedAttribute(va, id){}; + Increment(VectorAttribute *va, int id): ExtendedAttribute(va, id) {}; ~Increment() = default; @@ -90,7 +90,7 @@ public: case FULL: replace("TYPE", "FULL"); break; - case INCREMENT: + case INCREMENT: replace("TYPE", "INCREMENT"); break; } @@ -121,7 +121,7 @@ public: class IncrementSet : public ExtendedAttributeSet { public: - IncrementSet(): ExtendedAttributeSet(false){}; + IncrementSet(): ExtendedAttributeSet(false) {}; ~IncrementSet() = default; @@ -146,7 +146,7 @@ public: * @return Pointer to the new attribute */ VectorAttribute * new_increment(const std::string& source, long long sz, - Increment::Type type); + Increment::Type type); Increment * last_increment() { @@ -182,10 +182,10 @@ public: class IncIterator : public AttributeIterator { public: - IncIterator():AttributeIterator(){}; - IncIterator(const AttributeIterator& dit):AttributeIterator(dit){}; + IncIterator():AttributeIterator() {}; + IncIterator(const AttributeIterator& dit):AttributeIterator(dit) {}; - virtual ~IncIterator(){}; + virtual ~IncIterator() {}; Increment * operator*() const { @@ -229,7 +229,7 @@ private: class BackupIncrements { public: - BackupIncrements():_template(false,'=',"BACKUP_INCREMENTS"){}; + BackupIncrements():_template(false, '=', "BACKUP_INCREMENTS") {}; ~BackupIncrements() = default; diff --git a/include/BackupJob.h b/include/BackupJob.h index 94b5ef4483..7db6cae010 100644 --- a/include/BackupJob.h +++ b/include/BackupJob.h @@ -242,8 +242,8 @@ public: * @return 0 on success */ int replace_template(const std::string& tmpl_str, - bool keep_restricted, - std::string& error) override; + bool keep_restricted, + std::string& error) override; /** * Append new attributes to the *user template*. @@ -254,7 +254,7 @@ public: * @return 0 on success */ int append_template(const std::string& tmpl_str, bool keep_restricted, - std::string& error) override; + std::string& error) override; friend class BackupJobPool; friend class PoolSQL; @@ -296,7 +296,7 @@ protected: * @param db pointer to the database. * @return 0 on success. */ - int update(SqlDB * db) override; + int update(SqlDB * db) override; /** * Execute an INSERT or REPLACE Sql query. @@ -394,7 +394,7 @@ private: */ int process_backup_vms(const std::string& vms_new_str, const std::string& vms_old_str, - std::string& error); + std::string& error); /** * Remove Backup Job ID from Virtual Machines listed in BACKUP_VMS attribute diff --git a/include/BackupJobPool.h b/include/BackupJobPool.h index 0bee58927a..030c3e1c59 100644 --- a/include/BackupJobPool.h +++ b/include/BackupJobPool.h @@ -47,14 +47,14 @@ public: * -2 in case of template parse failure */ int allocate ( - int uid, - int gid, - const std::string& uname, - const std::string& gname, - int umask, - std::unique_ptr