Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronise yoga with upstream #30

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitreview
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
host=review.opendev.org
port=29418
project=openstack/glance.git
defaultbranch=stable/yoga
defaultbranch=unmaintained/yoga
2 changes: 1 addition & 1 deletion glance/common/format_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ def virtual_size(self):
else:
vmdktype = b'formatnotfound'
if vmdktype != b'monolithicSparse':
raise ImageFormatError('Unsupported VMDK format %s' % vmdktype)
LOG.warning('Unsupported VMDK format %s', vmdktype)
return 0

# If we have the descriptor, we definitely have the header
Expand Down
18 changes: 18 additions & 0 deletions glance/tests/unit/common/test_format_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,24 @@ def test_vmdk_invalid(self):
def test_vdi_invalid(self):
self._test_format_with_invalid_data('vdi')

def test_vmdk_invalid_type(self):
fmt = format_inspector.get_inspector('vmdk')()
wrapper = format_inspector.InfoWrapper(open(__file__, 'rb'), fmt)
while True:
chunk = wrapper.read(32)
if not chunk:
break

wrapper.close()

fake_rgn = mock.MagicMock()
fake_rgn.complete = True
fake_rgn.data = b'foocreateType="someunknownformat"bar'

with mock.patch.object(fmt, 'has_region', return_value=True):
with mock.patch.object(fmt, 'region', return_value=fake_rgn):
self.assertEqual(0, fmt.virtual_size)


class TestFormatInspectorInfra(test_utils.BaseTestCase):
def _test_capture_region_bs(self, bs):
Expand Down
Loading