Skip to content

Commit

Permalink
Merge pull request #103 from kumarashit/FixOrchVolProv
Browse files Browse the repository at this point in the history
Fix Volume provisioning service instance parameter validation
  • Loading branch information
skdwriting authored Jul 27, 2020
2 parents a3ddd6b + a66fa65 commit de1583c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions contrib/st2/opensds/actions/attach_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def run(self,
auth_token="",
volume_id=""):
data = {
"AttachMode": attach_mode,
"HostId": host_id,
"TenantId": tenant_id,
"VolumeId": volume_id}
"attachMode": attach_mode if attach_mode else "rw",
"hostId": host_id,
"tenantId": tenant_id,
"volumeId": volume_id}
headers = {
'content-type': 'application/json',
'x-auth-token': auth_token
Expand Down
14 changes: 7 additions & 7 deletions contrib/st2/opensds/actions/create_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def run(self,
auth_token="",
size=1):
data = {
"Name": name,
"Description": description,
"AvailabilityZone": availability_zone,
"ProfileId": profile_id,
"SnapshotId": snapshot_id,
"SnapshotFromCloud": snapshot_from_cloud,
"Size": size
"name": name,
"description": description if description else "Volume creation",
"availabilityZone": availability_zone if availability_zone else "default",
"profileId": profile_id,
"snapshotId": snapshot_id if snapshot_id else "",
"snapshotFromCloud": snapshot_from_cloud if snapshot_from_cloud else False,
"size": size
}
if profile_id:
data["ProfileId"] = profile_id
Expand Down
1 change: 1 addition & 0 deletions orchestration/db/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from sqlalchemy.sql.expression import and_
from orchestration.utils.config import logger


# session_scope can be used cleanly in transaction,
# references the officel document of sqlalchemy.
@contextmanager
Expand Down
1 change: 1 addition & 0 deletions tests/unit/db/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_list_services(mock_session):
result = api.list_services(None)
assert len(result) == 0


# ------------------------Test for task------------------------------------
@mock.patch('uuid.uuid4')
@mock.patch('orchestration.db.api.session_scope')
Expand Down

0 comments on commit de1583c

Please sign in to comment.