84 Commits
Author SHA1 Message Date
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 ebbb7be5d4 M #-: Bump version 7.3.80 2026-03-30 09:58:53 +02:00
8f57c337e1 F OpenNebula/one#6778: Introduces a gRPC API server for OpenNebula Demon
This commit introduces a new API server based on the gRPC/Protobuf. The
API follow the design of the existing xml-rpc to ease the transition to
the new server and support the current state management engine.

Both API servers can be run in parallel.

Main changes:

- Decouple Generic and XMLRPC specific logic and add gRPC classes.
- Source code re-structure to include logic for each server
- New compilation options to generate gRPC stubs
- Client code for C++, Ruby, Python and Go

co-authored-by: Jan Orel <jorel@opennebula.io>
co-authored-by: Pavel Czerny <pczerny@opennebula.io>
co-authored-by: MarioRobres <mrobres@opennebula.io>
2026-01-12 14:58:55 +01:00
Tino Vázquez a64f071808 M #-: Bump year 2025 2025-02-28 11:56:18 +01:00
Ruben S. MonteroandPavel Czerny d2c0104747 F #6342: Support for cluster quotas
This feature adds support for VM quotas at cluster level. CLUSTER_IDS
can be set for a VM quota so the admin can limit the number of resources (e.g. VMs) a
user/group can create in a given cluster.

This commit also fixes:

- B #2226
- B #6823

Co-authored-by: Pavel Czerny <pczerny@opennebula.io>
2025-01-20 09:50:06 +01:00
Valentyn Bohdan c1725ddfbb M #-: Replace raw pointers with references/smart pointers. (#3285)
* M #-: Replace raw pointers with references/smart pointers.
- Change PoolSQL::allocate method's signature to accept reference instead of pointer and fix all method calls.
- Remove some of the error-handling goto, to be able initialize some variables during declaration.

Signed-off-by: Valentyn Bohdan <vbohdan@opennebula.io>
2024-11-21 13:19:12 +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
Tino Vázquez 3376afdaf0 M #-: Bump year 2023 2023-01-09 12:23:19 +01:00
Tino Vazquez f7d53e75ff M #-: Bump version 6.3.85 2022-04-07 19:49:58 +02:00
Vlastimil Holer 096754b63f M #-: Bump year to 2021 (#778) 2021-02-09 16:07:56 +01:00
Ruben S. MonteroandAlejandro Huertas 6da9f7f6c7 F #664: Image state events and hooks
- Image state events
   - Image hooks
   - Ruby OCA event-based state wait function
   - Improved market-import operations

co-authored-by: Alejandro Huertas <ahuertas@opennebula.io>
2021-02-08 16:10:34 +01:00
Ruben S. MonteroandPavel Czerny 0471e486b0 F #4396: Replace pthread with std::thread. Require C++14
co-authored-by: Pavel Czerny <pczerny@opennebula.systems>
2020-09-10 13:44:49 +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
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
Pavel Czerný 8d12e78fbe F #4032: Speed up C++ build (#4035)
In Nebula.h use forward declarations instead of #include
2019-12-10 11:45:14 +01: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
Ruben S. MonteroandAlejandro Huertas 2ed170be68 F #3076: create one.vmpool.infoextended
* Add new function dump_extended
    * Add new API call one.vmpool.infoextended (ruby, JAVA, golang)
    * Add parameter --extended in the CLI for onevm

Co-authored-by: Alejandro Huertas <ahuertas@opennebula.systems>
2019-03-29 12:43:59 +01:00
Christian González b2aab50f95 F #2671 Fix version bug and migrator for search option (#2869) 2019-01-31 17:09:47 +01:00
Ruben S. MonteroandChristian González 5f7fb402aa F #2671: Add oned search functionality. Add an index column to perform FTS searches server-side. New parameter has been added to the one.vmpool.info call, and --search option to CLI onevm list. This commits adds support for JAVA and migrator.
Co-authored-by: Christian González <cgonzalez@opennebula.systems>
2019-01-30 00:10:18 +01:00
Vlastimil Holer 441cf1f7f9 Bump version to 5.7.85, year to 2019 2019-01-16 11:47:59 +01:00
Christian González d921610d15 F #826 Authorize user/group to create restricted networks (#2625) 2018-11-20 17:24: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 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
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
Ruben S. Montero a2c5a4cbaa F #4809. Fix index in PoolSQL. Update interface in all classes 2017-06-21 03:22:56 +02:00
Javi Fontan 8de979e42c Bump version 5.3.80 2017-05-25 16:07:35 +02:00
Ruben S. Montero c8f77ab8be F #4809: Remove cache from core pools 2017-05-06 00:20:29 +02:00
Ruben S. Montero 289a09009a F #4714: Allow users to select objects owned just by the session's group 2016-09-30 17:31:49 +02:00
Javi Fontan e1f6dee180 Update copyright notice year 2016-05-04 12:33:23 +02:00
Ruben S. Montero 5761be4d10 feature #4217: Simplify Template, Attribute and PoolObjectSQL class interfaces 2016-02-05 00:33:37 +01:00
Jaime Melis e20fb5c4c4 Fix copyright in banners 2015-09-23 16:51:10 +02:00
Jaime Melis 8d00b74177 Change year to 2015 2015-02-24 12:27:59 +01:00
Ruben S. Montero ef510dfcd0 feature #3183: Do not include reservations in VNET/* and VNET/% rules for pool list and vnet show API calls 2014-09-23 20:19:14 +02:00
Carlos Martín 025092f157 Feature #2672: Disable cache for federation slave nodes 2014-01-24 18:27:36 +01:00
Ruben S. Montero 03914330a4 Fix merge of master branch 2014-01-23 17:07:52 +01:00
Javi Fontan 193e7a9cf6 feature #2371: add pagination to pool info
When the end_id of pool.info xmlrpc call is lower than -1 the parameters
do not refer to object ids but offset and cuantity used for pool pagination.r
The SQL query will have "LIMIT start_id,-end_id".
2014-01-13 16:30:43 +01:00
Jaime Melis 11520021f7 Bump to version 4.5.0 2014-01-09 11:51:20 +01:00
Carlos Martín 0bc0f4a353 Feature #1742: List resources from secondary groups 2013-08-23 15:36:43 +02:00
Carlos Martín a771e7e271 Feature #1613: Minor changes 2013-07-12 16:51:36 +02:00
Ruben S. Montero d32c736b5c feature #1613: Function to list the oids of a Pool. 2013-06-27 01:11:41 +02:00
Carlos Martín 9179e73a83 Feature #1611: Insert default quotas element in the USER & USER_POOL xmls
This saves the extra xmlrpc call each time the pool/user is shown
2013-02-28 14:53:34 +01:00
Jaime Melis 7357bffe34 Update copyright notice 2013-01-24 16:18:30 +01:00
Jaime Melis af61e33f8c Update year to 2013 2013-01-24 16:03:57 +01:00
Ruben S. Montero 29ad5368d2 feature #1013: Abstract hook registration. Add hook support for images, users and groups. 2012-10-09 11:56:01 +02:00
Ruben S. Montero 7e027ab089 feature #1013: Hook on drop method for PoolSQL 2012-10-07 23:33:19 +02:00
Ruben S. Montero 7ad3ce1965 feature #1099: Moved SQL filters to the corresponding pools 2012-05-05 03:18:25 +02:00