Skip to content

Commit ca8ce8c

Browse files
Merge branch '4.20'
2 parents 9712b4d + 7acd5a3 commit ca8ce8c

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/ListProjectRolesCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public String getRoleName() {
7272

7373
@Override
7474
public void execute() {
75-
List<ProjectRole> projectRoles;
75+
List<ProjectRole> projectRoles = new ArrayList<>();
7676
if (getProjectId() != null && getProjectRoleId() != null) {
7777
projectRoles = Collections.singletonList(projRoleService.findProjectRole(getProjectRoleId(), getProjectId()));
7878
} else if (StringUtils.isNotBlank(getRoleName())) {

plugins/metrics/src/main/java/org/apache/cloudstack/metrics/MetricsServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public List<StoragePoolMetricsResponse> listStoragePoolMetrics(List<StoragePoolR
644644
metricsResponse.setStorageUsedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageThreshold);
645645
metricsResponse.setStorageUsedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
646646
metricsResponse.setStorageAllocatedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeAllocated(), poolResponse.getOverProvisionFactor(), storageThreshold);
647-
metricsResponse.setStorageAllocatedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
647+
metricsResponse.setStorageAllocatedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeAllocated(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
648648
metricsResponses.add(metricsResponse);
649649
}
650650
return metricsResponses;

plugins/network-elements/juniper-contrail/src/main/java/org/apache/cloudstack/network/contrail/management/EventUtils.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public class EventUtils {
4848

4949
private static EventDistributor eventDistributor;
5050

51+
private static final String MODULE_TOP_LEVEL_PACKAGE =
52+
EventUtils.class.getPackage().getName().substring(0,
53+
EventUtils.class.getPackage().getName().lastIndexOf('.'));
54+
5155
public EventUtils() {
5256
}
5357

@@ -143,6 +147,13 @@ public Object interceptStart(Method method, Object target) {
143147
@Override
144148
public void interceptComplete(Method method, Object target, Object event) {
145149
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
150+
boolean sameModule = false;
151+
if (target != null && target.getClass().getPackage() != null) {
152+
sameModule = target.getClass().getPackage().getName().startsWith(MODULE_TOP_LEVEL_PACKAGE);
153+
}
154+
if (!sameModule) {
155+
return;
156+
}
146157
if (actionEvent != null) {
147158
CallContext ctx = CallContext.current();
148159
if (!actionEvent.create()) {

plugins/storage/image/swift/src/main/java/org/apache/cloudstack/storage/datastore/driver/SwiftImageStoreDriverImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import com.cloud.configuration.Config;
2828
import com.cloud.utils.SwiftUtil;
29-
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
3029

3130
import org.apache.cloudstack.api.ApiConstants;
3231
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
@@ -37,18 +36,21 @@
3736
import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager;
3837
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
3938
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
39+
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
4040
import org.apache.cloudstack.storage.command.DownloadCommand;
4141
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
4242
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
4343
import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
4444
import org.apache.cloudstack.storage.to.TemplateObjectTO;
45+
import org.apache.log4j.Logger;
4546

4647
import com.cloud.agent.api.storage.DownloadAnswer;
4748
import com.cloud.agent.api.to.DataObjectType;
4849
import com.cloud.agent.api.to.DataStoreTO;
4950
import com.cloud.agent.api.to.SwiftTO;
51+
import com.cloud.configuration.Config;
5052
import com.cloud.storage.Storage.ImageFormat;
51-
import com.cloud.template.VirtualMachineTemplate;
53+
import com.cloud.utils.SwiftUtil;
5254
import com.cloud.utils.exception.CloudRuntimeException;
5355

5456
public class SwiftImageStoreDriverImpl extends BaseImageStoreDriverImpl {
@@ -99,8 +101,13 @@ public String createEntityExtractUrl(DataStore store, String installPath, ImageF
99101
@Override
100102
public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
101103
Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
102-
VirtualMachineTemplate tmpl = _templateDao.findById(data.getId());
103104
DataStore cacheStore = cacheManager.getCacheStorage(dataStore.getScope());
105+
if (cacheStore == null) {
106+
String errMsg = String.format("No cache store found for scope: %s",
107+
dataStore.getScope().getScopeType().name());
108+
logger.error(errMsg);
109+
throw new CloudRuntimeException(errMsg);
110+
}
104111
DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(data.getTO()), maxTemplateSizeInBytes);
105112
dcmd.setCacheStore(cacheStore.getTO());
106113
dcmd.setProxy(getHttpProxy());

ui/src/views/infra/AddSecondaryStorage.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,10 @@ export default {
295295
const swiftParams = {
296296
account: values.account,
297297
username: values.username,
298-
key: values.key,
299-
storagepolicy: values.storagepolicy
298+
key: values.key
299+
}
300+
if (values.storagepolicy) {
301+
swiftParams.storagepolicy = values.storagepolicy
300302
}
301303
Object.keys(swiftParams).forEach((key, index) => {
302304
data['details[' + index.toString() + '].key'] = key

ui/src/views/project/AccountsTab.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,24 +157,14 @@ export default {
157157
this.fetchData()
158158
},
159159
inject: ['parentFetchData'],
160-
watch: {
161-
resource: {
162-
deep: true,
163-
handler (newItem) {
164-
if (!newItem || !newItem.id) {
165-
return
166-
}
167-
this.fetchData()
168-
}
169-
}
170-
},
171160
methods: {
172161
fetchData () {
173162
const params = {}
174163
params.projectId = this.resource.id
175164
params.page = this.page
176165
params.pageSize = this.pageSize
177166
this.updateProjectApi = this.$store.getters.apis.updateProject
167+
if (!this.resource.id) return
178168
this.fetchUsers()
179169
this.fetchProjectAccounts(params)
180170
if (this.isProjectRolesSupported()) {

ui/src/views/project/iam/ProjectRoleTab.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,6 @@ export default {
173173
mounted () {
174174
this.fetchData()
175175
},
176-
watch: {
177-
resource: {
178-
deep: true,
179-
handler (newItem) {
180-
if (!newItem || !newItem.id) {
181-
return
182-
}
183-
this.fetchData()
184-
}
185-
}
186-
},
187176
methods: {
188177
initForm () {
189178
this.formRef = ref()
@@ -192,6 +181,7 @@ export default {
192181
},
193182
fetchData () {
194183
this.loading = true
184+
if (!this.resource.id) return
195185
getAPI('listProjectRoles', { projectid: this.resource.id }).then(json => {
196186
const projectRoles = json.listprojectrolesresponse.projectrole
197187
if (!projectRoles || projectRoles.length === 0) {

0 commit comments

Comments
 (0)