Bug #22656
ovirt vm creation fails for slow storage backend
Description
We encountered the following kind of errors when trying to create VM on ovirt 4.1 via Foreman:
Failed to create a compute xxx (oVirt) instance xxx: Cannot remove VM: The following disks are locked: xxx_Disk2, xxx_Disk1. Please try again in a few minutes.
|
| OVIRT::OvirtException: Cannot remove VM: The following disks are locked: xxx_Disk2, xxx_Disk1. Please try again in a few minutes
The error only occurred on slow storage devices as volumes backend.
Looking through app/models/compute_resources/foreman/model/ovirt.rb model I saw that it is destroying the vm if either interfaces or volumes creation fails.
I also identified the following piece of code for volume creation:
def create_volumes(vm, attrs)
#add volumes
volumes = nested_attributes_for :volumes, attrs
volumes.map do |vol|
set_preallocated_attributes!(vol, vol[:preallocate])
#The blocking true is a work-around for ovirt bug fixed in ovirt version 3.1.
vm.add_volume({:bootable => 'false', :quota => ovirt_quota, :blocking => api_version.to_f < 3.1}.merge(vol)) if vol[:id].blank?
end
vm.volumes.reload
end
Changing 3.1 with 5.1 (actually enforcing blocking behavior) solved the issue.
So it seems that for ovirt 4.1 and slow storage devices the code must wait until the volume is added.
Associated revisions
History
#1
Updated by yifat makias about 3 years ago
- Assignee set to yifat makias
- Status changed from New to Assigned
#2
Updated by The Foreman Bot about 3 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/7169 added
#3
Updated by The Foreman Bot about 3 years ago
- Fixed in Releases 2.0.0 added
#4
Updated by yifat makias about 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 1a090f9b14a41604d329c313986c92652da0ac81.
Fixes #22656 - Fixed ovirt vm creation for slow storage