slavkap opened a new pull request, #14266:
URL: https://github.com/apache/cloudstack/pull/14266
### Description
#### Problem
Restoring a single volume from backup and hot-attaching it to a running
KVM VM (`restoreVolumeFromBackupAndAttachToVM`) fails, regardless of the
volume's storage type (NFS, StorPool, RBD, LINSTOR).
####Root cause
`getDeviceToAttachDisk()` picks the target device name via:
` virsh domblklist --domain <vm> | tail -n 3 | head -n 1 | awk '{print $1}'`
This returns the third-from-last line, not the last one — it "works" only
by coincidence. Every CloudStack KVM VM has two pre-allocated, empty CD-ROM
drives (`hdc`, `hdd`, added by #13101) that sort alphabetically ahead of the
real (virtio) disks, so the pipeline picks up a CD-ROM (or an already-attached
disk, depending on disk count) instead of computing a truly free name. `virsh
attach-disk` then rejects the bogus/duplicate target.
#### Fix
Add `--details` to `domblklist` and filter to `Type == "disk"` rows before
picking the last one, so CD-ROMs are never selected.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [X] 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)
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [X] Major
- [ ] Minor
- [ ] Trivial
### Screenshots (if appropriate):
### How Has This Been Tested?
Manually tested with NFS and StorPool as a primary storage
--
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]