← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1801342] [NEW] Attach a volume with scsi bus on an instance boot from cdrom fails

 

Public bug reported:

Following the upstream documentation to create images from an ISO
(https://docs.openstack.org/nova/rocky/user/launch-instance-using-ISO-
image.html) with an image from a vendor that required to have the disk
attached on the scsi bus (/dev/sda) in order to install the system, it
failed on attach volume step with the following traceback:


Driver failed to attach volume 95b42945-5d2a-4fba-b970-1d3fafcfbecc at /dev/sda: ValueError: max() arg is an empty sequence
Traceback (most recent call last):
   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 538, in _volume_attach
     device_type=self['device_type'], encryption=encryption)
   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1451, in attach_volume
     disk_info['unit'] = self._get_scsi_controller_max_unit(guest) + 1
   File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1134, in _get_scsi_controller_max_unit
     return max(ret)
 ValueError: max() arg is an empty sequence

Looking at the code

    def _get_scsi_controller_max_unit(self, guest):
        """Returns the max disk unit used by scsi controller"""
        xml = guest.get_xml_desc()
        tree = etree.fromstring(xml)
        addrs = "./devices/disk[@device='disk']/address[@type='drive']"

        ret = []
        for obj in tree.findall(addrs):
            ret.append(int(obj.get('unit', 0)))
        return max(ret)

As the instance has no existing devices in the scsi device bus, then the
ret array is empty and the max function just fails with the traceback
mentioned above.

** Affects: nova
     Importance: Undecided
     Assignee: Jose Castro Leon (jose-castro-leon)
         Status: In Progress

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1801342

Title:
  Attach a volume with scsi bus on an instance boot from cdrom fails

Status in OpenStack Compute (nova):
  In Progress

Bug description:
  Following the upstream documentation to create images from an ISO
  (https://docs.openstack.org/nova/rocky/user/launch-instance-using-ISO-
  image.html) with an image from a vendor that required to have the disk
  attached on the scsi bus (/dev/sda) in order to install the system, it
  failed on attach volume step with the following traceback:

  
  Driver failed to attach volume 95b42945-5d2a-4fba-b970-1d3fafcfbecc at /dev/sda: ValueError: max() arg is an empty sequence
  Traceback (most recent call last):
     File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 538, in _volume_attach
       device_type=self['device_type'], encryption=encryption)
     File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1451, in attach_volume
       disk_info['unit'] = self._get_scsi_controller_max_unit(guest) + 1
     File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1134, in _get_scsi_controller_max_unit
       return max(ret)
   ValueError: max() arg is an empty sequence

  Looking at the code

      def _get_scsi_controller_max_unit(self, guest):
          """Returns the max disk unit used by scsi controller"""
          xml = guest.get_xml_desc()
          tree = etree.fromstring(xml)
          addrs = "./devices/disk[@device='disk']/address[@type='drive']"

          ret = []
          for obj in tree.findall(addrs):
              ret.append(int(obj.get('unit', 0)))
          return max(ret)

  As the instance has no existing devices in the scsi device bus, then
  the ret array is empty and the max function just fails with the
  traceback mentioned above.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1801342/+subscriptions


Follow ups