Merge "Always define properties for image even if empty" into stable/queens

This commit is contained in:
Zuul 2019-10-10 21:21:28 +00:00 committed by Gerrit Code Review
commit a20ae10d76
2 changed files with 18 additions and 7 deletions

View File

@ -282,11 +282,13 @@ class TestUploadOvercloudImage(TestPluginV1):
self.app.client_manager.image.images.create.call_count
)
self.assertEqual(
[mock.call(data=b'IMGDATA',
[mock.call(properties={},
data=b'IMGDATA',
name='overcloud-full-vmlinuz',
disk_format='aki',
is_public=True),
mock.call(data=b'IMGDATA',
mock.call(properties={},
data=b'IMGDATA',
name='overcloud-full-initrd',
disk_format='ari',
is_public=True),
@ -296,11 +298,13 @@ class TestUploadOvercloudImage(TestPluginV1):
container_format='bare',
disk_format='qcow2',
is_public=True),
mock.call(data=b'IMGDATA',
mock.call(properties={},
data=b'IMGDATA',
name='bm-deploy-kernel',
disk_format='aki',
is_public=True),
mock.call(data=b'IMGDATA',
mock.call(properties={},
data=b'IMGDATA',
name='bm-deploy-ramdisk',
disk_format='ari',
is_public=True)

View File

@ -307,6 +307,8 @@ class UploadOvercloudImage(command.Command):
self.log.debug("uploading %s overcloud images to glance" %
overcloud_image_type)
properties = {}
# vmlinuz and initrd only need to be uploaded for a partition image
if not parsed_args.whole_disk:
(oc_vmlinuz_name,
@ -321,6 +323,7 @@ class UploadOvercloudImage(command.Command):
name=oc_vmlinuz_name,
is_public=True,
disk_format='aki',
properties=properties,
data=self._read_image_file_pointer(
parsed_args.image_path, oc_vmlinuz_file)
))
@ -337,6 +340,7 @@ class UploadOvercloudImage(command.Command):
name=oc_initrd_name,
is_public=True,
disk_format='ari',
properties=properties,
data=self._read_image_file_pointer(
parsed_args.image_path, oc_initrd_file)
))
@ -353,8 +357,9 @@ class UploadOvercloudImage(command.Command):
is_public=True,
disk_format='qcow2',
container_format='bare',
properties={'kernel_id': kernel.id,
'ramdisk_id': ramdisk.id},
properties=dict({'kernel_id': kernel.id,
'ramdisk_id': ramdisk.id},
**properties),
data=self._read_image_file_pointer(
parsed_args.image_path, oc_file)
))
@ -382,7 +387,7 @@ class UploadOvercloudImage(command.Command):
is_public=True,
disk_format='qcow2',
container_format='bare',
properties={},
properties=properties,
data=self._read_image_file_pointer(
parsed_args.image_path, oc_file)
))
@ -400,6 +405,7 @@ class UploadOvercloudImage(command.Command):
name=deploy_kernel_name,
is_public=True,
disk_format='aki',
properties=properties,
data=self._read_image_file_pointer(
parsed_args.image_path,
deploy_kernel_file))
@ -415,6 +421,7 @@ class UploadOvercloudImage(command.Command):
name=deploy_ramdisk_name,
is_public=True,
disk_format='ari',
properties=properties,
data=self._read_image_file_pointer(parsed_args.image_path,
deploy_ramdisk_file))