Oleksiy Petrenko | e38f5a6 | 2018-11-21 12:58:07 +0200 | [diff] [blame] | 1 | from cinderv3.common import send |
| 2 | from cinderv3.arg_converter import get_by_name_or_uuid_multiple |
| 3 | |
| 4 | try: |
| 5 | from urllib.parse import urlencode |
| 6 | except ImportError: |
| 7 | from urllib import urlencode |
| 8 | |
| 9 | |
| 10 | @get_by_name_or_uuid_multiple([('volume', 'volume_id')]) |
| 11 | @send('post') |
| 12 | def 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 |