1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00
Commit Graph

2165 Commits

Author SHA1 Message Date
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
Pavel Czerný
8e7ff2ed36
F #6103: Last set of CppCheck issues (#2481)
(cherry picked from commit 4a9662a551)
(cherry picked from commit d7b7303f8f)
2023-02-07 08:56:52 +01:00
Pavel Czerný
6ee3a5ef5b
F #6103: More CppCheck issues solved (#2477)
(cherry picked from commit 3fd059c543)
2023-02-02 12:54:45 +01:00
Pavel Czerný
a5c57b69b3
M #-: Add CppCheck to smoke tests (#2464) 2023-01-31 13:46:09 +01:00
Pavel Czerný
d7f1e1e0fc
B #6085: Fix trim of VNC/SPICE password (#2460)
(cherry picked from commit 726a6a8547)
2023-01-26 10:03:09 +01:00
Pavel Czerný
0696693531
B #6027: Parse host NUMA monitoring (#2440)
Co-authored-by: Ruben S. Montero <rsmontero@opennebula.org>
2023-01-09 18:29:09 +01:00
Tino Vázquez
3376afdaf0
M #-: Bump year 2023 2023-01-09 12:23:19 +01:00
Pavel Czerný
0fe9eac8b5
B #5916: Fix onevm instantiate --persistent (#2428) 2023-01-04 16:10:03 +01:00
Pavel Czerný
82d2191dfd
B #6022: Fix lock override and --all flag (#2427)
* This commit syncs oned and API specification for the ALL flag. The internal defines were not consistent with the API specification.
2023-01-04 15:53:50 +01:00
Pavel Czerný
9959ceac06
M #-: Bump DB version to 6.8 (#2425) 2022-12-22 14:20:25 +01:00
Tino Vázquez
4f9e45a57c
M #-: Bump version 6.7.80 2022-12-21 19:57:29 +01:00
Pavel Czerný
b25274323e
M #-: Trim VM template error message (#2424) 2022-12-19 15:21:12 +01:00
Tino Vázquez
238b5d704c
M #-: Bump version to 6.6.0 2022-12-15 18:07:06 +01:00
Jan Orel
4a2f8193a8
Revert "B #5801: Correctly terminate oned, if init fails (#2396)" (#2420)
This reverts commit 0221dc187a.
2022-12-13 15:46:54 +01:00
Ruben S. Montero
4df86811b9
F #5681: Support for block context devices
Add support for block context CD's. System Datastore can include
CONTEXT_DISK_TYPE to specify the type (FILER or BLOCK) of the context
CD's

co-authored-by: Victor Palma
2022-12-12 16:49:25 +01:00
Pavel Czerný
3beca2d9d3
B #5640: Fix NETRX and NETTX for accounting (#2417) 2022-12-12 09:28:46 +01:00
Ruben S. Montero
d711ea4362
F #5516: Incremental backups not compatible with snapshots
- Qemu will terminate VMs with system snapshots and checkpoints, example:

libvirtd[7446]: internal error: qemu unexpectedly closed the monitor: 2022-12-07T16:06:59.603678Z qemu-kvm-one: Device has active dirty bitmaps.

- Also disk snapshots may render inconsistent bitmaps, example:

'virsh --connect qemu:///system checkpoint-delete 45d76e5f-25fa-416a-97fd-1624380d5e02 one-191-0':   error: Failed to delete checkpoint one-191-0 error: internal error: unable to execute QEMU command 'query-named-block-nodes': Bitmap '' doesn't satisfy the constraints Error preparing disk files

This commits prevents snapshot operations when increment backups are configured, and vice versa.
2022-12-09 17:25:56 +01:00
Pavel Czerný
08e0e6c305
B #5728: Fix argument parsing for onemonitord (#2411)
* Fix argument parsing for onemonitord
* Update NebulaTemplate.h
2022-12-08 10:33:45 +01:00
Pavel Czerný
0221dc187a
B #5801: Correctly terminate oned, if init fails (#2396)
+ Improve formating of driver initialization log messages
2022-12-07 11:15:37 +01:00