Skip to content

Commit

Permalink
Modify workflows to new OpenSDS attachment API format (#99)
Browse files Browse the repository at this point in the history
* Modify to new OpenSDS attachment API

* Implement review comments
  • Loading branch information
joseph-v authored and wisererik committed Nov 26, 2019
1 parent 27d70a9 commit 10448bf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 39 deletions.
12 changes: 4 additions & 8 deletions contrib/st2/opensds/actions/attach_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ def run(self,
ip_addr="",
port="",
tenant_id="",
mount_point="",
host_info="",
connection_info="",
access_protocol="",
attach_mode="",
host_id="",
auth_token="",
volume_id=""):
data = {
"Mountpoint": mount_point,
"HostInfo": host_info,
"ConnectionInfo": connection_info,
"AttachMode": attach_mode,
"HostId": host_id,
"TenantId": tenant_id,
"AccessProtocol": access_protocol,
"VolumeId": volume_id}
headers = {
'content-type': 'application/json',
Expand Down
12 changes: 3 additions & 9 deletions contrib/st2/opensds/actions/attach_volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,12 @@ parameters:
volume_id:
type: string
required: true
mount_point:
attach_mode:
type: string
required: false
host_info:
type: object
required: false
connection_info:
type: object
required: false
access_protocol:
host_id:
type: string
required: false
required: true
auth_token:
type: string
required: false
Expand Down
18 changes: 5 additions & 13 deletions contrib/st2/opensds/actions/provision_volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,14 @@ parameters:
type: string
description: "Snapshot from cloud to create volume"
required: false
mount_point:
attach_mode:
type: string
description: "Mount point to attach volume"
description: "Attach Mode 'ro' or 'rw' to attach volume"
required: false
host_info:
type: object
description: "Host info JSON to attach volume"
required: false
connection_info:
type: object
description: "Connectin info JSON to attach volume"
required: false
access_protocol:
host_id:
type: string
description: "Access protocol for attach volume"
required: false
description: "Host id to attach volume"
required: true
auth_token:
type: string
description: "Authentication Token"
Expand Down
12 changes: 4 additions & 8 deletions contrib/st2/opensds/actions/workflows/provision_volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ workflows:
- profile_id
- snapshot_id
- snapshot_from_cloud
- mount_point
- host_info
- connection_info
- access_protocol
- attach_mode
- host_id
- auth_token
- timeout
output:
Expand Down Expand Up @@ -53,10 +51,8 @@ workflows:
port: "<% $.port %>"
tenant_id: "<% $.tenant_id %>"
volume_id: <% $.volume_id %>
mount_point: <% $.mount_point %>
host_info: <% $.host_info %>
connection_info: <% $.connection_info %>
access_protocol: <% $.access_protocol %>
attach_mode: <% $.attach_mode %>
host_id: <% $.host_id %>
auth_token: "<% $.auth_token %>"
publish:
print_status : <% task(attach_volume).result.stdout %>
2 changes: 1 addition & 1 deletion docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ For the examples below OpenSDS is installed on VM and both StackStorm and Orches
https://localhost/api/v1/executions \
-H 'content-type: application/json' \
-H 'X-Auth-Token: <stackstorm token>' \
-d '{"action": "opensds.provision-volume", "user": null, "parameters": {"i_paddr": "<ip>", "port": "50040", "size": 1, "tenant_id": "<id>", "name": "test000", "auth_token": "<opensds token>", "host_info": {"host":"ubuntu","initiator":"iqn.1993-08.org.debian:01:437bac3717c8","ip":"<host ip>"}}}'
-d '{"action": "opensds.provision-volume", "user": null, "parameters": {"i_paddr": "<ip>", "port": "50040", "size": 1, "tenant_id": "<id>", "name": "test000", "auth_token": "<opensds token>", "host_id": "<host_id>"}}'
```

* Create Volume using StackStorm Action with input arguments
Expand Down

0 comments on commit 10448bf

Please sign in to comment.