Commit Graph
2309 Commits
Author SHA1 Message Date
54d9fd6f0c F OpenNebula/one#7638: Add Open vSwitch port mirroring
Add port mirroring for Virtual Networks using the ovswitch and ovswitch_vxlan drivers, allowing selected VM interfaces to send copies of their traffic to external monitoring tools. Support RSPAN output through a VLAN and GRE or ERSPAN tunnels, including ERSPAN types II and III.

Introduce Virtual Network MIRROR definitions with an automatically assigned MIRROR_ID, NAME, optional DESCRIPTION, and TYPE. Select source interfaces through PORTS, expressed as comma-separated VM_ID:NIC_ID pairs, control traffic direction with DIRECTION (IN, OUT, or BOTH, the default), and optionally filter traffic with VLANS.

Configure RSPAN destinations with OUTPUT_VLAN, and GRE or ERSPAN destinations with REMOTE_IP and optional LOCAL_IP. The local address accepts either an IPv4 address or an interface:<name> reference resolved on each host. ERSPAN adds ERSPAN_TYPE and ERSPAN_KEY, with ERSPAN_INDEX for type II and ERSPAN_HWID for type III. Validate required fields, numeric ranges, and incompatible attribute combinations.

Expose mirror creation, configuration updates, source-port membership changes, and deletion through XML-RPC and gRPC, with Ruby, Java, and Go client support and corresponding onevnet mirror-* commands. Add a Sunstone Port Mirroring tab with creation and editing forms, source-interface selection, configuration review, and mirror details. Require administrative permissions on the Virtual Network and selected source VMs; manage definitions through the dedicated mirror APIs.

Integrate mirror configuration with VM networking operations so host OVS state follows NIC activation, updates, and deactivation, and released NICs are removed from mirror membership. Serialize shared mirror changes under a host lock, apply OVS updates in a single transaction, and clean up unused managed tunnel outputs. Configuration updates preserve source membership, membership changes target affected VMs, and mirrors must have all source ports removed before deletion.

co-authored-by: Alejandro Aizel <aaizel@opennebula.io>
co-authored-by: Daniel Clavijo Coca <dclavijo@opennebula.io>
co-authored-by: Pavel Czerny <pczerny@opennebula.io>
co-authored-by: David Carracedo <dcarracedo@opennebula.io>
2026-11-03 14:04:07 +01:00
Pavel Czerný f88b9e57a9 M #-: Improve token security (#4598)
* Replace AES-CBC by AES-GCM

* Increase entropy of generated passwords

* Verify server authentication target user and fix login using EGID
2026-11-02 18:47:06 +01:00
Pavel Czerný 7b563870f3 M #-: Validate MD5 and SHA1 attributes (#4646) 2026-11-02 14:19:19 +01:00
MarioRobresandRene Peinthor 4ef465ca16 F #-: Support interactive backups for third party storage drivers (#4675)
Interactive backups were limited to a fixed list of TM drivers in
VirtualMachineDisk::support_interactive(), so third party storage
drivers could not use them, even with a OneBEX exporter of their own.

The TM_MAD_CONF of a driver can now enable them:

  INTERACTIVE_BACKUP         = "YES" | "NO"
  INTERACTIVE_BACKUP_FORMATS = comma separated list of image formats,
                               empty for all formats

The default oned.conf sets them for the drivers that supported
interactive backups so far. If INTERACTIVE_BACKUP is not set, e.g. with
the oned.conf of a previous release, the former built-in list is used.

Adding an exporter required editing config/environment.rb and
app/helpers.rb, which are overwritten on every upgrade.

OneBEX now loads every file in the exporters directory and each
exporter registers itself with OneBEX::Exporters.register, so a third
party exporter only needs to be installed in remotes/onebex/exporters
(and synced to the hosts). An exporter that fails to load is skipped
instead of breaking the others, and the error is logged when the server
starts.

Signed-off-by: Rene Peinthor <rene.peinthor@linbit.com>
Co-authored-by: Rene Peinthor <rene.peinthor@linbit.com>
2026-11-02 13:41:58 +01:00
Ruben S. Montero 1098e13f0b Revert "F OpenNebula/one#8165: disk attach and detach on VM in HOLD state"
This reverts commit 9a1002b378.
2026-10-27 14:34:01 +01:00
Pavel Czerný 77ba107915 M #-: Improve C++ rebuild time (#4554) 2026-10-19 14:20:08 +02:00
2fde509fba F OpenNebula/one#7671: Select SR-IOV VFs by parent physical function
Allow PCI requests to select an available VF using PF_IFNAME or
PF_ADDRESS. Reserve fixed PCI addresses before PF and generic selectors
to keep availability checks and allocation consistent.

Monitor PF/VF relationships and eswitch mode, refresh PCI network
metadata, and prevent passthrough of PFs with enabled VFs. Preserve
compatibility with older probes.

Expose PF interface selection and VF availability in Sunstone, preserve
selectors when editing templates, and update the host XML schema.

co-authored-by: Victor Hansson <vhansson@opennebula.io>
co-authored-by: Daniel Clavijo Coca <dclavijo@opennebula.io>
2026-10-19 13:10:56 +02:00
Author: MarioRobres 9a1002b378 F OpenNebula/one#8165: disk attach and detach on VM in HOLD state
VMs coming from UNDEPLOYED/STOPPED cannot disk attach on HOLD
2026-10-15 16:54:52 +02:00
Pavel Czerný 817d3e427b M #-: Restore stream conversion (#4519)
* Avoid small risk of different usage of locale compared to std::to_string
2026-09-15 12:15:52 +02:00
Pavel Czerný 47a803f842 M #-: Some minor C++ speed optimization (#4514)
* Cache VNC reservation BitMap
* Optimize xpath - no need to create vector<string> as we always use the
first value
* Optimize VectorAttribute::replace
* Use string_view in Attribute and Template
* Avoid temporary stream in escape_xml
2026-09-14 15:21:41 +02:00
Pavel Czerný 9834c11567 M #-: Switch to C++20 (#4503) 2026-09-14 13:28:19 +02:00
Daniel Clavijo Coca c10d87dfdc B OpenNebula/one#8028: Refactor OVS vlan configuration (#4481) 2026-09-02 18:30:33 +02:00
Pavel Czerný 9fe8bd7c44 F #7974: Parsing ARs preserves order (#4467) 2026-08-31 17:38:58 +02:00
MarioRobres d35394f90e F OpenNebula/one#7986: Improve unsupported drivers logging for interactive backups (#4443) 2026-08-27 17:50:33 +02:00
Pavel Czerný dfa57cab08 B #7938: Fix VLAN authorization for unchanged values (#4457) 2026-08-27 11:10:39 +02:00
Pavel Czerný d19024969f F #7977: Log replication and hearbeats (#4411)
*  Optimize logging of ddebug and dddebug messages. Lazy stream builder: Avoid composing of expensive long strings, if the
message is discardad because of log level
2026-08-26 13:46:35 +02:00
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
Pavel Czerný 74b72ed048 B #7974: Fail fast on invalid internal address ranges (#4398) 2026-08-25 17:19:32 +02:00
Pavel Czerný d795b213e4 B #7941: Disable repeated values for Cluster template (#4371) 2026-08-04 11:11:26 +02:00
Ruben S. Montero ec563d86dc M #-: Bump OpenNebula and DB version to 7.6.0 2026-07-17 10:57:26 +02:00
Pavel Czerný 89920015db M #-: Fix VM permissions level (#4311)
* Fix authorization for onevm exec* operations
* Enlarge ActionSet to fit VMGROUP_DEL_ACTION=65
2026-07-15 15:01:05 +02:00
Ruben S. Montero 1d421ca89d M #-: Bump version to 7.3.85 2026-07-14 08:38:08 +02:00
Pavel Czerný 2a92439075 M #-: Fix memory sanitizer issues (#4305)
* Fix crash in GRPC reading reference to temporary value
* Fix `oned -i` memory management and return code
2026-07-10 13:43:25 +02:00
Pavel Czerný 8993d92a58 M #-: Minor changes to parsing Vector attributes (#4298)
- if possible use vector<unique_ptr<Attribute>> as argument for Template::remove for automatic cleanup
- if possible use 'VectorAttributeinstead ofAttributeforTemplate::remove- theremovemethod has dynamic cast to correct type and deletes attributes, which can't be casted. So no need to add loop with casting after theremove` method
- At few places added checks for empty vector to avoid very rare crashes on malformed Templates
2026-07-09 15:49:11 +02:00
Ruben S. Montero 4b00876502 F #7615: add selected disk support for backups
Add DISK_IDS as part of the VM backup configuration so backups can target a
subset of eligible VM disks. The configuration parser now normalizes and
validates the list against the VM and resets the incremental chain when the
selected disk set changes.

co-authored-by: Pavel Czerny <pczerny@opennebula.io>
(cherry picked from commit 59c2cac474de545eddd642e03e3caac8fb47c1cc)
2026-07-01 22:29:39 +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
Pavel Czerný 87d55b2cf9 F #7678: Dummy NIC interface for VM (#4251) 2026-06-12 14:29:08 +02:00
Pavel Czerný 609a1cdd2b M #-: Fix compiler warning in SchedMatch (#4261) 2026-06-12 13:57:59 +02:00
Pavel Czerný d806c4bd22 B #7736: Fix CDROM hot-attach without target or dev-prefix (#4259) 2026-06-11 17:39:16 +02:00
MarioRobresandRuben S. Montero 7a69805a8d F OpenNebula/one#7660: Interactive Backup EXport server for third-party backup/restore solutions (#4260)
This commit introduces a new backup driver based on an "interactive" server. The purpose is to ease the integration of third-party backup systems so they are able to pull backups/increments from the hypervisors:

 - New backup driver
 - New OpenNebula Backup Exporter (OneBEX). The REST API supports: status,
   export, exporters, blocks, data and finish.
 - Initial support for file based virtual disks (incrementals only support CBT)
 - Refactor backup_qcow2 to accomodate the new logic
 - New restore logic to directly write images to the datastore from the backup service. 

Co-authored-by: Ruben S. Montero <rsmontero@opennebula.org>
2026-06-11 17:27:41 +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
Daniel Clavijo Coca 30169f12dd F OpenNebula/one#7673: Adjust vhost socket dir (#4206) 2026-05-13 15:20:23 +02:00
Pavel Czerný 7f6b45ecc4 F #4159: Allow dynamic VMGroup management (#4172) 2026-05-11 10:58:30 +02:00
Pavel Czerny 80eefac1e0 M #-: Trim all input Template values 2026-04-27 09:38:32 +02:00
Ruben S. MonteroandGuillermo Ramos 16c1ccf4bc F one#5774: Add per-VM live migration options
Add support for per-VM migration flags (--auto-converge and --compressed)
controlled by VM template attributes:

- MIGRATE_AUTO_CONVERGE: Initial CPU throttling rate/increment (ranges: 0-100).
  Format: <initial>[,<increment>]
- MIGRATE_COMPRESSED: Enable migration compression (YES/NO). Default: NO

This commit also adds a FEATURES parser and use it during VM creation and updateconf.

The parser normalizes boolean FEATURES values, validates GIC and MIGRATE_AUTO_CONVERG.

Since FEATURES are normalized in oned, the commit removes some redundant checks.

updateconf allow updates GIC, RAS, MIGRATE_* options

See also https://libvirt.org/manpages/virsh.html#migrate

Author: Guillermo Ramos <gramos@opennebula.io>

co-authored-by: Guillermo Ramos <gramos@opennebula.io>
co-authored-by: Ruben S. Montero <rsmontero@opennebula.org>

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
2026-04-21 13:36:50 +02:00
Pavel Czerný 1605a4e97b F #7487: Configurable API result log length (#4164) 2026-04-21 10:36:37 +02:00
Pavel Czerný 1521a12d45 B #7349: Correctly revert all changes in case of VM deploy failure (#4156)
* New generic class to implement complex rollback logic (ScopeGuard)
* Specialization for VirtualMachine API (DeployGuard)
2026-04-20 11:25:34 +02:00
Pavel Czerný 9008393150 M #-: Unify node_id type to int in NUMA (#4148) 2026-04-09 10:15:45 +02:00
Pavel Czerný 3c5be63466 M #-: Bumb DB version to 7.4.0 (#4139) 2026-03-31 12:30:59 +02:00
Ruben S. Montero ebbb7be5d4 M #-: Bump version 7.3.80 2026-03-30 09:58:53 +02:00
Pavel Czerný e219d6e872 M #-: C++ linting (#4122) 2026-03-25 12:20:23 +01:00
d8e0ee2036 F #7373: FSaaS (File System as a Service) for OpenNebula
NAME   = test_ds
DS_MAD = virtiofs
TM_MAD = local
TYPE   = IMAGE_DS
DISK_TYPE = FILESYSTEM

oneadmin@ubuntu2204-kvm-ssh-7-0-f4a9-0:~$ cat img.txt
NAME="test_fs"
TYPE="FILESYSTEM"
PATH="/var/tmp/sharedfs_test"
PERSISTENT="YES"
PERSISTENT_TYPE="SHAREABLE"

DISK=[
  IMAGE_ID="21" ]

Notes:

* Same FS image cannot be used twice in the same VirtualMachine, nor the
  same tag twice
* OpenNebula will generate a MOUNT_POINT = /mnt/one-fs-<image_id> and a
  MOUNT_TAG = one-tag-<image_id>. Both can be overwritten at DISK level.
* When using Hugepages in the VM that will be used for virtiofs and
  memory access will default to shared. Do not use
  MEMORY_ACCESS='private'
* If not using hugepages the VM will use memfd as memoryBacking source
  if it includes a filesystem.
* OpenNebula will map FS access (UID/GID) to a given user that can be
  configured per host, cluster or globally in vmm_exec_kvm.conf. By
  default all access is mapped to oneadmin account.
* Datastore monitorization will report 0 free/used/total size. Images,
  representing the FS folder, reports size as the result of a du -sb
  command.
* Most of the disk operations do not apply to filesystem disks: resize, snapshots,
  save-as, backup.

co-authored-by: MarioRobres <mrobres@opennebula.io>
co-authored-by: Marco Mancini <mmancini@opennebula.io>

Signed-off-by: MarioRobres <mrobres@opennebula.io>
Signed-off-by: Marco Mancini <mmancini@opennebula.io>
2026-03-18 09:57:54 +01:00
Ruben S. Montero 830e34a38a F #7511: DPDK nic attach and socket paths
- vmm,vnm: unify OVS DPDK vhost socket handling
- Use a shared /var/lib/one/vhost-sockets path for OVS DPDK interfaces in the KVM and Open vSwitch drivers, and create the directory when needed.
- Also fix DPDK NIC attach/detach to use the vhostuser device XML.
2026-03-16 16:16:30 +01:00
Ruben S. Montero 81fd8e353b Revert "F #7373: FSaaS (File System as a Service) for OpenNebula"
This reverts commit fa72e8fd7f.
2026-02-26 19:24:53 +01:00
Ruben S. Montero bb6bb45a2a F #913: Add DS_LIVE_MIGRATE attribute
Add new attribute to prevent migrations on unsopported drivers. Add
migrator to add it to DS templates

coauthored-by: Guillermo Ramos <gramos@opennebula.io>
Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
2026-02-26 11:58:33 +01:00
fa72e8fd7f F #7373: FSaaS (File System as a Service) for OpenNebula
NAME   = test_ds
DS_MAD = virtiofs
TM_MAD = local
TYPE   = IMAGE_DS
DISK_TYPE = FILESYSTEM

oneadmin@ubuntu2204-kvm-ssh-7-0-f4a9-0:~$ cat img.txt
NAME="test_fs"
TYPE="FILESYSTEM"
PATH="/var/tmp/sharedfs_test"
PERSISTENT="YES"
PERSISTENT_TYPE="SHAREABLE"

DISK=[
  IMAGE_ID="21",
  MOUNTPOINT="/mnt",
  TARGET="disk0_tag" ]

co-authored-by: MarioRobres <mrobres@opennebula.io>
co-authored-by: Marco Mancini <mmancini@opennebula.io>

Signed-off-by: MarioRobres <mrobres@opennebula.io>
Signed-off-by: Marco Mancini <mmancini@opennebula.io>
2026-02-26 11:18:38 +01:00