Error on detaching a volume with vmwareapi driver when the instance was migrated to same datastore of the volume

Bug #1704196 reported by Marcio Roberto Starke
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Radoslav Gerganov

Bug Description

When vmware relocates a vm with a volume attached, the volume's vmdk goes to the instance datastore. Openstack can handle this without error, but when the same vm is relocated once more to the volume's datastore it raises an error when detaching the volume.

This occurs because when they are in the same datastore, the _relocate_vmdk_volume inside the "try" section in the _consolidate_vmdk_volume function doesn't give an error, and the detach_disk_from_vm function will run with the destroy vmdk set to true, but the vmdk doesn't not exist, raising another error.

How to reproduce:
- Attach a volume to an Instance
In Vcenter:
- Migrate the Instance to a datastore
- Migrate the Instance again to the volume's datastore
- Try to detach the volume

A possible fix is attached here.

Tags: vmware
Revision history for this message
Marcio Roberto Starke (mrstarke) wrote :
Revision history for this message
Marcio Roberto Starke (mrstarke) wrote :

A little change in the patch to catch just the FileNotFoundException.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/484675

Changed in nova:
assignee: nobody → Radoslav Gerganov (rgerganov)
status: New → In Progress
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/484675
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=fee8409208af77f1f01c7ef3c5438cb7ef493b3d
Submitter: Jenkins
Branch: master

commit fee8409208af77f1f01c7ef3c5438cb7ef493b3d
Author: Radoslav Gerganov <email address hidden>
Date: Tue Jul 18 11:35:47 2017 +0300

    VMware: Handle missing volume vmdk during detach

    During storage vMotion (live migration of a virtual machine and its disk
    files from one datastore to another), the volume's vmdk may be moved
    to the instance's datastore folder. We handle this case during detach
    volume by catching FileNotFoundException raised by shadow VM relocate
    operation. The shadow VM relocate will be NOP if the source and the
    destination datastores are the same. In this case, the subsequent
    detach disk device from shadow VM will fail if the volume vmdk is
    missing. Handling this case by catching and ignoring
    FileNotFoundException raised by the detach operation.

    Change-Id: I33ad36b147f040364514d8097a1dfc363c50b0b7
    Closes-Bug: #1704196
    Co-Authored-By: <email address hidden>
    Co-Authored-By: <email address hidden>

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.0.0b1

This issue was fixed in the openstack/nova 17.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.