1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-07 17:17:41 +03:00
Commit Graph

2183 Commits

Author SHA1 Message Date
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
Neal
f6fac118c5
F OpenNebula/one#6291: remove disk number and naming limitations (#3061)
Signed-off-by: Neal Hansen <nhansen@opennebula.io>
Co-authored-by: Pavel Czerny <pczerny@opennebula.io>
2024-05-28 13:34:07 +02:00
Pavel Czerný
1a320ba8e0
F #6523: Store disk IDs in Backup Image (#3075) 2024-05-27 17:24:31 +02:00
Pavel Czerný
0f248706de
B #6498: Allow VM recover --recreate in poweroff and suspend (#3067)
* Refactor release vnc port
* Fix VNC port for recover --recreate in stopped state
* Improve error messages
*  Update recover --recreate description

(cherry picked from commit 9ed1fba8b95c1ea5d3984f136e638b973577ad69)
2024-05-21 12:11:06 +02:00
Pavel Czerný
5dda6c3c8f
B #6580: Fix casting in Template::remove (#3057)
The Template::remove could crash if user assign Single value to attribute, which is expected to be a Vector, e.g. SCHED_ACTION, PCI, ...

Other minor changes:
* refactor the 'set' method - no need to call private _set
* Simplify some callers of the Template::remove method
2024-05-14 14:27:29 +02:00
Pavel Czerný
e68305c772
F #6053: Rename all prolog_restore to restore (#3056) 2024-05-13 13:21:56 +02:00
Ruben S. Montero
c509eaa815
F #6053: Renamed oned internal state name PROLOG_RESTORE to RESTORE
Now it is consistent with the API naming
2024-05-10 12:02:38 +02:00
Ruben S. Montero
3dfd53df1c
F #6053: In-place restore of VM backups (shared and ssh drivers)
This commit implements the in-place restore of VM backups. Selected VM disks will
be replaced with the specified backup:

* A new API call has been added to the XML-RPC API (`one.vm.restore`) with
  the following arguments:
    - VM ID to be restored, needs to be in **poweroff** state
    - IMAGE ID of the backup to restore
    - INCREMENT ID, only for incremental backups, the increment to use
      (defults to -1 to use the last increment available)
    - DISK ID of the disk to restore (defaults to -1 to restore all VM
      disks)

* Datastore drivers needs to implemente a new operation `ls`. This new
  operation takes the VM, image information of the backup and datastore
  information and returns the restore URL for the disks in the backup.

* This commit includes the implementation for qcow2 and ssh drivers,
  ceph will be implemented in a separated PR. The new driver action is
  `restore host:vm_dir vm_id img_id inc_id disk_id`

* The restore operation is performed in a new state `PROLOG_RESTORE`
  rendered as `RESTORE` and `rest` in short form. State in in RSuntone.

TODO:
  - Remove any existing VM snapshot (system/disk) in the VM. Note that
    snapshots are not included in a backup.

  - Ceph drivers

  - JAVA, GO Lang API bindings

  - Sunstone interface, new state and new operation. Review new state in
    RSuntone.

co-authored-by: Pavel Czerny <pczerny@opennebula.io>
2024-04-26 12:45:04 +02:00
Anton Todorov
7831e0e08e
B #6464: backup execution PARALLEL mode
There is a typo causing the PARALLEL execution mode to be not recognized

(cherry picked from commit 8e08b3bd10)
2024-04-09 18:05:39 +02:00
Pavel Czerný
e4fec11dc4
B OpenNebula/one#6530: Fix max SPICE passwd length (#3009)
(cherry picked from commit be64cbdf04)
2024-03-26 12:05:15 +01:00
Pavel Czerny
57efabf2d5
B #6503: Fix disk size after disk-snapshot-revert
When a disk with snapshots is resized and a subsequent revert operation
is performed, the following actions are now done:

* DISK/SIZE is updated to reflect the active snapshot size
* Quotas are updated to account the space freed after the resize
  operation

(cherry picked from commit 178142105dea30c7deffd1842d0f0ad23d7dc93b)
(cherry picked from commit d2aaf2c8823d4172b1be673f959c4c922266534f)
2024-03-11 18:08:02 +01:00
Jan Orel
0abfaaa12d
M #-: Update oned version 6.99 -> 6.9 (#2978)
* Update oned version 6.99 -> 6.9

* Update DB version 7.0 -> 6.10
2024-03-11 12:05:39 +01:00
Pavel Czerný
185e9f1221
M #-: Bump DB version to 7.0 (#2974) 2024-03-10 02:00:48 +01:00
Ruben S. Montero
174e8999d0
L #-: Removed unused method 2024-03-04 12:36:12 +01:00
Ruben S. Montero
4ce7340381
F #6492: Index PCI passthrough devices with bus
If q35 machine type is detected the slot of the pci device is set to 0
and the bus to pci_id + 1.

Q35 models uses pcie-root-ports to attach PCI devices. Each PCI port is
selected by the bus parameter of the PCI address and it that does not accept a
slot number greater than 0.

Example:

A VM with 2 X710 VFs is defined OpenNebula as:

PCI=[
  ADDRESS="0000:44:0a:0",
  BUS="44",
  CLASS="0200",
  DEVICE="154c",
  DOMAIN="0000",
  FUNCTION="0",
  NUMA_NODE="0",
  PCI_ID="0",
  SHORT_ADDRESS="44:0a.0",
  SLOT="0a",
  VENDOR="8086",
  VM_ADDRESS="01:00.0",
  VM_BUS="0x01",
  VM_DOMAIN="0x0000",
  VM_FUNCTION="0",
  VM_SLOT="0000" ]

PCI=[
  ADDRESS="0000:44:0a:1",
  BUS="44",
  CLASS="0200",
  DEVICE="154c",
  DOMAIN="0000",
  FUNCTION="1",
  NUMA_NODE="0",
  PCI_ID="1",
  SHORT_ADDRESS="44:0a.1",
  SLOT="0a",
  VENDOR="8086",
  VM_ADDRESS="02:00.0",
  VM_BUS="0x02",
  VM_DOMAIN="0x0000",
  VM_FUNCTION="0",
  VM_SLOT="0000" ]

Each PCI VFs is attached to different pcie-root-port, selected with the
VM_BUS parameter:

00:02.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.1 PCI bridge: Red Hat, Inc. QEMU PCIe Root port

The PCI topology is:

-[0000:00]-+-00.0  Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller
           +-01.0  Cirrus Logic GD 5446
           +-02.0-[01]----00.0  Intel Corporation Ethernet Virtual Function 700 Series
           +-02.1-[02]----00.0  Intel Corporation Ethernet Virtual Function 700 Series
           +-02.2-[03-04]----00.0-[04]--
           +-02.3-[05]----00.0  Red Hat, Inc. Virtio network device
           +-02.4-[06]----00.0  Red Hat, Inc. Virtio SCSI
           +-02.5-[07]----00.0  Red Hat, Inc. QEMU XHCI Host Controller
           +-02.6-[08]----00.0  Red Hat, Inc. Virtio console
           +-02.7-[09]----00.0  Red Hat, Inc. Virtio memory balloon
           +-03.0-[0a]--
           +-03.1-[0b]--
           +-03.2-[0c]--
           +-03.3-[0d]--
           +-03.4-[0e]--
           +-03.5-[0f]--
           +-03.6-[10]--
           +-03.7-[11]--
           +-1f.0  Intel Corporation 82801IB (ICH9) LPC Interface Controller
           +-1f.2  Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode]
           \-1f.3  Intel Corporation 82801I (ICH9 Family) SMBus Controller
2024-02-08 14:57:28 +01:00
Ruben S. Montero
0725c4248d
M #-: Remove unused code function 2024-02-07 16:26:00 +01:00
Pavel Czerný
b153069059
F #6439: PCI (de)attach go and java api (#2919)
* PCI (de)attach go and java api
* Remove unused VirtualMachinePCI.h
* Use vm_authorization method to check Request authorization
* Fix typos
* L #-: C++ linting + onevm
2024-02-06 11:15:33 +01:00
Ruben S. Montero
2e596c0cf5
F #6439: PCI attach/detach operation
* Adds 2 new API calls one.vm.attachpci and one.vm.detachpci
* The operation is only for POWEROFF VMs
* Adds 2 new actions to register the event in the VM history pci-detach/pci-attach
* Ruby OCA bindings
* onevm cli commands

TODO:
- JAVA and GO bindings
- Sunstone implementation

(cherry picked from commit 5c4331a4dd)
2024-01-31 17:50:45 +01:00
Pavel Czerný
442041fd07
F #6341: Generic Quotas
- Generic quotas are defined and read from oned.conf (QUOTA_VM_ATTRIBUTE)
- Generic quotas react to the running mode (i.e. account only when the VM is
  running). For each quota oned also adds a RUNNIN_* metric
- one.system.config API call has been updated so every user can read
  quota configuration:
    . Sensitive information is hidden (***)
    . Oneadmin group has no longer access to sensitive information
      through the API
- CLI has been updated to render generic quotas
- onedb fsck fixes generic quotas reading the configuration from
  oned.conf

Other changes in this PR:
- Refactor Quota metrics to use std::vector instead of C array
Squashed commit of the following:
- New methods to Template and Attribute classes to render hidden
  attributes as "***"
- Update Quota calls to not include unneeded quotas

co-authored-by:Ruben S. Montero <rsmontero@opennebula.org>
2024-01-08 14:07:03 +01:00
Pavel Czerný
e2f2782195
B #6387: Fix accounting after onevm resize (#2866)
* Fix accounting after onevm resize
* Fix crash in VM resize if VM has no history

(cherry picked from commit ca934bbde0)
2024-01-03 13:02:29 +01:00
Ruben S. Montero
0a7a03e098
F 6441: Introduce FLOATING_ONLY for Virtual Router
The new attribute does not allocate extra IPs on NICs with FLOATING_IP =
yes and FLOATING_ONLY = yes. The NIC will only containg a random MAC
address and VROUTER_IP/MAC.

This commit also checks that network mode auto is not used for NIC of a
VROUTER

(cherry picked from commit 18c7816074)
2023-12-22 19:42:03 +01:00
Pavel Czerný
725337ea5e
B #6355: Fix VM quotas (#2861)
* Remove useless default values from VM quotas, adapt chown and chgrp to it
* Fix VM transition from poweroff, stopped, suspended, undeployed to done when quotas are tmp exceeded
* Fix VM transition from poweroff to undeployed
* Fix VM transition from suspended to stopped

(cherry picked from commit 1e25904148)
2023-12-12 16:20:08 +01:00
Daniel Clavijo Coca
800bfbba0f
M #: Update core updateconf description with allowed changes (#2864) 2023-12-10 11:36:23 +01:00
Pavel Czerný
9cf5f85db8
B #6320: Fix history for VM disk actions (#2806) 2023-11-28 11:08:57 +01:00
Pavel Czerný
ca64f96f26
B #6354: Reinit authentication after passwd change (#2809) 2023-11-15 13:04:50 +01:00
Pavel Czerný
4756ef9d1b
B #6365: Fix mem leak in Scheduler, optimize Cluster construction (#2802)
- Fix memory leak in Scheduler
- Optimize BitMap
2023-11-10 10:34:04 +01:00
Tino Vázquez
55e4c2b9dd
M #-: Bump version 6.99.80 2023-10-18 16:00:52 +02:00
Tino Vázquez
3e17d5e859
M #-: Bump version 6.8.0 2023-10-10 13:24:13 +02:00
Tino Vázquez
5241112a78 M #-: Bump version 6.7.90 2023-09-28 16:28:19 +02:00
Pavel Czerný
a97b7468fd
B #6325: Fix Scheduled Actions for VM Template (#2746) 2023-09-21 11:29:41 +02:00
Neal Hansen
c1a0e5bfc5
F OpenNebula/one#6286: Add support for VIDEO devices in KVM
- New attribute VIDEO, that includes
  - TYPE: Custom video device (none, vga, cirrus, virtio)
 - IOMMU: Enable IOMMU for the video device
 - ATS: Enable ATS (Address Translation Services) for the video device
 - VRAM: VRAM allocated to the video device (Megabytes)
 - RESOLUTION: Video resolution, in format like: 1280x720 or 1920x1080

- Support for onevm CLI command
- Updated VM xsd file.
2023-09-20 20:00:10 +02:00
Pavel Czerný
534823e7f1
B #6315: Fix remove of restricted vector attributes (#2731) 2023-09-18 16:17:59 +02:00
Pavel Czerný
ac49ab6d30
F #6227: New API for VMGroup roles
* New API for VMGroup roles: add, del, update
* Go and Java api for VM Group roles
2023-09-14 15:36:26 +02:00
Pavel Czerný
c5392d08b8
F #6063: Update Backup Job fix (#2715)
* Set priority on Backup Job create

* Fix a bug when running backup jobs in sequential mode

* Change the update semantics to support replace mode

* Update Ruby, Golang and Java API accordingly

* F #6063: Adress PR comments
2023-09-07 11:11:02 +02:00
Ruben S. Montero
dca50b2bb9
F #6275: External scheduler API
The connection to an external scheduler module is configured in sched.conf:

EXTERNAL_SCHEDULER = [
   SERVER  = "http://localhost:4567",
   PROXY   = "",
   TIMEOUT = 10
]

The API post on '/' the list of VMs, their pre-selected list of
candidate hosts based on REQUIREMENTS along with the VM information
(CAPACITY, TEMPLATE and USER_TEMPLATE).

Example:
{
  "VMS": [
    {
      "CAPACITY": {
        "CPU": 1.5,
        "DISK_SIZE": 1024,
        "MEMORY": 131072
      },
      "HOST_IDS": [
        3,
        4,
        5
      ],
      "ID": 32,
      "STATE": "PENDING",
      "TEMPLATE": {
        "AUTOMATIC_DS_REQUIREMENTS": "(\"CLUSTERS/ID\" @> 0)",
        "AUTOMATIC_NIC_REQUIREMENTS": "(\"CLUSTERS/ID\" @> 0)",
        "AUTOMATIC_REQUIREMENTS": "(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES) & !(PIN_POLICY = PINNED)",
        "CPU": "1.5",
        "MEMORY": "128",
        ...
      },
      "USER_TEMPLATE": {}
    },
    {
      "CAPACITY": {
        "CPU": 1.5,
        "DISK_SIZE": 1024,
        "MEMORY": 131072
      },
      "HOST_IDS": [
        3,
        4,
        5
      ],
      "ID": 33,
      "STATE": "PENDING",
      "TEMPLATE": {
       ...
      },
      "USER_TEMPLATE": {}
    }
  ]
}

The scheduler needs to respond to this post action with a simple list of
the allocation for each VM:

{
  "VMS": [
    {
      "ID": 32,
      "HOST_ID": 2
    },
    {
      "ID": 33,
      "HOST_ID": 0
    }
  ]
}

This commits vendorize Vendorize nlohmann-json (MIT license)
2023-08-29 17:11:01 +02:00
Ruben S. Montero
1e42b638a9
F #6063: Improve Backup Job Operations
* Schedule Action Manager executes only on RAFT leader in HA configurations.
* Relative time for Scheduled Action Backup Jobs returns error.
* Store Backup Job ID to VM and associated backup Image.
* VM can be only in one Backup Job at a time.
* Deny single Backup if the VM is already part of BackupJob to prevent
  inconsistent backup states.

Other fixes:
    - Fix crash on scheduled backup for VM in pending state
    - Fix error messages for Scheduled Actions
    - Remove SCHED_ACTION from Backup Job template on update

co-authored-by: Pavel Czerný <pczerny@opennebula.io>
2023-08-07 11:49:18 +02:00
Ruben S. Montero
156cd04ba5
F OpenNebula/one#6265: Delete of snapshots in the middle of the chain
- Add suport for delete snapshots in the middle of the chain in qcow2
  (ALLOW_ORPHANS=NO). Example, snapshot 2 below:
                     0 <- 1 <- 2 <- 3

- It supports removing the last snapshot and active (blockpull) and
  first one (snapshot 0). The first snapshot cannot be deleted in
  persistent images because of the underlying link setting.

- Snapshots are deleted by blockcommit. For example to delete 2, 3 is
  committed into 2:
                    0 <- 1 <- 2: (2+3)
  A new file 3.current is created in the filesystem to look for the
  actual file name supporting snapshot 3.

- qcow2/shared operations snap_delete, snap_revert and cpds
  (disk-saveas) has been updated to react to the .current files

- The kvm/deploy action has been updated to resolve links in source file
  attributes. This is needed so the <backingStore> of the libvirt domain
  does not contain the sysmlinks that changes on the revert/create
  operations.

- The kvm/migrate action also includes a minor modification to resolv
  the VM disk

- Snapshots with more than 1 child (or their relatives) cannot be deleted to not
  break backing chains.

- It has been found that the snap-delete operation in suspend state is
  insecure as the guest caches may not be updated accordingly. The
  operation is now not allowed in this state.

- The associated state has been removed from oned. It needs to be
  removed in CLI/Sunstone and APIs

- The changes are for VM disk-snapshots. A similar update can be made
  for images in the datastore/fs snap_delete action. This operation is
  not implemented in this commit.

Note: Output of xmllint may or may not include new lines when multiple matches
of an xpath expression occurs. Parsing of xmllint output adds additional new lines
to deal with different versions.
2023-07-20 19:04:28 +02:00
Ruben S. Montero
6bbfbb03e4
F #6063: Backup Jobs for OpenNebula
Includes the following changes:
- xml-schema for Backup Job and Scheduled Actions
- GO, Java api
- Deprecate onevm update-chart, delete-chart
    * The commands are replaced by sched-update and sched-delete
    * Refactor method deprecate_command, it's still possible to run the
    command
    * Delete 'shutdown' and 'delete' commands deprecated years ago
    * Fix --verbose option for sched-update and sched-delete
- Re-implementation of scheduled actions, now are managed and executed
  by oned
- Backup Job objects, API, and CLI commands
2023-07-03 18:15:52 +02:00
Pavel Czerný
167e25077a
F #6239: Update VMAction permissions (#2642)
* Add Sched actions and sg (de)attach to VM_*_OPERATION
* Add Backup cancel action
* For consistency add poweroff migrate, alias (de)attach and nic update to set_auth_ops
2023-06-21 09:40:03 +02:00
Bruno Rodriguez
99d6d46913
B #4045: Add pci root ports config on q35 vms
Signed-off-by: Bruno Rodriguez <brodriguez@opennebula.io>
(cherry picked from commit c7e15fc143eafd0e7b595f5d2d2eea64bb080ea7)
2023-06-19 12:59:55 +02:00
Ruben S. Montero
45f28e15d3
F #6185: Support huge pages without CPU pinning
VM topology can be defined:

- To use a NUMA node and huge pages. Example:
    TOPOLOGY = [ NODE_AFFINITY = 0, HUGEPAGE_SIZE = 2 ]

- To use huge pages without specifying the NUMA node. Example:
    TOPOLOGY = [ HUGEPAGE_SIZE = 2 ]

In any case OpenNebula will:

- look (or check) for a NUMA node with enough free huge pages
- will pick the NUMA node with more free pages (if no NUMA node is specified)
- configure the VM with CPU affinity to the selected NUMA node

(cherry picked from commit 1b3b88ed4e)
2023-04-24 20:45:45 +02:00
Ruben S. Montero
53b9611219
F #5966: Support for huge pages for NUMA affinity 2023-04-24 17:52:15 +02:00
Ruben S. Montero
4efa25c3e5
F #5966: NUMA affinity
* NODE_AFFINITY can be used to pin a VM to all the CPUs of a NUMA node.
  The attribute is part of the TOPOLOGY definition.

* A default virtual topology is defined when no other is set. This
  allows to set only the affinity:

     TOPOLOGY = [ NODE_AFFINITY = 1 ]

* NODE_AFFINITY can only be set for not-pinned VMs to not conflict with
  core allocations for pin VMs. VMs with NODE_AFFINITY set will be
  allocated to regular hosts (i.e. PIN_POLICY = NONE)

(cherry picked from commit fc15d6ebc9)
2023-04-23 00:01:11 +02:00
Ruben S. Montero
a9da75db0e
F #6030: Cancel backup operation
Author: Pavel Czerny <pczerny@opennebula.systems>
Author: Michal Opala <mopala@opennebula.io>
(cherry picked from commit f12c365d3e)
2023-03-16 13:11:27 +01:00
Pavel Czerný
75ee27eb32
M #-: Add more build warnings, const version of vector_value method (#2534)
* M #-: const version of vector_value returns const&
* M #-: Turn on compiler flags -Wextra -Werror
2023-03-08 15:52:20 +01:00
Ruben S. Montero
238e520bc9
F #6029: Signal increment flatten with an attribute
Extending the BACKUP state may lead to unneed wait times to perform VM
management operations

Fixes reset of backup chains for poweroff state

(cherry picked from commit 377db9653e)
2023-02-16 16:13:00 +01:00
Pavel Czerný
03add6d9ac
F #6103: CppCheck version 2.10 - solved issues (#2492)
* Update smoke test checkout action

(cherry picked from commit 466d336d7e)
2023-02-14 09:51:04 +01:00
Ruben S. Montero
c68c81a86e
F #6029: Prevent backup removal VM is in BACKUP
Some backup drivers may not allow delete (forget) operations while an
active backup is being performed. This commits fails the
one.image.delete API call in that case.

A new configuration attribute to describe the related driver behavior has been
added CONCURRENT_FORGET for DS_MAD_CONF.

(cherry picked from commit 940c1d7d63)
2023-02-09 19:40:44 +01:00
Ruben S. Montero
8cb3a360b8
F #6029, #6074: Retention and restore opetions for incremental backups
* Introduce support to follow KEEP_LAST for incremental backups.
  - New increment_flatten action added for backup datastores.
  - increment_flatten will consolidate KEEP_LAST increments into the
    current first increment in the chain.
  - increment_flatten MUST return the new chain (inc1:source1,...) and size
    of the new first increment (FULL) in the chain.

* Downloader logic for restore has been extracted from downloader.sh to
  reuse the increment flatten logic. A new command restic_downloader.rb
  process restic:// pseudo-urls.

* Restore process uses two new attributes to customize the restore
  process:
  - NAME to be used as base name for images and VM Template
  - INCREMENT_ID to restore disks from a given increment (not always the
    last one)

* Common logic has been added to BackupImage class (backup.rb)

* Includes the following fixes:
  - Fix when increment includes blocks larger than max qemu-io request size
  - Fix IMAGE counter for quotas on backup images
  - Fix rsync restore NO_IP / NO_NIC attributes

TODO:
* Mimic increment_flatten logic and restore images on the backup server
* Suntone restore options

co-authored-by:Michal Opala <mopala@opennebula.io>
2023-02-07 13:19:03 +01:00
Pavel Czerný
19f18e2877
M #-: Fix CppCheck issues in 6.6 branch (#2485)
(cherry picked from commit c70a239033)
2023-02-07 12:34:04 +01:00