Skip to content

Commit 30fbff8

Browse files
Vania XuMike Tutkowski
authored andcommitted
Changes/additions related to SolidFire automation tests
1 parent 21ff99b commit 30fbff8

9 files changed

Lines changed: 427 additions & 1 deletion

client/tomcatconf/commands.properties.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,12 @@ listApis=15
655655
getApiLimit=15
656656
resetApiLimit=1
657657

658+
#### API SolidFire Service Command
659+
getSolidFireAccountId=15
660+
getSolidFireVolumeSize=15
661+
getSolidFireVolumeAccessGroupId=15
662+
getSolidFireVolumeIscsiName=15
663+
658664
#### Region commands
659665
addRegion=1
660666
updateRegion=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.command.user.solidfire;
18+
19+
import com.cloud.user.Account;
20+
import com.cloud.org.Cluster;
21+
import com.cloud.storage.StoragePool;
22+
import com.cloud.dc.dao.ClusterDao;
23+
24+
import javax.inject.Inject;
25+
26+
import org.apache.log4j.Logger;
27+
28+
import org.apache.cloudstack.api.ApiConstants;
29+
import org.apache.cloudstack.api.APICommand;
30+
import org.apache.cloudstack.api.BaseCmd;
31+
import org.apache.cloudstack.api.Parameter;
32+
import org.apache.cloudstack.api.response.ApiSolidFireVolumeAccessGroupIdResponse;
33+
import org.apache.cloudstack.context.CallContext;
34+
import org.apache.cloudstack.solidfire.ApiSolidFireService;
35+
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
36+
37+
@APICommand(name = "getSolidFireVolumeAccessGroupId", responseObject = ApiSolidFireVolumeAccessGroupIdResponse.class, description = "Get the SF Volume Access Group ID",
38+
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
39+
public class GetSolidFireVolumeAccessGroupIdCmd extends BaseCmd {
40+
private static final Logger s_logger = Logger.getLogger(GetSolidFireVolumeAccessGroupIdCmd.class.getName());
41+
private static final String s_name = "getsolidfirevolumeaccessgroupidresponse";
42+
43+
@Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.STRING, description = "Cluster UUID", required = true)
44+
private String clusterUuid;
45+
@Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.STRING, description = "Storage Pool UUID", required = true)
46+
private String storagePoolUuid;
47+
48+
@Inject private ApiSolidFireService _apiSolidFireService;
49+
@Inject private ClusterDao _clusterDao;
50+
@Inject private PrimaryDataStoreDao _storagePoolDao;
51+
52+
/////////////////////////////////////////////////////
53+
/////////////// API Implementation///////////////////
54+
/////////////////////////////////////////////////////
55+
56+
@Override
57+
public String getCommandName() {
58+
return s_name;
59+
}
60+
61+
@Override
62+
public long getEntityOwnerId() {
63+
Account account = CallContext.current().getCallingAccount();
64+
65+
if (account != null) {
66+
return account.getId();
67+
}
68+
69+
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
70+
}
71+
72+
@Override
73+
public void execute() {
74+
Cluster cluster = _clusterDao.findByUuid(clusterUuid);
75+
StoragePool storagePool = _storagePoolDao.findByUuid(storagePoolUuid);
76+
77+
ApiSolidFireVolumeAccessGroupIdResponse response = _apiSolidFireService.getSolidFireVolumeAccessGroupId(cluster.getId(), storagePool.getId());
78+
79+
response.setResponseName(getCommandName());
80+
response.setObjectName("apisolidfirevolumeaccessgroupid");
81+
82+
this.setResponseObject(response);
83+
}
84+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.command.user.solidfire;
18+
19+
import com.cloud.storage.dao.VolumeDao;
20+
import com.cloud.storage.Volume;
21+
import com.cloud.user.Account;
22+
23+
import javax.inject.Inject;
24+
25+
import org.apache.log4j.Logger;
26+
import org.apache.cloudstack.api.ApiConstants;
27+
import org.apache.cloudstack.api.APICommand;
28+
import org.apache.cloudstack.api.BaseCmd;
29+
import org.apache.cloudstack.api.Parameter;
30+
import org.apache.cloudstack.api.response.ApiSolidFireVolumeIscsiNameResponse;
31+
import org.apache.cloudstack.context.CallContext;
32+
import org.apache.cloudstack.solidfire.ApiSolidFireService;
33+
34+
@APICommand(name = "getSolidFireVolumeIscsiName", responseObject = ApiSolidFireVolumeIscsiNameResponse.class, description = "Get SolidFire Volume's Iscsi Name",
35+
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
36+
37+
public class GetSolidFireVolumeIscsiNameCmd extends BaseCmd {
38+
private static final Logger s_logger = Logger.getLogger(GetSolidFireVolumeIscsiNameCmd.class.getName());
39+
private static final String s_name = "getsolidfirevolumeiscsinameresponse";
40+
41+
@Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.STRING, description = "CloudStack Volume UUID", required = true)
42+
private String volumeUuid;
43+
44+
@Inject private ApiSolidFireService _apiSolidFireService;
45+
@Inject private VolumeDao _volumeDao;
46+
47+
/////////////////////////////////////////////////////
48+
/////////////// API Implementation///////////////////
49+
/////////////////////////////////////////////////////
50+
51+
@Override
52+
public String getCommandName() {
53+
return s_name;
54+
}
55+
56+
@Override
57+
public long getEntityOwnerId() {
58+
Account account = CallContext.current().getCallingAccount();
59+
60+
if (account != null) {
61+
return account.getId();
62+
}
63+
64+
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
65+
}
66+
67+
@Override
68+
public void execute() {
69+
Volume volume = _volumeDao.findByUuid(volumeUuid);
70+
71+
ApiSolidFireVolumeIscsiNameResponse response = _apiSolidFireService.getSolidFireVolumeIscsiName(volume);
72+
73+
response.setResponseName(getCommandName());
74+
response.setObjectName("apisolidfirevolumeiscsiname");
75+
76+
this.setResponseObject(response);
77+
}
78+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.command.user.solidfire;
18+
19+
import com.cloud.storage.Volume;
20+
import com.cloud.user.Account;
21+
import com.cloud.storage.dao.VolumeDao;
22+
import com.cloud.storage.StoragePool;
23+
24+
import javax.inject.Inject;
25+
26+
import org.apache.log4j.Logger;
27+
28+
import org.apache.cloudstack.api.ApiConstants;
29+
import org.apache.cloudstack.api.APICommand;
30+
import org.apache.cloudstack.api.BaseCmd;
31+
import org.apache.cloudstack.api.Parameter;
32+
import org.apache.cloudstack.api.response.ApiSolidFireVolumeSizeResponse;
33+
import org.apache.cloudstack.context.CallContext;
34+
import org.apache.cloudstack.solidfire.ApiSolidFireService;
35+
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
36+
37+
@APICommand(name = "getSolidFireVolumeSize", responseObject = ApiSolidFireVolumeSizeResponse.class, description = "Get the SF volume size including Hypervisor Snapshot Reserve",
38+
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
39+
public class GetSolidFireVolumeSizeCmd extends BaseCmd {
40+
private static final Logger s_logger = Logger.getLogger(GetSolidFireVolumeSizeCmd.class.getName());
41+
private static final String s_name = "getsolidfirevolumesizeresponse";
42+
43+
@Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.STRING, description = "Volume UUID", required = true)
44+
private String volumeUuid;
45+
@Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.STRING, description = "Storage Pool UUID", required = true)
46+
private String storagePoolUuid;
47+
48+
@Inject private ApiSolidFireService _apiSolidFireService;
49+
@Inject private VolumeDao _volumeDao;
50+
@Inject private PrimaryDataStoreDao _storagePoolDao;
51+
52+
/////////////////////////////////////////////////////
53+
/////////////// API Implementation///////////////////
54+
/////////////////////////////////////////////////////
55+
56+
@Override
57+
public String getCommandName() {
58+
return s_name;
59+
}
60+
61+
@Override
62+
public long getEntityOwnerId() {
63+
Account account = CallContext.current().getCallingAccount();
64+
65+
if (account != null) {
66+
return account.getId();
67+
}
68+
69+
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
70+
}
71+
72+
@Override
73+
public void execute() {
74+
Volume volume = _volumeDao.findByUuid(volumeUuid);
75+
StoragePool storagePool = _storagePoolDao.findByUuid(storagePoolUuid);
76+
77+
ApiSolidFireVolumeSizeResponse response = _apiSolidFireService.getSolidFireVolumeSize(volume, storagePool);
78+
79+
response.setResponseName(getCommandName());
80+
response.setObjectName("apisolidfirevolumesize");
81+
82+
this.setResponseObject(response);
83+
}
84+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.response;
18+
19+
import com.cloud.serializer.Param;
20+
21+
import com.google.gson.annotations.SerializedName;
22+
23+
import org.apache.cloudstack.api.BaseResponse;
24+
25+
public class ApiSolidFireVolumeAccessGroupIdResponse extends BaseResponse {
26+
@SerializedName("solidFireVolumeAccessGroupId")
27+
@Param(description = "SolidFire Volume Access Group Id")
28+
private long solidFireVolumeAccessGroupId;
29+
30+
public ApiSolidFireVolumeAccessGroupIdResponse(long sfVolumeAccessGroupId) {
31+
solidFireVolumeAccessGroupId = sfVolumeAccessGroupId;
32+
}
33+
34+
public long getSolidFireAccessGroupId() {
35+
return solidFireVolumeAccessGroupId;
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.response;
18+
19+
import com.cloud.serializer.Param;
20+
21+
import com.google.gson.annotations.SerializedName;
22+
23+
import org.apache.cloudstack.api.BaseResponse;
24+
25+
public class ApiSolidFireVolumeIscsiNameResponse extends BaseResponse {
26+
@SerializedName("solidFireVolumeIscsiName")
27+
@Param(description = "SolidFire Volume Iscsi Name")
28+
private String solidFireVolumeIscsiName;
29+
30+
public ApiSolidFireVolumeIscsiNameResponse(String sfVolumeIscsiName) {
31+
solidFireVolumeIscsiName = sfVolumeIscsiName;
32+
}
33+
34+
public String getSolidFireVolumeIscsiName() {
35+
return solidFireVolumeIscsiName;
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.response;
18+
19+
import com.cloud.serializer.Param;
20+
21+
import com.google.gson.annotations.SerializedName;
22+
23+
import org.apache.cloudstack.api.BaseResponse;
24+
25+
public class ApiSolidFireVolumeSizeResponse extends BaseResponse {
26+
@SerializedName("solidFireVolumeSize")
27+
@Param(description = "SolidFire Volume Size Including Hypervisor Snapshot Reserve")
28+
private long solidFireVolumeSize;
29+
30+
public ApiSolidFireVolumeSizeResponse(long sfVolumeSize) {
31+
solidFireVolumeSize = sfVolumeSize;
32+
}
33+
34+
public long getSolidFireVolumeSize() {
35+
return solidFireVolumeSize;
36+
}
37+
}

0 commit comments

Comments
 (0)