blob: 35697c63f12179bfa0f055a5967e155a6fbc860a [file] [log] [blame]
Oleksiy Petrenkoe38f5a62018-11-21 12:58:07 +02001from cinderv3.common import send
2from cinderv3.arg_converter import get_by_name_or_uuid_multiple
3
4try:
5 from urllib.parse import urlencode
6except ImportError:
7 from urllib import urlencode
8
9
10@get_by_name_or_uuid_multiple([('volume', 'volume_id')])
11@send('post')
12def image_upload_volume(volume_id, image_name, **kwargs):
13 url = '/volumes/{}/action'.format(volume_id)
14 json = {
15 'os-volume_upload_image': {
16 'image_name': image_name,
17 }
18 }
19 json['os-volume_upload_image'].update(kwargs)
20 return url, json