shwstppr opened a new pull request, #14593:
URL: https://github.com/apache/cloudstack/pull/14593

   ### Description
   
   This PR brings a set of fixes and improvements for the Veeam KVM integration 
(`veeam-control-service`, the image server and KVM backup), found while 
validating it with Veeam.
   
   **veeam-control-service: request parameters and oVirt-compatible responses**
   - `async` and `detach_only` are parsed the way oVirt does: `true`/`false` 
(any case) or `1`/`0`. A parameter given without a value (e.g. `?async`) means 
`true`.
   - `detach_only` defaults to what oVirt uses for each endpoint:
     - `DELETE /api/vms/{id}`: data disks are deleted unless `detach_only` is 
set.
     - `DELETE /api/vms/{id}/diskattachments/{id}`: the disk is only detached 
unless `detach_only=false`.
   - Synchronous requests no longer wait forever for their CloudStack job. A 
new dynamic setting, `integration.veeam.control.job.wait.timeout`, sets the 
limit (seconds, default `3600`; a value of 0 or less falls back to the 
default). When the limit is reached, the request stops waiting and the job 
keeps running in the background.
   - Jobs that end `FAILED` or `CANCELLED` are reported as errors. Before, they 
were returned as successes, and a cancelled job caused an endless wait. Error 
messages include the job ID, the elapsed time and CloudStack's error text.
   - Responses:
     - DELETE (VM, snapshot, disk, disk attachment, checkpoint, NIC):
       - sync: `200` with `status: complete`, plus the job link when there is a 
job;
       - async: `202`, with the job link and the job's status when there is a 
job, otherwise an empty body;
       - failed job: `400` fault with reason `Operation Failed`;
       - wait timed out or interrupted: `504` with the same fault, since the 
job may still be running.
     - Actions (start, stop, shutdown, snapshot revert):
       - async: `202`, with the status taken from the job (`pending` while it 
runs);
       - failed job: `400` action with `status: failed`, a `fault` and the job 
link;
       - wait timed out: `504` with the same body.
   - Added `GET` and `DELETE /api/vms/{vmId}/nics/{nicId}`. A NIC that doesn't 
exist or belongs to another VM returns `404`, a NIC CloudStack refuses to 
remove (e.g. the default NIC) returns `400`, and any other method returns 
`405`. Added `setVmId`/`setNicId` to `RemoveNicFromVMCmd`.
   - `/api/vms/{id}` and its sub-resources return `404` when the VM doesn't 
exist.
   - `GET /api/vms` lists each VM once. Before, a VM with several disks, NICs 
or tags was listed once per view row, and paging counted rows instead of VMs.
   - Added `GET /api/hosts?follow=statistics`.
   
   **Backup restore with a template that can no longer be used**
   - When restoring an instance backup, if the original template was deleted, 
is inactive, isn't available in the target zone, or the owner can't use it, the 
restore uses the default blank KVM template instead of failing.
   - Root disk size validation is skipped for the blank template, which fixes 
an NPE in `UserVmManagerImpl.validateRootDiskResize`.
   
   **Image server: dirty-extents merge**
   - Allocation and dirty extents are now merged in a single linear pass, one 
64 MiB block-status step at a time, keeping only the joined result, as 
ovirt-imageio does. A short or missing block-status reply can no longer hide 
changed data.
   - Worst case (extents changing every 64 KiB): a 2 GiB disk went from 594 s 
to 0.4 s, and a 128 GiB disk peaks at 1.7 GiB of memory (ovirt-imageio: 1.8 
GiB).
   
   **KVM: backup scratch files**
   - Each disk's scratch file is created next to the disk on its primary 
storage (`backup-scratch-<volume uuid>.qcow2`) instead of in `/var/tmp` on the 
host.
   - Before a backup starts, it is refused unless each scratch directory has 
room for the worst case: the virtual size of its disks plus 1%. The error names 
the directory, the bytes needed and the bytes available.
   - A scratch file left behind by an earlier backup is removed, but only when 
the VM has no active libvirt job.
   
   **Backup: image transfers left open by an earlier backup**
   - When a backup starts, or requests a transfer for a volume that still has a 
download open from an earlier backup, that download is finalized first and its 
`qemu-nbd` stopped. Before, the volume stayed locked, or every later request 
failed with "Image transfer already exists for volume".
   - If the old transfer can't be ended (e.g. its host is unreachable), the 
request is refused with the transfer and host named, and the next attempt 
retries the cleanup.
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] Build/CI
   - [ ] Test (unit or integration test code)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to 
-->
   
   #### How did you try to break this feature and the system with this change?
   
   <!-- see how your change affects other areas of the code, etc. -->
   
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) 
document -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to