RFE: add support for floppy device type to libvirt driver

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

Bug Description

When attaching a volume as a floppy libvirt driver raises an exception because it is not aware of a disk bus for a floppy.

Revision history for this message
Daniel Berrange (berrange) wrote :

Please provide info on the exact commands you are running to reproduce this problem & details of the exception you are ge5tting.

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

block_device_mapping_v2 : https://dpaste.de/ovnOI/

exception: https://dpaste.de/0gWwr/

Revision history for this message
Daniel Berrange (berrange) wrote :

Please don't use pastebin to provide information on bugs. They expire leaving future readers of the bugs with no information

block_device_mapping_v2 = [
            {"source_type": "volume",
             "destination_type": "volume",
             "uuid": "04e0887c-e4e1-4156-95ca-bf0aa80c47b6",
             "boot_index": "1",
             "device_type": "cdrom",
             "volume_size": "3",
             "disk_bus": "ide",
            },
            {"source_type": "volume",
             "destination_type": "volume",
             "uuid": "be2b7c60-4f80-4471-a77d-23ad75127138",
             "boot_index": "2",
             "device_type": "floppy",
             "volume_size": "1",
             "device_name": "/dev/fd0",
            },
            ]

2013-09-23 13:14:28.129 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-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp block_device_mapping)
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 421, in default_device_names
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp get_disk_info(virt_type, instance, block_device_info)
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 608, in get_disk_info
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp image_meta, rescue)
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 570, in get_disk_mapping
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp assigned_devices=pre_assigned_device_names)
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 341, in get_info_from_bdm
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp bdm_bus = get_disk_bus_for_disk_dev(virt_type, device_name)
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp File "/opt/stack/nova/nova/virt/libvirt/blockinfo.py", line 281, in get_disk_bus_for_disk_dev
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp disk_dev[:1])
2013-09-23 13:14:28.129 TRACE nova.openstack.common.rpc.amqp NovaException: Unable to determine disk bus for 'f'

Changed in nova:
assignee: nobody → Nikola Đipanov (ndipanov)
Revision history for this message
Nikola Đipanov (ndipanov) wrote :

 I am not sure this is actually a bug - although I guess it could be made more resilient.

The libvirt driver needs to know the device type, bus and device name in order to be able to generate the xml for booting an instance. It will first decide the type based on what was passed in device_type and what is allowed, after that it will attempt decide the bus if it was not passed in or is bogus and it will do this based on the device name that is passed in if there is one or based on the type. The issue is that we don't allow for the case that the device name will not resolve to a valid bus in our current code.

We could handle this:

1) Since we have a type one way or another - use it to determine a valid bus if the device fails to resolve.
2) Alternatively update the device name if it cannot resolve to a valid bus. We are actually trying to discourage setting device names at all so this may not be something we want to do.

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/48441

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/48455

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Nikola Đipanov (ndipanov) wrote : Re: libvirt driver can't determine bus for device type 'floppy'

Dennis Kliban reports further:

"""
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 :

I've updated the proposed patches and they should now take care of this.

Revision history for this message
Daniel Berrange (berrange) wrote :

The libvirt driver has never claimed to support floppy devices. Changing the bug subject to reflect that this is in effect a feature request for adding floppy support.

summary: - libvirt driver can't determine bus for device type 'floppy'
+ RFE: add support for floppy device type to libvirt driver
Mark McLoughlin (markmc)
Changed in nova:
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/48455
Committed: http://github.com/openstack/nova/commit/94a3073e60c7baa8613dbdc1841210636352f526
Submitter: Jenkins
Branch: master

commit 94a3073e60c7baa8613dbdc1841210636352f526
Author: Nikola Dipanov <email address hidden>
Date: Thu Sep 26 16:20:08 2013 +0200

    Libvirt: default device bus for floppy block devs

    Even though 'floppy' is a valid device type, libvirt driver was
    not supporting it.

    This patch makes the bus for floppy devices be defaulted to 'fdc' if not
    specified, when running libvirt with KVM.

    Also it makes the device name prefix for devices on the fdc bus default
    to 'fd' so that it is possible to default device names for floppy
    devices. It also makes the fdc count as valid bus for kvm/qemu
    hypervisors.

    This effectively adds support for the floppy devices in the libvirt
    driver.

    Closes-bug: #1229273

    Change-Id: If030109fa16a2518a550fc0dc31341442262756c

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-1 → 2014.1
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.