Bug #5169

vCenter VM cannot be resumed from poweroff after a hard disk was attached due to "Failed to lock the file"

Added by Miguel Ángel Álvarez Cabrerizo about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:05/24/2017
Priority:HighDue date:
Assignee:-% Done:

0%

Category:vCenter
Target version:-
Resolution:fixed Pull request:
Affected Versions:OpenNebula 5.2

Description

The following issue has been found:

  • A vCenter template is imported into OpenNebula.
  • A VM is instantiated from the previous template.
  • A datastore that can be used by the VM is imported into OpenNebula.
  • A new empty datablock is created in that datastore, it's a persistent image.
  • While the VM is running, a disk using the previous image is attached to the VM.
  • New disk is attached successfully.
  • The VM is powered off from OpenNebula.
  • We try to resume the VM, and it fails.

In the VM log we can see the following error: Deploy... failed due to "GenericVmConfigFault: Failed to lock the file.

History

#1 Updated by Miguel Ángel Álvarez Cabrerizo about 4 years ago

The issue is caused by the following:

  • When the VM is resumed, OpenNebula fails to detect the VMDK file used when a disk was hotplugged, so it thinks that the disk is not attached to the VM in vCenter and adds it again. Each time the resume action is tried, a new disk is added.
  • New disks are duplicates of the first disk, so vCenter refuses to power on the VM as the VMDK file that contains the disk backing is already locked to be used by the first disk.

#2 Updated by Miguel Ángel Álvarez Cabrerizo about 4 years ago

  • Status changed from Pending to Closed
  • Resolution set to fixed

The issue was already fixed in the one-5.2 branch in vcenter_driver.rb, datastore's name was included between brackets in disk's file name:

However for a quick fix without replacing the whole vcenter_driver.rb there's more info in OpenNebula's forum: [[https://forum.opennebula.org/t/open-nebula-after-attaching-a-disk-to-a-vm-getting-failed-to-lock-the-file-when-i-am-starting-the-machine/4332/7]]

Also available in: Atom PDF