Merge branch '4.20'

This commit is contained in:
Suresh Kumar Anaparti 2025-08-04 16:44:40 +05:30
commit ca8ce8c885
No known key found for this signature in database
GPG Key ID: D7CEAE3A9E71D0AA
7 changed files with 29 additions and 29 deletions

View File

@ -72,7 +72,7 @@ public class ListProjectRolesCmd extends BaseListCmd {
@Override @Override
public void execute() { public void execute() {
List<ProjectRole> projectRoles; List<ProjectRole> projectRoles = new ArrayList<>();
if (getProjectId() != null && getProjectRoleId() != null) { if (getProjectId() != null && getProjectRoleId() != null) {
projectRoles = Collections.singletonList(projRoleService.findProjectRole(getProjectRoleId(), getProjectId())); projectRoles = Collections.singletonList(projRoleService.findProjectRole(getProjectRoleId(), getProjectId()));
} else if (StringUtils.isNotBlank(getRoleName())) { } else if (StringUtils.isNotBlank(getRoleName())) {

View File

@ -644,7 +644,7 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
metricsResponse.setStorageUsedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageThreshold); metricsResponse.setStorageUsedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageThreshold);
metricsResponse.setStorageUsedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageDisableThreshold); metricsResponse.setStorageUsedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
metricsResponse.setStorageAllocatedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeAllocated(), poolResponse.getOverProvisionFactor(), storageThreshold); metricsResponse.setStorageAllocatedThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeAllocated(), poolResponse.getOverProvisionFactor(), storageThreshold);
metricsResponse.setStorageAllocatedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeUsed(), poolResponse.getOverProvisionFactor(), storageDisableThreshold); metricsResponse.setStorageAllocatedDisableThreshold(poolResponse.getDiskSizeTotal(), poolResponse.getDiskSizeAllocated(), poolResponse.getOverProvisionFactor(), storageDisableThreshold);
metricsResponses.add(metricsResponse); metricsResponses.add(metricsResponse);
} }
return metricsResponses; return metricsResponses;

View File

@ -48,6 +48,10 @@ public class EventUtils {
private static EventDistributor eventDistributor; private static EventDistributor eventDistributor;
private static final String MODULE_TOP_LEVEL_PACKAGE =
EventUtils.class.getPackage().getName().substring(0,
EventUtils.class.getPackage().getName().lastIndexOf('.'));
public EventUtils() { public EventUtils() {
} }
@ -143,6 +147,13 @@ public class EventUtils {
@Override @Override
public void interceptComplete(Method method, Object target, Object event) { public void interceptComplete(Method method, Object target, Object event) {
ActionEvent actionEvent = method.getAnnotation(ActionEvent.class); ActionEvent actionEvent = method.getAnnotation(ActionEvent.class);
boolean sameModule = false;
if (target != null && target.getClass().getPackage() != null) {
sameModule = target.getClass().getPackage().getName().startsWith(MODULE_TOP_LEVEL_PACKAGE);
}
if (!sameModule) {
return;
}
if (actionEvent != null) { if (actionEvent != null) {
CallContext ctx = CallContext.current(); CallContext ctx = CallContext.current();
if (!actionEvent.create()) { if (!actionEvent.create()) {

View File

@ -26,7 +26,6 @@ import javax.inject.Inject;
import com.cloud.configuration.Config; import com.cloud.configuration.Config;
import com.cloud.utils.SwiftUtil; import com.cloud.utils.SwiftUtil;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
@ -37,18 +36,21 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager; import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager;
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.storage.command.DownloadCommand; import org.apache.cloudstack.storage.command.DownloadCommand;
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao; import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl; import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
import org.apache.cloudstack.storage.image.store.ImageStoreImpl; import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
import org.apache.cloudstack.storage.to.TemplateObjectTO; import org.apache.cloudstack.storage.to.TemplateObjectTO;
import org.apache.log4j.Logger;
import com.cloud.agent.api.storage.DownloadAnswer; import com.cloud.agent.api.storage.DownloadAnswer;
import com.cloud.agent.api.to.DataObjectType; import com.cloud.agent.api.to.DataObjectType;
import com.cloud.agent.api.to.DataStoreTO; import com.cloud.agent.api.to.DataStoreTO;
import com.cloud.agent.api.to.SwiftTO; import com.cloud.agent.api.to.SwiftTO;
import com.cloud.configuration.Config;
import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.ImageFormat;
import com.cloud.template.VirtualMachineTemplate; import com.cloud.utils.SwiftUtil;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
public class SwiftImageStoreDriverImpl extends BaseImageStoreDriverImpl { public class SwiftImageStoreDriverImpl extends BaseImageStoreDriverImpl {
@ -99,8 +101,13 @@ public class SwiftImageStoreDriverImpl extends BaseImageStoreDriverImpl {
@Override @Override
public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) { public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes(); Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
VirtualMachineTemplate tmpl = _templateDao.findById(data.getId());
DataStore cacheStore = cacheManager.getCacheStorage(dataStore.getScope()); DataStore cacheStore = cacheManager.getCacheStorage(dataStore.getScope());
if (cacheStore == null) {
String errMsg = String.format("No cache store found for scope: %s",
dataStore.getScope().getScopeType().name());
logger.error(errMsg);
throw new CloudRuntimeException(errMsg);
}
DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(data.getTO()), maxTemplateSizeInBytes); DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(data.getTO()), maxTemplateSizeInBytes);
dcmd.setCacheStore(cacheStore.getTO()); dcmd.setCacheStore(cacheStore.getTO());
dcmd.setProxy(getHttpProxy()); dcmd.setProxy(getHttpProxy());

View File

@ -295,8 +295,10 @@ export default {
const swiftParams = { const swiftParams = {
account: values.account, account: values.account,
username: values.username, username: values.username,
key: values.key, key: values.key
storagepolicy: values.storagepolicy }
if (values.storagepolicy) {
swiftParams.storagepolicy = values.storagepolicy
} }
Object.keys(swiftParams).forEach((key, index) => { Object.keys(swiftParams).forEach((key, index) => {
data['details[' + index.toString() + '].key'] = key data['details[' + index.toString() + '].key'] = key

View File

@ -157,17 +157,6 @@ export default {
this.fetchData() this.fetchData()
}, },
inject: ['parentFetchData'], inject: ['parentFetchData'],
watch: {
resource: {
deep: true,
handler (newItem) {
if (!newItem || !newItem.id) {
return
}
this.fetchData()
}
}
},
methods: { methods: {
fetchData () { fetchData () {
const params = {} const params = {}
@ -175,6 +164,7 @@ export default {
params.page = this.page params.page = this.page
params.pageSize = this.pageSize params.pageSize = this.pageSize
this.updateProjectApi = this.$store.getters.apis.updateProject this.updateProjectApi = this.$store.getters.apis.updateProject
if (!this.resource.id) return
this.fetchUsers() this.fetchUsers()
this.fetchProjectAccounts(params) this.fetchProjectAccounts(params)
if (this.isProjectRolesSupported()) { if (this.isProjectRolesSupported()) {

View File

@ -173,17 +173,6 @@ export default {
mounted () { mounted () {
this.fetchData() this.fetchData()
}, },
watch: {
resource: {
deep: true,
handler (newItem) {
if (!newItem || !newItem.id) {
return
}
this.fetchData()
}
}
},
methods: { methods: {
initForm () { initForm () {
this.formRef = ref() this.formRef = ref()
@ -192,6 +181,7 @@ export default {
}, },
fetchData () { fetchData () {
this.loading = true this.loading = true
if (!this.resource.id) return
getAPI('listProjectRoles', { projectid: this.resource.id }).then(json => { getAPI('listProjectRoles', { projectid: this.resource.id }).then(json => {
const projectRoles = json.listprojectrolesresponse.projectrole const projectRoles = json.listprojectrolesresponse.projectrole
if (!projectRoles || projectRoles.length === 0) { if (!projectRoles || projectRoles.length === 0) {