blob: 9732cad7265357509291efa23fd242bbe132008c [file] [log] [blame]
Oleksiy Petrenkoa5eb0602018-07-26 15:12:25 +03001from ironicv1.common import send
2try:
3 from urllib.parse import urlencode
4except ImportError:
5 from urllib import urlencode
6
7
8@send('get')
9def volume_resource_list(**kwargs):
10 url = '/volume'
11 return url, {}
12
13
14@send('get')
15def volume_connector_list(**kwargs):
16 url = '/volume/connectors?{}'.format(urlencode(kwargs))
17 return url, {}
18
19
20@send('post')
21def volume_connector_create(node_uuid, volume_type, connector_id, **kwargs):
22 url = '/volume/connectors'
23 json = {
24 'node_uuid': node_uuid,
25 'type': volume_type,
26 'connector_id': connector_id,
27 }
28 json.update(kwargs)
29 return url, {'json': json}
30
31
32@send('get')
33def volume_connector_get_details(volume_connector_id, **kwargs):
34 url = '/volume/connectors/{}?{}'.format(
35 volume_connector_id, urlencode(kwargs))
36 return url, {}
37
38
39@send('patch')
40def volume_connector_update(volume_connector_id, properties, **kwargs):
41 url = '/volume/connectors/{}'.format(volume_connector_id)
42 return url, {'json': properties}
43
44
45@send('delete')
46def volume_connector_delete(volume_connector_id, **kwargs):
47 url = '/volume/connectors/{}'.format(volume_connector_id)
48 return url, {}
49
50
51@send('get')
52def volume_target_list(**kwargs):
53 url = '/volume/targets?{}'.format(urlencode(kwargs))
54 return url, {}
55
56
57@send('post')
58def volume_target_create(node_uuid, volume_type, properties,
59 boot_index, volume_id, **kwargs):
60 url = '/volume/targets'
61 json = {
62 'node_uuid': node_uuid,
63 'volume_type': volume_type,
64 'properties': properties,
65 'boot_index': boot_index,
66 'volume_id': volume_id,
67 }
68 json.update(kwargs)
69 return url, {'json': json}
70
71
72@send('get')
73def volume_target_get_details(target_id, **kwargs):
74 url = '/volume/targets/{}?{}'.format(target_id, urlencode(kwargs))
75 return url, {}
76
77
78@send('patch')
79def volume_target_update(target_id, properties, **kwargs):
80 url = '/volume/targets/{}'.format(target_id)
81 return url, {'json': properties}
82
83
84@send('delete')
85def volume_target_delete(target_id, **kwargs):
86 url = '/volume/targets/{}'.format(target_id)
87 return url, {}