103 Commits
Author SHA1 Message Date
Ruben S. Montero 627bd22292 F #7971: Configurable algorithm for network leases
Adds new oned.conf parameter to configure oned IP allocation mode.

REUSE_ADDRESS: Reuse the first available address instead of assigning
addresses in round-robin order for internal address ranges.
2026-08-25 20:00:18 +02:00
Ruben S. Montero 8326215cf3 Revert "F #7971: Configurable algorithm for network leases (#4403)"
This reverts commit 567d5b7a95.
2026-08-25 20:00:03 +02:00
Pavel Czerný 567d5b7a95 F #7971: Configurable algorithm for network leases (#4403) 2026-08-25 19:31:21 +02:00
d48a32e252 F #7490: VLAN Groups for VNET multi-tenancy
This PR adds Group VLAN authorization rules for Virtual Network self-provisioning
through VN Template instantiation and VNET updates derived from a VN Template.

The feature lets administrators define VLAN usage policies at group level. These policies are
evaluated when users instantiate VN Templates or update VNETs that were instantiated from a VN
Template. Direct VNET allocation is not treated as the tenant self-provisioning path; the intended
multi-tenant model is to expose network creation through reservations and VN Template
instantiation, while direct VNET allocation remains an admin-controlled operation.

Group VLAN rules are stored under `VLAN_RULES` as `RULE` vector attributes.

Rule format:

```txt
RULE = [
  ID          = "5,6,100-200",
  SCOPE       = "CVLAN",
  VNTEMPLATE  = "10,20-30"
]

Fields:

- ID: VLAN values allowed by the rule. Supports single values and ranges, comma-separated.
    - Examples: "5", "5,6,100-200"

- SCOPE: VLAN attribute scope controlled by the rule.
    - Supported scopes: VLAN_ID, OUTER_VLAN_ID, CVLAN, VLAN_TAGGED_ID, ANY

- VNTEMPLATE: optional VN Template IDs where the rule applies.
    - Supports single values and ranges, comma-separated.
    - -1 or missing value means the rule applies to any VN Template.

Examples:

RULE = [
  ID = "100-200",
  SCOPE = "VLAN_ID",
  VNTEMPLATE = "10"
]

Allows VLAN_ID values from 100 to 200 when instantiating or updating VNETs derived from VN Template
10.

RULE = [
  ID = "300,400-450",
  SCOPE = "ANY",
  VNTEMPLATE = "-1"
]

Allows the listed VLAN IDs/ranges for any supported VLAN scope and any VN Template.

Rules are parsed into an internal structured representation when group VLAN data is loaded or
updated. Each rule is normalized into:

- scope
- VLAN ID ranges
- VN Template ID ranges

This avoids reparsing raw template attributes during authorization checks.

Validation is applied to these input scopes:

- VLAN_ID
- OUTER_VLAN_ID
- CVLAN
- VLAN_TAGGED_ID

VLAN_ID and OUTER_VLAN_ID are validated as single integer values. CVLAN and VLAN_TAGGED_ID accept
range expressions such as 5,6-10.

For each requested VLAN value or range:

1. The input is parsed into one or more test ranges.
2. Rules are scanned for matching scope, including ANY.
3. Rules are filtered by VN Template ID:
    - empty/-1 VNTEMPLATE matches all templates
    - explicit ranges match only included template IDs

4. A requested range is accepted only if it is fully covered by a single rule range.
5. The check passes when all requested ranges are covered.

Automatic VLAN selection is rejected when the user belongs to a group with VLAN rules matching the
target VN Template, including global rules. This avoids bypassing explicit group VLAN policy
through automatic allocation.

VNETs instantiated from VN Templates now preserve the source VN Template ID as a first-class VNET
attribute:

<VNET>
  ...
  <TEMPLATE_ID>...</TEMPLATE_ID>
  ...
</VNET>

TEMPLATE_ID = -1 means the VNET was created directly and was not instantiated from a VN Template.

This ID is immutable from user template updates:

- it is removed from the VNET template body on insert/update
- it is serialized as a top-level VNET attribute
- update operations use the stored value to validate VLAN authorization

A database migrator moves legacy TEMPLATE/TEMPLATE_ID values to top-level VNET/TEMPLATE_ID.

The tenant self-provisioning model for VNETs is based on controlled entry points:

- VNET reservations
- VN Template instantiation

Group VLAN authorization is enforced on VN Template instantiation and on updates to VNETs that were
instantiated from a VN Template.

Direct VNET allocation is not considered the tenant-facing self-provisioning path. It should remain
admin-controlled, as unrestricted VNET creation can expose other sensitive network attributes such
as PHYDEV, BRIDGE, and driver-specific configuration in addition to VLAN IDs.

Existing VNETs created from VN Templates may have the source template ID stored inside TEMPLATE/
TEMPLATE_ID. The migration step moves that value to top-level VNET/TEMPLATE_ID and removes it from
the template body.

This PR also updates the AR operations (add/del/update) so tenants can easily managed the VNET instantiations.

Existing directly-created VNETs will have no source VN Template and are treated as TEMPLATE_ID =
-1.

Existing group objects without VLAN rules are initialized with an empty VLAN_RULES section,
preserving current behavior until rules are explicitly configured.

Configuration compatibility:

- VLAN_ID, CVLANS, and AR/VLAN_ID are no longer expected to be handled through generic VNET
  restricted attributes for the VN Template instantiation flow.

- OneCfg migration/update handling for configuration files will be addressed separately before
    release.

co-authored-by: Pavel Czerny <pczerny@opennebula.io>
co-authored-by: Miguel E. Ruiz <mruiz@opennebula.io>
co-authored-by: dcarracedo <dcarracedo@opennebula.io>
2026-06-24 11:26:36 +02:00
Ruben S. Montero 41fbb21f61 F #1536, #7253: Minor fixes
* Fix range wrapping in multi-leases ranges (i.e. not use 8,9,0)
* Skip reservations and shared AR's in fsck.
* Do not reserve MAC addresses on VNET reservations
* Release MAC ID's on virtual network drop (with existing AR's)
* NEXT_INDEX is an internal attribute (cannot be set by user)
* Check size on update
2026-05-27 13:36:54 +02:00
Ruben S. Montero 2b9100999a F #1536, #7253: Fix global MAC accounting and AR allocation edge cases
* Skip global MAC ID release for reservation ARs because the parent AR owns the bitmap entry.
* Reject global MAC address ranges whose SIZE crosses the reserved 20-bit host block.
* Release reserved global MAC IDs when AR initialization fails after MAC assignment.
* Treat shared ARs as having no global MAC ID so bitmap release paths ignore them.
* Wrap multi-lease range scans correctly so allocation can find ranges starting at index 0.
* Keep IP6 in expanded security-group rules by removing allocator-only NEXT_INDEX from copied AR fields.
* Remove the leftover VNC bitmap debug dump from onedb fsck.
2026-05-27 11:54:08 +02:00
8fc632ec4e F #1536, #7253: Implement global MAC adress space and MAC parsing
New configuration attribue MAC_GLOBAL_SPACE in oned.conf to enable the global
MAC address space generation mode.

MAC addresses are generated from a global pool preventing collisions across
VNETs. This does not apply to IP networks and limits the number of VNETs to
2^20, with a max of 2^20 leases per VNET.

This commit also implementes:
  * A round-robin assignment of addresses. (jukka.jokiniva@qt.io)
  * Optimizes the storing of the BitMap - do not store leading zeros

co-authored-by: Pavel Czerny <pczerny@opennebula.io>
co-authored-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
2026-05-26 18:02:39 +02:00
Ruben S. Montero ebbb7be5d4 M #-: Bump version 7.3.80 2026-03-30 09:58:53 +02:00
Tino Vázquez a64f071808 M #-: Bump year 2025 2025-02-28 11:56:18 +01:00
Tino Vázquez 05d147c524 M #-: Bump version 6.10.0
Also bump copyright year to 2024
2024-07-29 14:27:11 +02:00
Pavel Czerný 2fe396ae15 L #-: Add Astyle linting
* Add AStyle to smoke tests
* Format C++ files using AStyle
2024-06-03 11:40:24 +02:00
Pavel Czerný 8e7ff2ed36 F #6103: Last set of CppCheck issues (#2481)
(cherry picked from commit 4a9662a551)
(cherry picked from commit d7b7303f8f)
2023-02-07 08:56:52 +01:00
Tino Vázquez 3376afdaf0 M #-: Bump year 2023 2023-01-09 12:23:19 +01:00
865908de1c F #5989: Live update of Virtual Network attributes
co-authored-by: Pavel Czerný <pczerny@opennebula.systems>
co-authored-by: Frederick Borges <fborges@opennebula.io>
co-authored-by: Christian González <cgonzalez@opennebula.io>

* VNET updates trigger a driver action on running VMs with NICs in the
  network.

* VNET includes a sets with VM status: updated, outdated, error and
  updating. With VMs in each state.

* VNET flags error situations with a new state UPDATE_FAILURE.

* The same procedure is applied when an AR is updated (only VMs in that
  AR are updated).

* A new options in the one.vn.recover API call enable to recover or
  retry this VM update operations.

* The following attributes can be live-updated per VNET driver:
    - PHYDEV (novlan, vlan, ovs driver)
    - MTU (vlan, ovs driver)
    - VLAN_ID (vlan, ovs driver)
    - QINQ_TYPE (ovs driver)
    - CVLANS (ovs driver)
    - VLAN_TAGGED_ID (ovs driver)
    - OUTER_VLAN_ID (ovs driver)
    - INBOUND_AVG_BW (SG, ovs driver + KVM)
    - INBOUND_PEAK_BW (SG, ovs driver + KVM)
    - INBOUND_PEAK_KB (SG, ovs driver + KVM)
    - OUTBOUND_AVG_BW (SG, ovs driver + KVM)
    - OUTBOUND_PEAK_BW (SG, ovs driver + KVM)
    - OUTBOUND_PEAK_KB (SG, ovs driver + KVM)

* New API call one.vm.updatenic, allows to update individual NICs
  without the need of detach/attach (only QoS supported).

* Update operations for: 802.1Q, bridge, fw, ovswitch, ovswitch_vxlan
  and vxlan network drivers.

* VNET attributes (old values) stored in VNET_UPDATE to allow
  implementation of update operations. The attribute is removed after a
  successful update.

* Updates to CLI onevnet (--retry option) / onevm (nicupdate command)

* XSD files updated to reflect the new data model

* Ruby and JAVA bindings updated: new VNET state and recover option, new
  VM API call.

* Suntone and Fireedge implementation (lease status, recover option, new
  states)

TODO: Virtual Functions does not support this functionality

iii
2022-11-16 15:06:49 +01:00
4b746348b3 f #5725: State for Virtual Networks
* VNETs include state to flag their configuration status
  (READY/ERROR/LOCK)
* Hooks can be program based on VNET state transitions
* Include Java/Go/Ruby bindings
* New vCenter network drivers
* Place-holder to customize actions (create/delete) for other netowrk drivers
* Sunstone integration
* OneFlow syncs flow creation on VNET status
* Remove deprecated vcenter hooks and autoregistration

co-authored-by: Frederick Ernesto Borges Noronha <fborges@opennebula.io>
co-authored-by: Alejandro Huertas <ahuertas@opennebula.io>
co-authored-by: Pavel Czerny <pczerny@opennebula.systems>
2022-04-09 15:20:17 +02:00
Tino Vazquez f7d53e75ff M #-: Bump version 6.3.85 2022-04-07 19:49:58 +02:00
Pavel Czerný de6d7dd150 B #2187: Increase AR size from 32 bit to 64 bit (#1295) 2021-06-24 10:52:46 +02:00
Vlastimil Holer 096754b63f M #-: Bump year to 2021 (#778) 2021-02-09 16:07:56 +01:00
Pavel Czerný 3ea67d3645 F #4936: Reduce number of new/delete, use unique_ptr (#212)
* On exit stop RequestManager first

* Use unique_ptr for pointers to Template

* Reduce number of new/delete
2020-09-15 11:16:00 +02:00
Ruben S. MonteroandPavel Czerný 5ce49ed404 F #4936: Refactor pools to use unique_ptr
co-authored-by: Pavel Czerný <pczerny@opennebula.systems>
2020-09-10 09:08:29 +02:00
Pavel Czerný daaf132a43 F #4936: Remove 'using namespace std' from headers (#60) 2020-07-02 22:42:10 +02:00
Ruben S. MonteroandPavel Czerny a3d8d4a65e F #4936: Refactor Driver and Message classes in OpenNebula daemon
co-authored-by: Pavel Czerny <pczerny@opennebula.systems>
2020-06-29 12:14:00 +02:00
Vlastimil Holer f3c50a5d89 M #-: Year bump to 2020 (#4634) 2020-04-30 15:00:02 +02:00
Ruben S. Montero 9aa1041103 F #3600: Initial PostgreSQL Support
co-authored-by: Igor Sivy <igorsivy@gmail.com>
co-authored-by: Pavel Czerny <pczerny@opennebula.io>
co-authored-by: Vlastimil Holer <vholer@opennebula.io>
(cherry picked from commit c52f62018c32281c6e418211f33f1bba46388e98)
2020-04-13 17:35:06 +02:00
Ruben S. MonteroandAlejandro Huertas 3c2df22ad7 F #3064: separate encrypted attrs by objects
* There are encrypted attributes for VMs, Hosts and VNets
    * For VMs the user template is also encrypted
    * For VNets its address ranges attributes are also encrypted

Co-authored-by: Alejandro Huertas <ahuertas@opennebula.systems>
2019-09-12 16:25:23 +02:00
Ruben S. MonteroandChristian González 6143dd95ce F #3380: New Hook system. Drivers, oned and command line tool
Co-authored-by: Christian González <cgonzalez@opennebula.systems>
2019-09-09 14:47:42 +02:00
Vlastimil Holer 441cf1f7f9 Bump version to 5.7.85, year to 2019 2019-01-16 11:47:59 +01:00
Ruben S. Montero f54e066949 F #2489: Improve performance of oned:
* Reduce memory footprint
    * Improve connection handling in the RequestManager
    * Reduce the number of locking calls
    * Reduce the size of the VM pool
2018-10-09 11:15:59 +02:00
Ruben S. Montero a69baeee1a B #2486: Do not use in-memory VLAN ID maps to work in HA
(cherry picked from commit 3e1661ea4b)
2018-10-08 18:13:18 +02:00
Ruben S. Montero 21fe311681 F #2183: Use pager for list commands (e.g. onevm list). Support for
custom ordering (by ID) in list API calls, this can be set per user,
group and default in oned.conf
2018-08-06 14:16:00 +02:00
juanmont 21a2bd49b3 Added new param to header documentation 2018-05-31 16:41:41 +02:00
Ruben S. Montero d8e579d5a3 Extend auth methods to set lock checks 2018-05-31 12:50:02 +02:00
juanmont 098ce33e79 F #1976: Test access rights to the security groups of a VNet and its ARs 2018-04-27 16:31:12 +02:00
Ruben S. Montero 37222d65dc F #1792: Greatly improve concurrency by: Remove big lock on pool control class. Increase number of MySQL connections (new configuration variable). Make all parser reentrants. This commit also simplifies the pool references.
(cherry picked from commit a3d3ceb771034794c4fb453dcd9aaff64c53baed)
2018-03-17 23:35:21 +01:00
Vlastimil Holer a4c0447ccf Bump year to 2018 (#1623) 2018-01-02 18:27:37 +01:00
Javi Fontan 8de979e42c Bump version 5.3.80 2017-05-25 16:07:35 +02:00
Ruben S. Montero bca17f4ee6 F #4809: Update SqlDB method name. DO NOT replicate monitoring data 2017-04-21 19:16:45 +02:00
Ruben S. Montero a6d4ab3c9f F #4809: Update Sql database interface to include read/write/bootstrap
operations
2017-04-18 17:12:19 +02:00
Ruben S. Montero ba40cffd61 F #5027: Operations (hold, release, reserve...) for IP6 no-slaac ARs 2017-02-21 16:50:45 +01:00
Ruben S. Montero 7cbceb043b Added VirtualMachineNic interface to abstract NIC logic 2016-12-24 01:36:30 +01:00
Ruben S. Montero 57976f61c2 Bug #4516: Fix deadlock with concurrent reservations on the same
vnet.
2016-06-03 19:19:23 +02:00
Javi Fontan e1f6dee180 Update copyright notice year 2016-05-04 12:33:23 +02:00
Jaime Melis f1b56ed322 Bug #4376: Make vlan_id_automatic a top level attribute
and only allow modification of vlan_id if vlan_id_automatic
is set to false (the vlan_id has been specified manually)
2016-04-19 15:23:22 +02:00
Jaime Melis e4db6af0ea Bug #4376: Fix typo 2016-04-19 15:23:22 +02:00
Ruben S. Montero 67ba59ada1 feature #3848: Remove VN_MAD from Host in oned. Remove VMWare driver in
core
2016-04-07 11:06:43 +02:00
Ruben S. Montero 8970665d46 bug-4376: Adds vlan bitmap to handle collition and reservation.
OpenNebula now generates the vlan_id instead of the drivers
2016-04-06 18:07:56 +02:00
Carlos Martín e8a05ca1d7 Feature #4369: Replace cluster ID with a set of IDs 2016-03-10 16:28:33 +01:00
Ruben S. Montero 5761be4d10 feature #4217: Simplify Template, Attribute and PoolObjectSQL class interfaces 2016-02-05 00:33:37 +01:00
Carlos Martín 68a0184ed2 Feature #4215: Implement auth & quotas for all VR actions 2016-02-01 17:07:04 +01:00
Carlos Martín a4b466fa6a Feature #4215: New method vrouter.attachnic 2016-01-28 16:06:18 +01:00