extend_volume for libvirt / fc volumes fails due to faulty debug code

Bug #1989894 reported by Mikhail Stolyarov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Rajesh Tailor

Bug Description

This is same bug as
https://bugs.launchpad.net/nova/+bug/1936439
but for fibrechannel volume

Python module nova/virt/libvirt/volume/fibrechannel.py has the following code:

    def extend_volume(self, connection_info, instance, requested_size):
        """Extend the volume."""
        LOG.debug("calling os-brick to extend FC Volume", instance=instance)
        new_size = self.connector.extend_volume(connection_info['data'])
        LOG.debug("Extend FC Volume %s; new_size=%s",
                  connection_info['data']['device_path'],
                  new_size, instance=instance)
        return new_size

There is some logs from openstack-nove-compute service while extend FC volume:

Sep 15, 2022 @ 18:51:56.000 Extend volume failed, volume_id=451af333-e991-450b-ad96-f8bf80758bef, reason: 'device_path'
Sep 15, 2022 @ 18:51:56.000 Exception during message handling

Traceback (most recent call last):, File "/usr/lib/python3.6/site-packages/oslo_messaging/rpc/server.py", line 165, in _process_incoming, res = self.dispatcher.dispatch(message), File "/usr/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 309, in dispatch, return self._do_dispatch(endpoint, method, ctxt, args), File "/usr/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 229, in _do_dispatch, result = func(ctxt, **new_args), File "/usr/lib/python3.6/site-packages/nova/exception_wrapper.py", line 72, in wrapped, context, exc, binary), File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 227, in exit, self.force_reraise(), File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 200, in force_reraise, raise self.value, File "/usr/lib/python3.6/site-packages/nova/exception_wrapper.py", line 63, in wrapped, return f(self, context, *args, **kw), File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 10452, in external_instance_event, self.extend_volume(context, instance, event.tag), File "/usr/lib/python3.6/site-packages/nova/compute/utils.py", line 1434, in decorated_function, return function(self, context, *args, **kwargs), File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 212, in decorated_function, kwargs['instance'], e, sys.exc_info()), File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 227, in exit, self.force_reraise(), File "/usr/lib/python3.6/site-packages/oslo_utils/excutils.py", line 200, in force_reraise, raise self.value, File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 200, in decorated_function, return function(self, context, *args, **kwargs), File "/usr/lib/python3.6/site-packages/nova/compute/manager.py", line 10310, in extend_volume, bdm.volume_size * units.Gi), File "/usr/lib/python3.6/site-packages/nova/virt/libvirt/driver.py", line 2655, in extend_volume, requested_size), File "/usr/lib/python3.6/site-packages/nova/virt/libvirt/driver.py", line 1871, in _extend_volume, requested_size), File "/usr/lib/python3.6/site-packages/nova/virt/libvirt/volume/fibrechannel.py", line 83, in extend_volume, # connection_info['data']['device_path'],, KeyError: 'device_path'

And this is fix (like in ISCSI bug) that worked for me with FC:

    def extend_volume(self, connection_info, instance, requested_size):
        """Extend the volume."""
        LOG.debug("calling os-brick to extend FC Volume", instance=instance)
        new_size = self.connector.extend_volume(connection_info['data'])
        # LOG.debug("Extend FC Volume %s; new_size=%s",
        LOG.debug("Extend FC Volume new_size=%s",
        # connection_info['data']['device_path'],
            new_size, instance=instance)
        return new_size

description: updated
Rajesh Tailor (ratailor)
Changed in nova:
assignee: nobody → Rajesh Tailor (ratailor)
Rajesh Tailor (ratailor)
Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/nova/+/858129

Revision history for this message
sean mooney (sean-k-mooney) wrote :

setting this to medium as i do not belive disabling debug logging will avoid this.

looking at os-brick device_path will be set in some fiber channel backend but its not always set so
we should not depend on it in our log message without at least checking if its set.

so this is valid but this is also not a common deployment configuration so the expected impact on user of nova is small.
for those that re hit by this however its a problem that should be fixed.

Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.opendev.org/c/openstack/nova/+/858129
Committed: https://opendev.org/openstack/nova/commit/f9fa785fa809d6ffbb93dc4eec0c1b4955bfec20
Submitter: "Zuul (22348)"
Branch: master

commit f9fa785fa809d6ffbb93dc4eec0c1b4955bfec20
Author: Rajesh Tailor <email address hidden>
Date: Fri Sep 16 17:38:18 2022 +0530

    extend_volume of libvirt/volume/fc should not use device_path

    The connection_info['data']['device_path'] field is not always
    available. In cases that it was not available, it would cause
    the debug code to raise a KeyError instead of proceeding.

    Other similar debug messages in the same file do not include
    device_path. As a simple fix, just drop the device_path from
    the log.

    Closes-Bug: #1989894
    Change-Id: I4218fb39ce80800be8c95da7132b3b74226ad10a

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

This issue was fixed in the openstack/nova 27.0.0.0rc1 release candidate.

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.