From f666e5f5e6dafedb76c83eb7935a5db4bc8d9b42 Mon Sep 17 00:00:00 2001 From: Dave McNally Date: Tue, 24 Nov 2015 15:48:20 +0000 Subject: [PATCH] Add the Docker container format A Docker image is a tar archive typically containing a container filesystem. In order to use the nova-docker compute driver nova and boot docker instances glance support of the docker container format is required. This patch adds the Docker container format to the Glance configuration. DocImpact: Docs will need to be updated to indicate that the docker container_format is now one of the default container formats supported by Glance. UpgradeImpact: Adds 'docker' to the default list of container_formats. Operators will no longer need to configure specifically to use docker containers. Closes-Bug: #1519402 Change-Id: Ifa206686086232a5599e7bc27a852bc5f3186ebc --- doc/source/formats.rst | 5 +++++ doc/source/glanceapi.rst | 2 +- etc/glance-api.conf | 2 +- glance/common/config.py | 2 +- glance/contrib/plugins/image_artifact/v1/image.py | 3 ++- glance/tests/unit/v2/test_images_resource.py | 2 +- rally-jobs/plugins/plugin_sample.py | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/source/formats.rst b/doc/source/formats.rst index fd464e4e..c763a77e 100644 --- a/doc/source/formats.rst +++ b/doc/source/formats.rst @@ -106,3 +106,8 @@ You can set your image's container format to one of the following: * **ova** This indicates what is stored in Glance is an OVA tar archive file + +* **docker** + + This indicates what is stored in Glance is a Docker tar archive of + the container filesystem diff --git a/doc/source/glanceapi.rst b/doc/source/glanceapi.rst index c0add710..743e3aa0 100644 --- a/doc/source/glanceapi.rst +++ b/doc/source/glanceapi.rst @@ -427,7 +427,7 @@ The list of metadata headers that Glance accepts are listed below. * ``x-image-meta-container_format`` This header is required, unless reserving an image. Valid values are one of - ``aki``, ``ari``, ``ami``, ``bare``, or ``ovf``. + ``aki``, ``ari``, ``ami``, ``bare``, ``ovf``, or ``docker``. For more information, see :doc:`About Disk and Container Formats `. diff --git a/etc/glance-api.conf b/etc/glance-api.conf index dc773bad..ce44c424 100644 --- a/etc/glance-api.conf +++ b/etc/glance-api.conf @@ -963,7 +963,7 @@ # Supported values for the 'container_format' image attribute (list # value) # Deprecated group/name - [DEFAULT]/container_formats -#container_formats = ami,ari,aki,bare,ovf,ova +#container_formats = ami,ari,aki,bare,ovf,ova,docker # Supported values for the 'disk_format' image attribute (list value) # Deprecated group/name - [DEFAULT]/disk_formats diff --git a/glance/common/config.py b/glance/common/config.py index ebf97fc3..51ea8136 100644 --- a/glance/common/config.py +++ b/glance/common/config.py @@ -45,7 +45,7 @@ paste_deploy_opts = [ ] image_format_opts = [ cfg.ListOpt('container_formats', - default=['ami', 'ari', 'aki', 'bare', 'ovf', 'ova'], + default=['ami', 'ari', 'aki', 'bare', 'ovf', 'ova', 'docker'], help=_("Supported values for the 'container_format' " "image attribute"), deprecated_opts=[cfg.DeprecatedOpt('container_formats', diff --git a/glance/contrib/plugins/image_artifact/v1/image.py b/glance/contrib/plugins/image_artifact/v1/image.py index 176c4b9a..e4ca1039 100644 --- a/glance/contrib/plugins/image_artifact/v1/image.py +++ b/glance/contrib/plugins/image_artifact/v1/image.py @@ -27,7 +27,8 @@ class ImageAsAnArtifact(definitions.ArtifactType): mutable=False) container_format = definitions.String(allowed_values=['ami', 'ari', 'aki', 'bare', - 'ovf', 'ova'], + 'ovf', 'ova', + 'docker'], required=True, mutable=False) min_disk = definitions.Integer(min_value=0, default=0) diff --git a/glance/tests/unit/v2/test_images_resource.py b/glance/tests/unit/v2/test_images_resource.py index df86e9fe..c5c5a2e7 100644 --- a/glance/tests/unit/v2/test_images_resource.py +++ b/glance/tests/unit/v2/test_images_resource.py @@ -3755,7 +3755,7 @@ class TestImageSchemaFormatConfiguration(test_utils.BaseTestCase): def test_default_container_formats(self): schema = glance.api.v2.images.get_schema() - expected = [None, 'ami', 'ari', 'aki', 'bare', 'ovf', 'ova'] + expected = [None, 'ami', 'ari', 'aki', 'bare', 'ovf', 'ova', 'docker'] actual = schema.properties['container_format']['enum'] self.assertEqual(expected, actual) diff --git a/rally-jobs/plugins/plugin_sample.py b/rally-jobs/plugins/plugin_sample.py index ffbb283f..2959de42 100644 --- a/rally-jobs/plugins/plugin_sample.py +++ b/rally-jobs/plugins/plugin_sample.py @@ -39,7 +39,7 @@ class GlancePlugin(scenario.OpenStackScenario): :param image_name: String used to name the image :param container_format: Container format of image. - Acceptable formats: ami, ari, aki, bare, and ovf. + Acceptable formats: ami, ari, aki, bare, ovf, and docker. :param image_location: image file location used to upload :param disk_format: Disk format of image. Acceptable formats: ami, ari, aki, vhd, vmdk, raw, qcow2, vdi, and iso.