mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'apache/4.18' into 4.19
This commit is contained in:
commit
0780f0e5c6
@ -1358,36 +1358,20 @@ export default {
|
||||
}
|
||||
|
||||
this.serviceOffering = _.find(this.options.serviceOfferings, (option) => option.id === instanceConfig.computeofferingid)
|
||||
if (this.serviceOffering?.diskofferingid) {
|
||||
if (iso) {
|
||||
this.diskOffering = _.find(this.options.diskOfferings, (option) => option.id === this.serviceOffering.diskofferingid)
|
||||
} else {
|
||||
instanceConfig.overridediskofferingid = this.serviceOffering.diskofferingid
|
||||
}
|
||||
}
|
||||
if (!iso && this.diskSelected) {
|
||||
this.diskOffering = _.find(this.options.diskOfferings, (option) => option.id === instanceConfig.diskofferingid)
|
||||
}
|
||||
if (this.rootDiskSelected?.id) {
|
||||
instanceConfig.overridediskofferingid = this.rootDiskSelected.id
|
||||
}
|
||||
|
||||
instanceConfig.overridediskofferingid = this.rootDiskSelected?.id || this.serviceOffering?.diskofferingid
|
||||
if (instanceConfig.overridediskofferingid) {
|
||||
this.overrideDiskOffering = _.find(this.options.diskOfferings, (option) => option.id === instanceConfig.overridediskofferingid)
|
||||
} else {
|
||||
this.overrideDiskOffering = null
|
||||
}
|
||||
|
||||
if (!iso && this.diskSelected) {
|
||||
if (iso && this.serviceOffering?.diskofferingid) {
|
||||
this.diskOffering = _.find(this.options.diskOfferings, (option) => option.id === this.serviceOffering.diskofferingid)
|
||||
} else if (!iso && this.diskSelected) {
|
||||
this.diskOffering = _.find(this.options.diskOfferings, (option) => option.id === instanceConfig.diskofferingid)
|
||||
}
|
||||
if (this.rootDiskSelected?.id) {
|
||||
instanceConfig.overridediskofferingid = this.rootDiskSelected.id
|
||||
}
|
||||
if (instanceConfig.overridediskofferingid) {
|
||||
this.overrideDiskOffering = _.find(this.options.diskOfferings, (option) => option.id === instanceConfig.overridediskofferingid)
|
||||
} else {
|
||||
this.overrideDiskOffering = null
|
||||
}
|
||||
|
||||
this.zone = _.find(this.options.zones, (option) => option.id === instanceConfig.zoneid)
|
||||
this.affinityGroups = _.filter(this.options.affinityGroups, (option) => _.includes(instanceConfig.affinitygroupids, option.id))
|
||||
this.networks = this.getSelectedNetworksWithExistingConfig(_.filter(this.options.networks, (option) => _.includes(instanceConfig.networkids, option.id)))
|
||||
@ -1664,6 +1648,7 @@ export default {
|
||||
this.showRootDiskSizeChanger = false
|
||||
} else {
|
||||
this.rootDiskSelected = null
|
||||
this.form.overridediskofferingid = undefined
|
||||
}
|
||||
this.showOverrideDiskOfferingOption = val
|
||||
},
|
||||
@ -1905,7 +1890,6 @@ export default {
|
||||
if (this.loading.deploy) return
|
||||
this.formRef.value.validate().then(async () => {
|
||||
const values = toRaw(this.form)
|
||||
|
||||
if (!values.templateid && !values.isoid) {
|
||||
this.$notification.error({
|
||||
message: this.$t('message.request.failed'),
|
||||
@ -1994,7 +1978,7 @@ export default {
|
||||
if (this.selectedTemplateConfiguration) {
|
||||
deployVmData['details[0].configurationId'] = this.selectedTemplateConfiguration.id
|
||||
}
|
||||
if (!this.serviceOffering.diskofferingstrictness && values.overridediskofferingid) {
|
||||
if (!this.serviceOffering.diskofferingstrictness && values.overridediskofferingid && !values.isoid) {
|
||||
deployVmData.overridediskofferingid = values.overridediskofferingid
|
||||
if (values.rootdisksize && values.rootdisksize > 0) {
|
||||
deployVmData.rootdisksize = values.rootdisksize
|
||||
|
||||
@ -233,6 +233,7 @@ export default {
|
||||
this.selectedRowKeys = value
|
||||
this.$emit('select-disk-offering-item', value[0])
|
||||
this.$emit('on-selected-disk-size', this.diskSelected)
|
||||
this.$emit('on-selected-root-disk-size', this.diskSelected)
|
||||
},
|
||||
handleSearch (value) {
|
||||
this.filter = value
|
||||
|
||||
@ -16,6 +16,37 @@
|
||||
// under the License.
|
||||
package com.cloud.usage;
|
||||
|
||||
import static com.cloud.utils.NumbersUtil.toHumanReadableSize;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.persistence.EntityExistsException;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.cloudstack.quota.QuotaAlertManager;
|
||||
import org.apache.cloudstack.quota.QuotaManager;
|
||||
import org.apache.cloudstack.quota.QuotaStatement;
|
||||
import org.apache.cloudstack.usage.UsageTypes;
|
||||
import org.apache.cloudstack.utils.usage.UsageUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.UsageEventDetailsVO;
|
||||
@ -70,34 +101,6 @@ import com.cloud.utils.db.QueryBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.cloudstack.quota.QuotaAlertManager;
|
||||
import org.apache.cloudstack.quota.QuotaManager;
|
||||
import org.apache.cloudstack.quota.QuotaStatement;
|
||||
import org.apache.cloudstack.usage.UsageTypes;
|
||||
import org.apache.cloudstack.utils.usage.UsageUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import java.net.InetAddress;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.cloud.utils.NumbersUtil.toHumanReadableSize;
|
||||
|
||||
@Component
|
||||
public class UsageManagerImpl extends ManagerBase implements UsageManager, Runnable {
|
||||
@ -1033,34 +1036,38 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||
|
||||
private void createHelperRecord(UsageEventVO event) {
|
||||
String eventType = event.getType();
|
||||
if (isVMEvent(eventType)) {
|
||||
createVMHelperEvent(event);
|
||||
} else if (isIPEvent(eventType)) {
|
||||
createIPHelperEvent(event);
|
||||
} else if (isVolumeEvent(eventType)) {
|
||||
createVolumeHelperEvent(event);
|
||||
} else if (isTemplateEvent(eventType)) {
|
||||
createTemplateHelperEvent(event);
|
||||
} else if (isISOEvent(eventType)) {
|
||||
createISOHelperEvent(event);
|
||||
} else if (isSnapshotEvent(eventType)) {
|
||||
createSnapshotHelperEvent(event);
|
||||
} else if (isLoadBalancerEvent(eventType)) {
|
||||
createLoadBalancerHelperEvent(event);
|
||||
} else if (isPortForwardingEvent(eventType)) {
|
||||
createPortForwardingHelperEvent(event);
|
||||
} else if (isNetworkOfferingEvent(eventType)) {
|
||||
createNetworkOfferingEvent(event);
|
||||
} else if (isVPNUserEvent(eventType)) {
|
||||
handleVpnUserEvent(event);
|
||||
} else if (isSecurityGroupEvent(eventType)) {
|
||||
createSecurityGroupEvent(event);
|
||||
} else if (isVmSnapshotEvent(eventType)) {
|
||||
handleVMSnapshotEvent(event);
|
||||
} else if (isVmSnapshotOnPrimaryEvent(eventType)) {
|
||||
createVmSnapshotOnPrimaryEvent(event);
|
||||
} else if (isBackupEvent(eventType)) {
|
||||
createBackupEvent(event);
|
||||
try {
|
||||
if (isVMEvent(eventType)) {
|
||||
createVMHelperEvent(event);
|
||||
} else if (isIPEvent(eventType)) {
|
||||
createIPHelperEvent(event);
|
||||
} else if (isVolumeEvent(eventType)) {
|
||||
createVolumeHelperEvent(event);
|
||||
} else if (isTemplateEvent(eventType)) {
|
||||
createTemplateHelperEvent(event);
|
||||
} else if (isISOEvent(eventType)) {
|
||||
createISOHelperEvent(event);
|
||||
} else if (isSnapshotEvent(eventType)) {
|
||||
createSnapshotHelperEvent(event);
|
||||
} else if (isLoadBalancerEvent(eventType)) {
|
||||
createLoadBalancerHelperEvent(event);
|
||||
} else if (isPortForwardingEvent(eventType)) {
|
||||
createPortForwardingHelperEvent(event);
|
||||
} else if (isNetworkOfferingEvent(eventType)) {
|
||||
createNetworkOfferingEvent(event);
|
||||
} else if (isVPNUserEvent(eventType)) {
|
||||
handleVpnUserEvent(event);
|
||||
} else if (isSecurityGroupEvent(eventType)) {
|
||||
createSecurityGroupEvent(event);
|
||||
} else if (isVmSnapshotEvent(eventType)) {
|
||||
handleVMSnapshotEvent(event);
|
||||
} else if (isVmSnapshotOnPrimaryEvent(eventType)) {
|
||||
createVmSnapshotOnPrimaryEvent(event);
|
||||
} else if (isBackupEvent(eventType)) {
|
||||
createBackupEvent(event);
|
||||
}
|
||||
} catch (EntityExistsException e) {
|
||||
s_logger.warn(String.format("Failed to create usage event id: %d type: %s due to %s", event.getId(), eventType, e.getMessage()), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user