VMware: Failed to launch instance from volume

Bug #1367540 reported by Thang Pham
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Matthew Booth
Icehouse
Fix Released
High
Matthew Booth
Juno
Fix Released
High
Sagar Ratnakara Nikam

Bug Description

If you create a volume from an image and launch an instance from it, the instance fails to be created.

To recreate this bug:
1. Create a volume from an image
2. Launch an instance from the volume

The following error is thrown in n-cpu.log:

2014-09-09 22:33:47.037 ERROR nova.compute.manager [req-e17654a6-a58b-4760-a383-643dd054c691 demo demo] [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] Instance failed to spawn
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] Traceback (most recent call last):
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] File "/opt/stack/nova/nova/compute/manager.py", line 2171, in _build_resources
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] yield resources
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] File "/opt/stack/nova/nova/compute/manager.py", line 2050, in _build_and_run_instance
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] block_device_info=block_device_info)
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] File "/opt/stack/nova/nova/virt/vmwareapi/driver.py", line 446, in spawn
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] admin_password, network_info, block_device_info)
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] File "/opt/stack/nova/nova/virt/vmwareapi/vmops.py", line 298, in spawn
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] vi = self._get_vm_config_info(instance, image_info, instance_name)
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] File "/opt/stack/nova/nova/virt/vmwareapi/vmops.py", line 276, in _get_vm_config_info
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] image_info.file_size_in_gb > instance.root_gb):
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] File "/opt/stack/nova/nova/virt/vmwareapi/vmware_images.py", line 92, in file_size_in_gb
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] return self.file_size / units.Gi
2014-09-09 22:33:47.037 32639 TRACE nova.compute.manager [instance: 5ed921e8-c4d8-45a1-964a-93d09a43f2ea] TypeError: unsupported operand type(s) for /: 'unicode' and 'int'

It appears that a simple conversion of the file_size to an int in vmware_images.py should fix this.

Tags: vmware
Thang Pham (thang-pham)
Changed in nova:
importance: Undecided → High
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/120309

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in nova:
assignee: Thang Pham (thang-pham) → Matthew Booth (mbooth-9)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Thang Pham (<email address hidden>) on branch: master
Review: https://review.openstack.org/120309
Reason: Thanks for the fix Matt. I'll try the patch out later on VMware.

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

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

commit 688be19e8a2170276451926401af8257c4faece5
Author: Matthew Booth <email address hidden>
Date: Thu Sep 25 11:33:49 2014 +0100

    Fix image metadata returned for volumes

    When creating a volume from a glance image, cinder stores the original
    image metadata in volume_glance_metadata. This is a key/value store,
    and all the values are strings.

    When Nova boots an instance from a volume, it passes the image
    metadata returned by cinder, which is all strings. If a driver
    expects these values to be ints, as they are when booting from an
    image, it will get a type error.

    This change also pulls size from the volume directly rather than
    taking the value from the stored image metadata. This is because the
    volume will have been created in 1Gb increments, and is unlikely to be
    the same size as the original image. It may also have been
    subsequently extended.

    Change-Id: I7928f6be1ca99f1502941b9df2b443f2ca63a37b
    Closes-Bug: #1367540

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/149822

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/juno)

Reviewed: https://review.openstack.org/149822
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=33e0813b22fb996558b51f1cba28dcface8cfed3
Submitter: Jenkins
Branch: stable/juno

commit 33e0813b22fb996558b51f1cba28dcface8cfed3
Author: Matthew Booth <email address hidden>
Date: Thu Sep 25 11:33:49 2014 +0100

    Fix image metadata returned for volumes

    When creating a volume from a glance image, cinder stores the original
    image metadata in volume_glance_metadata. This is a key/value store,
    and all the values are strings.

    When Nova boots an instance from a volume, it passes the image
    metadata returned by cinder, which is all strings. If a driver
    expects these values to be ints, as they are when booting from an
    image, it will get a type error.

    This change also pulls size from the volume directly rather than
    taking the value from the stored image metadata. This is because the
    volume will have been created in 1Gb increments, and is unlikely to be
    the same size as the original image. It may also have been
    subsequently extended.

    Cherry picked from https://review.openstack.org/#/c/124010/

    Closes-Bug: #1367540

    Conflicts:
     nova/compute/api.py
     nova/tests/compute/test_compute.py

    Change-Id: I7928f6be1ca99f1502941b9df2b443f2ca63a37b

tags: added: in-stable-juno
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/152556

Alan Pevec (apevec)
tags: removed: in-stable-juno
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/icehouse)

Reviewed: https://review.openstack.org/152556
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=4b46a86f8a2af096e399df8518f8269f825684e0
Submitter: Jenkins
Branch: stable/icehouse

commit 4b46a86f8a2af096e399df8518f8269f825684e0
Author: Matthew Booth <email address hidden>
Date: Thu Sep 25 11:33:49 2014 +0100

    Fix image metadata returned for volumes

    When creating a volume from a glance image, cinder stores the original
    image metadata in volume_glance_metadata. This is a key/value store,
    and all the values are strings.

    When Nova boots an instance from a volume, it passes the image
    metadata returned by cinder, which is all strings. If a driver
    expects these values to be ints, as they are when booting from an
    image, it will get a type error.

    This change also pulls size from the volume directly rather than
    taking the value from the stored image metadata. This is because the
    volume will have been created in 1Gb increments, and is unlikely to be
    the same size as the original image. It may also have been
    subsequently extended.

    (cherry picked from commit 688be19e8a2170276451926401af8257c4faece5)

    Conflicts:
     nova/compute/api.py
     nova/tests/compute/test_compute.py

    Change-Id: I7928f6be1ca99f1502941b9df2b443f2ca63a37b
    Closes-Bug: #1367540
    Closes-Bug: #1255317

Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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