Commit Graph
297 Commits
Author SHA1 Message Date
Jan Orel 82196ef2be B #7899: Fix the remote scripts directory handling (#4379)
The remote scripts directory (former SCRIPTS_REMOTE_DIR) is now fixed
to /var/lib/one-remotes and the configuration attribute is gone. The
old default /var/tmp/one was broken in several ways: /var/tmp content
is aged away by systemd-tmpfiles, the world-writable parent allows
squatting on the directory, and the configurable location was silently
not honored by many drivers, probes and static files (sudoers,
AppArmor, tmpfiles, cron).

  - The remotes are synced to /var/lib/one-remotes on the hosts; the
    directory is created by the node packages, as it cannot be created
    by the unprivileged oneadmin
  - The node monitoring DB moves along to /var/lib/one-remotes-db;
    it cannot live inside the remotes directory as the sync
    (rsync --delete) would remove it. The monitord client migrates
    the DB from the legacy location on its first start
  - Helpers executed through sudo are installed at a fixed path
    (/usr/lib/one/sbin) by the node packages, so they are no longer
    executed from an oneadmin-writable location
  - Remote hooks (REMOTE = yes) run from /var/lib/one-remotes/hooks.
    Hook commands given as an absolute path are executed as-is and
    must be updated manually
  - Fix remotes sync to run the mkdir on the host: the local shell
    interpreted the unquoted ';' and ran it on the frontend instead
  - onecfg migrator drops SCRIPTS_REMOTE_DIR from oned.conf and the
    stock :remote_hook_base_path from onehem-server.conf
2026-10-01 15:23:47 +02:00
Pavel Czerný 86a5f538d5 F #7971: Add REUSE_ADDRESS to xml schema (#4468) 2026-08-31 17:20:22 +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
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
Pavel Czerný 3fbe3b7194 M #-: Create NEXT_INDEX on AR creation (#4241)
Linting opennebula_vm.rb
2026-05-29 09:00:37 +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 319e3b05fe F OpenNebula/one#7509: Explicit SRIOV info (#4215) 2026-05-14 12:22:45 +02:00
Guillermo Ramos ba9d43f548 F #OpenNebula/one#7509: fix (sort) schema definition (#4209)
Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
2026-05-13 15:29:30 +02:00
Guillermo Ramos 1378462bb2 F #OpenNebula/one#7509: update schema definition (#4203)
Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
2026-05-12 13:18:48 +02:00
Pavel Czerný 1605a4e97b F #7487: Configurable API result log length (#4164) 2026-04-21 10:36:37 +02:00
Pavel Czerný 684ec4f4a0 M #-: Update xml-schemas (#4141)
* Add LOCK attribute
* Use LOCK, PERMISSIONS adn IDS attributes from shared, if possible
2026-04-06 15:19:35 +02:00
MarioRobres 3d82493cfe M #-: add DATASTORE_CAPACITY_CHECK to opennebula_configuration.xsd (#4115) 2026-03-19 12:03:28 +01:00
Pavel Czerný ee3daf5e5e M #-: Purge unused attributes from config xml-schema (#4090) 2026-03-01 14:25:33 +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
MarioRobres 9c360a6ea6 M #-: add DS_MIGRATE_SNAP to XSD schema (#4069) 2026-02-18 11:21:55 +01:00
bffbecedc0 F #913: Storage live migration
The following TM's now support storage live migrations:

- File system based (local and shared variants)
- LVM based (pure LVM, and LVM thin)

The LVM TM's does not support migrating a VM with disk snapshots.

co-authored-by: Guillermo Ramos <gramos@opennebula.io>
co-authored-by: josepselga <jselga@opennebula.io>

Author: Guillermo Ramos <gramos@opennebula.io>
2026-02-17 09:45:33 +01:00
MarioRobres 21f550e9f8 M #-: fix AR Shared xsd schema (#4056) 2026-02-11 13:13:48 +01: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
Ruben S. Montero bebf710f8a F #7331: Add support for memory encryption
This commit adds support for memory encryption. It includes:

* A new VM template attribute to set memory encryption
* A host probe to gather the memory extensions available (SEV,
  SEV-ES...)
* When selected AUTOMATIC_REQUIREMENTS include memory encryption as a
  requirement
* Domain XML generation has been updated to include memory encryption
  attributes
* A kvm.conf attribute MEMORY_TUNE_OFFSET to add an additional memory
  offset for encryption.

Author: MarioRobres <mrobres@opennebula.io>
Author: Daniel Clavijo Coca <dclavijo@opennebula.io>
2025-12-17 09:46:23 +01:00
MarioRobresandPavel Czerny a156d7a354 F OpenNebula/one#7299: fix HookAPI and add QEMU_GA_EXEC to VM xml (#3974)
Co-authored-by: Pavel Czerny <pczerny@opennebula.io>
2025-12-11 09:02:08 +01:00
Pavel Czerný b004d76154 B #7278: Fix xml-schemas for newer xmllint (#3909)
* xs:any element in sequence is non-deterministic, basically all other elements in the sequence are ignored because of the xs:any

Signed-off-by: Pavel Czerny <pczerny@opennebula.io>
2025-11-24 09:36:31 +01:00
Guillemo Ramos 685a21ef9d F # 5892: vTPM support (#3668)
This commit add support for vTPM devices:

* TPM devices can be enabled by adding TPM = [ MODEL = "..." attribute to the VM. Only model is supported

* vTPM data is saved (and restored) as part of the backup information for the VM.  The TPM data is saved as a tarball with the special name disk.tpm.0. This way backup drivers manage this as another disk. When restoring from a backup, the saved TPM state is stored into the new VM template using the attribute "TPM_STATE" (base64 encoded).

* A new sudo action has been added to the kvm driver to prepare the tpm folder

Note: Packages setup TPM permissions to oneadmin in libvirtd configuration files.
2025-09-16 14:00:43 +02:00
Pavel Czerný f68c826ac8 F #951: Quota for PCI devices (#3756)
This commit adds support for PCI device quotas. It includes the following new attributes:

- PCI_NIC (and RUNNING_PCI_NIC), to account for PCI devices of TYPE = NIC
-  PCI_DEV (and RUNNING_PCI_DEV), to account for generic PCI devices  

This commits also includes:
  - Simpler naming of the onegroup/oneuser quota names (RUNNING is now just label as RUN and SYSTEM_DISK_SIZE  is now DISK SIZE)
- Consolidation of some duplicated logic in oned
- Golang bindings has been extended to include the new quota
- fsck update for the new quotas
- migrator for 7.2.0 release
2025-09-10 09:54:44 +02:00
MarioRobres 18e251659d F OpenNebula/one#7097: Retrieve BRIDGE from Core for Backups (#3701)
Add LAST_BRIDGE To the backup operation. OpenNebula oned selects and stores the bridge in the BACKUP metadata. The drivers can use the selected bridge to perform the different backup phases (on the same bridge)
2025-07-14 12:54:21 +02:00
Pavel Czerný 215d93ea56 F #7067: Add MODTIME to Images (#3655) 2025-06-04 17:59:08 +02:00
Pavel Czerny 1bc799be58 F #6606: CONTEXT->ETH* updates configurable 2025-05-22 12:42:34 +02:00
MarioRobres 56da270c6d F #1550: Update host network BW units and remove debug files (#3570)
* F #1550: update host network BW units

* F #1550: remove debug files
2025-04-16 11:36:23 +02:00
Pavel Czerný 7597b9f09a F #6911: Update xml-schema, fix 'onevm save' (#3533) 2025-04-02 20:37:09 +02:00
Ruben S. Montero 71ac165640 F #6885: Improvements for the forecasting probe
- Add bandwidth metrics to CLI and monitor deamons
- Updated forecast configuration with default models and larger intervals
- Better checks for filling gaps in SQLiteAccessor
- Remove forecast for counter metrics (NET_[RX|TX], DISK[RD|WR]BYTES and IOPS)
- Update one_drs to use bandwidth metrics
- Save monitor agent configuration to a file (/var/tmp/one_db/config) and use it in predictions
2025-03-28 14:00:43 +01:00
Jan Orel c1bbbdab28 OpenNebula/one#6720: Remove vcenter, ruby Sunstone
This commits removes two components:

- vcenter driver and associated dependencies
- Ruby Sunstone
2025-03-25 13:13:27 +01:00
Tino Vázquez 4a74366c7c M #-: Point to latest stable release instead 2025-03-20 11:48:13 +01:00
Pavel Czerný 130bd13394 F #1550: Fix xml-schema (#3484) 2025-03-19 16:05:20 +01:00
Pavel Czerný f207ae66b2 F #1550: Add action labeling (#3448) 2025-03-14 17:16:49 +01:00
MarioRobres 14516356da F #1550: Add support for one_drs optimization (#3458) 2025-03-07 14:00:17 +01:00
Ruben S. Montero f881148422 F #1550 - #6885: Support for forecasting probes 2025-03-06 14:35:54 +01:00
Ruben S. Montero edce8d4813 F #1550: Remove hybrid 2025-03-02 20:37:07 +01:00
Ruben S. Montero 9da8ea1a5d F #-: Remove legacy code for Hybrid Cloud 2025-03-02 17:29:14 +01:00
eda55567b1 F #1550: New Scheduler Framework for OpenNebula & DRS scheduler
This commits introduces a new framework for OpenNebula, it is based on
standard the OpenNebula middleware access driver (mad) model. Benefits
compared to the current implementation:

* Less overhead on API server and streamlined communications
* Ease integration with third party schedulers
* New "optimize" action to balance the workload of a cluster
* Embedded Plan Manager to apply optimization and deployment plans with
  custom parameters for the scheduling window
* Custom optimization policies per cluster

This commits introduces 2 schedulers:

* Rank scheduler based on the match-making algorithm present in 6.x
  series
* OpenNebula DRS an optimization algorithm based on an ILP solver for
  placement and cluster optimization

Also new API calls has been added for onecluster as well as the CLI
updates to expose them.

co-authored-by: MarioRobres <mrobres@opennebula.io>
co-authored-by: Pavel Czerny <pczerny@opennebula.io>
co-authored-by: Mirko Stojiljkovic <mstojiljkovic@opennebula.io>
co-authored-by: Valentyn Bohdan <vbohdan@opennebula.io>
2025-02-27 16:33:05 +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
Pavel Czerný fa73142e7d F #6723: Remove onehost importvm (#3231)
* Remove vm_import table from DB
* Remove imported vms actions
* Fix fsck for image and network
* onedb fsck fix running_vms only for non-backup images
2024-11-21 17:31:47 +01:00
Pavel Czerný cd9eb49321 M #-: Fix *.xsd (#3205)
* Schemas validated by online tool
* Ambiguity errors not solved
2024-09-03 18:45:56 +02:00
Pavel Czerný 274ad4fca9 F #6645: Rename vm_crash to vm_qemu_ping (#3189) 2024-08-02 19:19:59 +02:00
Pavel Czerný 4cb89d8032 M #-: Add warning to Sched Action (#3177) 2024-08-01 10:15:44 +02:00
Ruben S. Montero 033ac01567 F #6653: Remove Postgresql dependencies 2024-07-17 12:58:37 +02:00
Pavel Czerný a3c83b8112 B OpenNebula/one#6630: Fix host.xsd (#3143)
* xs:all element doesn't allow maxOccurs="unbounded" in child node

(cherry picked from commit 2d49e662e9efb210043ca57d004fa0befcaf0478)
2024-07-10 11:27:33 +02:00
Guillemo Ramos fe8c1ca14a B OpenNebula/one#6630: Add DATASTORES/DS to host.xsd (#3129)
Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
2024-06-27 13:05:44 +02:00
Pavel Czerný 1a320ba8e0 F #6523: Store disk IDs in Backup Image (#3075) 2024-05-27 17:24:31 +02:00
Pavel Czerný 3fa5c0b041 M #-: Update VM states graph (#3068)
Add states:
* Backup (poweroff)
* Restore
* Hotplug_nic_poweroff
* Disk resize (poweroff, undeployed)
* Saveas (suspended, stopped)

Keep the states-simple simple, ignoring some transient transitions from poweroff, stopped, suspended and undeployed states
2024-05-22 09:34:03 +02:00
Daniel Clavijo Coca 886a106fb7 M OpenNebula/one#6504: Update vm pool view schema (#2990) 2024-03-20 12:21:12 +01:00