← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1933966] Re: sync-images fails with Invalid glance image: <X>. Expected size=<Y> md5=None. Found size=<Y> md5=<Z>

 

Glance itself is returning an MD5 hash so that would need to change before simplestreams:
https://docs.openstack.org/glance/latest/user/glanceapi.html

The code using the glance api is in the validate_image() function from
simplestreams:

https://git.launchpad.net/simplestreams/tree/simplestreams/mirrors/glance.py#n515

    def validate_image(self, image_id, checksum, size, delete=True):
        """Validate an image's checksum and size after upload.

        Check for expected checksum and size.
        Throw an IOError if they do not match.

        :param image_id: str Glance Image ID
        :param checksum: str Expected MD5 sum of the image
        :param size: int Expected size in bytes of the image
        :returns: None
        """
        if not isinstance(size, util.INTEGER_TYPES):
            raise TypeError("size '%s' is not an integer" % str(size))
        found = self.gclient.images.get(image_id)
        if found.size == size and found.checksum == checksum:
            return
        msg = (
            ("Invalid glance image: %s. " % image_id) +
            ("Expected size=%s md5=%s. Found size=%s md5=%s." %
             (size, checksum, found.size, found.checksum)))
        if delete:
            LOG.warning("Deleting image %s: %s", image_id, msg)
            self.gclient.images.delete(image_id)
        raise IOError(msg)

** Also affects: glance
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1933966

Title:
  sync-images fails with Invalid glance image: <X>. Expected size=<Y>
  md5=None. Found size=<Y> md5=<Z>

Status in OpenStack Glance-Simplestreams-Sync Charm:
  Triaged
Status in charm-octavia-diskimage-retrofit:
  Triaged
Status in cloud-images:
  New
Status in Glance:
  New
Status in simplestreams:
  New

Bug description:
  Visible in this gate:
  https://review.opendev.org/c/openstack/charm-octavia-diskimage-retrofit/+/778995
  https://openstack-ci-reports.ubuntu.com/artifacts/d09/778995/5/check/bionic-ussuri/d092848/job-output.txt

  zaza.model.ActionFailed: Run of action "sync-images" with parameters "<not-set>" on "glance-simplestreams-sync/0" failed with "exit status 1" (id=36 status=failed enqueued=2021-06-28T16:55:10Z started=2021-06-28T16:55:11Z completed=2021-06-28T16:55:28Z output={'Code': '1', 'Stderr': '/usr/lib/python2.7/dist-packages/keystoneauth1/adapter.py:179: UserWarning: Using keystoneclient sessions has been deprecated. Please update your software to use keystoneauth1.\n  warnings.warn(\'Using keystoneclient sessions has been deprecated. \'\nTraceback (most recent call last):
    File "/snap/simplestreams/27/bin/sstream-mirror-glance", line 185, in <module>
      main()
    File "/snap/simplestreams/27/bin/sstream-mirror-glance", line 181, in main
      tmirror.sync(smirror, args.path)
    File "/snap/simplestreams/27/lib/python3.6/site-packages/simplestreams/mirrors/__init__.py", line 91, in sync
      return self.sync_index(reader, path, data, content)
    File "/snap/simplestreams/27/lib/python3.6/site-packages/simplestreams/mirrors/__init__.py", line 254, in sync_index
      self.sync(reader, path=epath)
    File "/snap/simplestreams/27/lib/python3.6/site-packages/simplestreams/mirrors/__init__.py", line 89, in sync
      return self.sync_products(reader, path, data, content)
    File "/snap/simplestreams/27/lib/python3.6/site-packages/simplestreams/mirrors/__init__.py", line 360, in sync_products
      (prodname, vername))
    File "/snap/simplestreams/27/lib/python3.6/site-packages/simplestreams/mirrors/glance.py", line 582, in insert_version
      self._insert_item(*iargs)
    File "/snap/simplestreams/27/lib/python3.6/site-packages/simplestreams/mirrors/glance.py", line 501, in _insert_item
      self.validate_image(glance_image.id, new_md5, new_size)
    File "/snap/simplestreams/27/lib/python3.6/site-packages/simplestreams/mirrors/glance.py", line 537, in validate_image
      raise IOError(msg)
  OSError: Invalid glance image: 3c4b49a4-a4c9-4b84-95eb-dbf0ce3d1e83. Expected size=172883968 md5=None. Found size=172883968 md5=078ff054bceec76f66ffeaa748f9f2e5.
  ', 'Stdout': 'sending incremental file list\nstreams/\nstreams/v1/\nstreams/v1/auto.sync.json\nstreams/v1/index.json\n\nsent 1,230 bytes  received 66 bytes  2,592.00 bytes/sec\ntotal size is 2,535  speedup is 1.96\n'})

To manage notifications about this bug go to:
https://bugs.launchpad.net/charm-glance-simplestreams-sync/+bug/1933966/+subscriptions