1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-21 18:03:38 +03:00

2198 Commits

Author SHA1 Message Date
Valentyn Bohdan
c5ef4434fa
B OpenNebula/one#6750: Fix iotune attributes not being passed to VM
This commit solves the problem by improving the overflow in integer
types

Signed-off-by: Valentyn Bohdan <vbohdan@opennebula.io>
2024-11-27 12:05:16 +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
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
Ruben S. Montero
5f7b370c52
F #6411 + B #6741: Incremental backups for Ceph datastore
Implementation overview:

- Incremental points are saved as dedicated rbd snapshots under the
  "one_backup_<increment_id>" namespace. This snapshots are used to
  generate delta files in rbdiff format.

- The rbdiff formats are stored in the backup server to restore the rbd volumes.

- The restore process is performed directly on the Ceph cluster
  importing the base image (first full backup in the chain, rbd import)
  and then applying the increments (rbd import-diff) up to the target
  increment.

- Two new pseudo-protocols has been implemented to adopt the restore
  pattern above (restic+rbd, rsync+rbd). This protocols bundle of the
  rbdiff files in a tarball for transfer from the backup server. Note:
  reconstruct process uses the Ceph BRIDGE_LIST and not the backup
  server (as opposed to qcow2 backups)

Other bug fixes

- This commit also fixes #6741, resetting the backup chain after a
  restore

- The original ceph drivers do not receive the full action information,
  this now has been fixed by including VM information in the STDIN string sent
  to the driver.

Compatibility note.

- backup actions should return now the backup format used raw, rbd, ...
  If not provided oned (6.10.x) will use raw as a default to accommodate any
  third party driver implementation. It is recommended to include this
  third argument.

Signed-off-by: Guillermo Ramos <gramos@opennebula.io>
Co-authored-by: Guillermo Ramos <gramos@opennebula.io>
2024-10-04 20:28:10 +02:00
Pavel Czerný
e13c329db4
F #2111: Optimize VM history handling (#3243)
- oned load only last 2 history records (not the full list)
- Dump all history records only if needed in VirtualMachine::to_xml.
- Dump conforms XML schecam and removes VM template from history records.

Speed up of onevm show command:
  - for small SQLite DB is for VM with 500 histories: 130 ms down to 5 ms
  - for big MySQL DB VM with 687 histories: 1000 ms down to 200 ms
2024-09-30 14:14:37 +02:00
Pavel Czerný
0cde7d96a2
B OpenNebula/one#6596: Fix Host NUMA nodes after VM migration (#3226)
* Fix Host NUMA nodes after VM migration
* Move template parsing to HostShareCapacity

+ add warning about unsafe pointer usage
2024-09-24 09:11:35 +02:00
Pavel Czerný
ff7be13b32
M #-: Bumb DB version (#3222) 2024-09-10 15:56:42 +02:00
Pavel Czerný
7b07def90e
B #6687: Fix monitoring initialization and restart
* Cleanup oned in case of initialization error

* Fix monitoring after onemonitord restart. The code includes a "hook" point in case a driver is re-started so custom code can be executed. InformationManager sends the list of hosts and raft status in this case.

* B #5801: Update error msg, in case of duplicated drivers
2024-09-05 16:25:03 +02:00
Pavel Czerný
7fe28f226c
B #6694: Check error code of read function (#3208) 2024-09-04 10:58:15 +02:00
Tino Vázquez
0491d23135
M #-: Bump version 6.99.0 2024-09-02 17:15:09 +02:00
Pavel Czerný
4cb89d8032
M #-: Add warning to Sched Action (#3177) 2024-08-01 10:15:44 +02: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
Ruben S. Montero
033ac01567
F #6653: Remove Postgresql dependencies 2024-07-17 12:58:37 +02:00
Pavel Czerný
31a238e727
F OpenNebula/one#5861: Fix json history body (#3111)
* Fix body_json for history record
* Update the body_json on every VM update to keep the data synced with the xml body
* Remove few duplicated VM updates
2024-07-03 13:10:41 +02:00
Pavel Czerný
95c51ff87f
F #5861: Search VM using JSON querry (#3102)
Signed-off-by: Pavel Czerny <pczerny@opennebula.io>
Co-authored-by: Alejandro Huertas <ahuertas@opennebula.io>
2024-06-13 12:35:15 +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
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 8e08b3bd107d48a6ace7578669cc7ee1a7739217)
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 be64cbdf0404a7a78aedaed75b5f2d97a30be8a9)
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 5c4331a4dd2f778556583961a40a4d7c68c97fcd)
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 ca934bbde0c6db9cfc4f776d0bcd1f8c7608a3de)
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 18c781607428733cce55b3b42813f2fdc7d8004f)
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 1e25904148a1900d5355963ee3c10dc2a037c883)
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