device_type not respected

Bug #1223890 reported by Dennis Kliban
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Nikola Đipanov

Bug Description

When launching an instance with block_device_mapping_v2, if source_type="image", destination_type="volume" and device_type="cdrom", the block device is attached as "disk" running on "ide" bus. Expected to be "cdrom" on "ide" bus.

example with python-novaclient: https://dpaste.de/uojBC/
libvirt.xml generated from above command: https://dpaste.de/bSw71/

tags: added: libvirtt
tags: added: libvirt
removed: libvirtt
tags: added: volumes
Changed in nova:
assignee: nobody → Nikola Đipanov (ndipanov)
Dennis Kliban (dkliban)
description: updated
description: updated
summary: - disk_bus and device_type not respected
+ device_type not respected
description: updated
Changed in nova:
importance: Undecided → Low
milestone: none → havana-rc1
Changed in nova:
status: New → In Progress
Revision history for this message
Dennis Kliban (dkliban) wrote :

New patch produces some unexpected behavior. The 'cdrom' is now designated properly, however an extra volume of type 'file' is also created. Here are a couple of examples.

python code: https://dpaste.de/fMN0b/
xml produced: https://dpaste.de/0B42x/

python code: https://dpaste.de/quSwQ/
xml produced: https://dpaste.de/mIiSo/

Revision history for this message
Nikola Đipanov (ndipanov) wrote :

Hey Dennis - thanks for the thorough reports!

The disk.local disk you see appearing is intended behaviour if you have ephemeral set to a non 0 size in your flavor that you used to start the instance with (please check that this is the case).

Also - I have no idea where the <alias/> element comes from as I don't seem to get it on my system - can you make sure your devstack is updated to the latest master, and maybe write down the version of libvirt and the system you are using to try this.

Revision history for this message
Dennis Kliban (dkliban) wrote :

You were correct in identifying the problem. The flavor I was using had a 20Gb ephemeral disk associated with it.

Revision history for this message
Russell Bryant (russellb) wrote :

Ok, so sounds like this isn't a bug, right? I'm closing this out, but feel free to reopen if I misinterpreted things here.

Changed in nova:
status: In Progress → Invalid
milestone: havana-rc1 → none
Revision history for this message
Dennis Kliban (dkliban) wrote :

The patch that fixes this bug is awaiting approval. https://review.openstack.org/#/c/46298/

Changed in nova:
status: Invalid → In Progress
Changed in nova:
milestone: none → havana-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/46298
Committed: http://github.com/openstack/nova/commit/b65eecf2d8b4df9330c09dd31b818bbd5c0da3cb
Submitter: Jenkins
Branch: master

commit b65eecf2d8b4df9330c09dd31b818bbd5c0da3cb
Author: Nikola Dipanov <email address hidden>
Date: Thu Sep 12 17:19:59 2013 +0200

    Libvirt: volume driver set correct device type

    Due to a typo, libvirt volume driver was assigning the device type
    passed to the connect_volume method to the wrong attribute of the
    LibvirtConfigGuestDisk class (non existing device_type which is
    completely disregarded, instead of the expected source_device), which
    caused the rendered XML to always have the device set to 'disk'. This
    patch fixes that issue.

    Also adds the 'lun' type to the list of supported device_types since it
    is supported by libvirt but was missed in the previous refactoring.

    Tests are added to prevent future regressions.

    Closes-bug: #1223890

    Change-Id: Iee160afcc23f762a752df1ca20372944d5100291

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Dennis Kliban (dkliban) wrote :

The patch worked when I specified "device_name": "/dev/fd0", however, I still got an exception when I didn't provide a device name.

2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 1005, in _build_instance
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp self._default_block_device_names(context, instance, image_meta, bdms)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 1353, in _default_block_device_names
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp block_device_mapping)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/compute/manager.py", line 1284, in _default_device_names_for_instance
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp *block_device_lists)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 4744, in default_device_names_for_instance
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp block_device_mapping)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 425, in default_device_names
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp get_disk_info(virt_type, instance, block_device_info)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 612, in get_disk_info
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp image_meta, rescue)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 574, in get_disk_mapping
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp assigned_devices=pre_assigned_device_names)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 357, in get_info_from_bdm
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp device_name = find_disk_dev_for_disk_bus(padded_mapping, bdm_bus)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 172, in find_disk_dev_for_disk_bus
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp dev_prefix = get_dev_prefix_for_disk_bus(bus)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 141, in get_dev_prefix_for_disk_bus
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp disk_bus)
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp NovaException: Unable to determine disk prefix for None
2013-09-26 17:43:04.018 TRACE nova.openstack.common.rpc.amqp

Revision history for this message
Nikola Đipanov (ndipanov) wrote :

Dennis - this seems to be the wrong bug for comment #7. I believe you wanted to comment on https://bugs.launchpad.net/nova/+bug/1229273

I'll copy the comment on there.

Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-rc1 → 2013.2
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.