~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/common/glance_service/v2/image_service.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-01-05 12:21:37 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20150105122137-171bqrdpcxqipunk
Tags: 2015.1~b1-0ubuntu1
* New upstream beta release:
  - d/control: Align version requirements with upstream release.
* d/watch: Update uversionmangle to deal with kilo beta versioning
  changes.
* d/control: Bumped Standards-Version to 3.9.6, no changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
        an auth_token.
111
111
 
112
112
        :param image_info: The return from a GET request to Glance for a
113
 
        certain image_id. Should be a dictionary, with keys like 'name' and
114
 
        'checksum'. See
115
 
        http://docs.openstack.org/developer/glance/glanceapi.html for
116
 
        examples.
 
113
            certain image_id. Should be a dictionary, with keys like 'name' and
 
114
            'checksum'. See
 
115
            http://docs.openstack.org/developer/glance/glanceapi.html for
 
116
            examples.
117
117
        :returns: A signed Swift URL from which an image can be downloaded,
118
 
        without authentication.
 
118
            without authentication.
119
119
 
120
120
        :raises: InvalidParameterValue if Swift config options are not set
121
 
        correctly.
 
121
            correctly.
 
122
        :raises: MissingParameterValue if a required parameter is not set.
122
123
        :raises: ImageUnacceptable if the image info from Glance does not
123
 
        have a image ID.
 
124
            have a image ID.
124
125
        """
125
126
        self._validate_temp_url_config()
126
127
 
152
153
    def _validate_temp_url_config(self):
153
154
        """Validate the required settings for a temporary URL."""
154
155
        if not CONF.glance.swift_temp_url_key:
155
 
            raise exc.InvalidParameterValue(_(
 
156
            raise exc.MissingParameterValue(_(
156
157
                'Swift temporary URLs require a shared secret to be created. '
157
158
                'You must provide "swift_temp_url_key" as a config option.'))
158
159
        if not CONF.glance.swift_endpoint_url:
159
 
            raise exc.InvalidParameterValue(_(
 
160
            raise exc.MissingParameterValue(_(
160
161
                'Swift temporary URLs require a Swift endpoint URL. '
161
162
                'You must provide "swift_endpoint_url" as a config option.'))
162
163
        if not CONF.glance.swift_account:
163
 
            raise exc.InvalidParameterValue(_(
 
164
            raise exc.MissingParameterValue(_(
164
165
                'Swift temporary URLs require a Swift account string. '
165
166
                'You must provide "swift_account" as a config option.'))
166
167
        if CONF.glance.swift_temp_url_duration < 0:
168
169
                '"swift_temp_url_duration" must be a positive integer.'))
169
170
 
170
171
    def _get_location(self, image_id):
171
 
        """Returns the direct url representing the backend storage location,
 
172
        """Get storage URL.
 
173
 
 
174
        Returns the direct url representing the backend storage location,
172
175
        or None if this attribute is not shown by Glance.
173
176
        """
174
177
        image_meta = self.call('get', image_id)