mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'apache/4.19'
This commit is contained in:
commit
bb244842fa
@ -1358,36 +1358,20 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.serviceOffering = _.find(this.options.serviceOfferings, (option) => option.id === instanceConfig.computeofferingid)
|
this.serviceOffering = _.find(this.options.serviceOfferings, (option) => option.id === instanceConfig.computeofferingid)
|
||||||
if (this.serviceOffering?.diskofferingid) {
|
|
||||||
if (iso) {
|
instanceConfig.overridediskofferingid = this.rootDiskSelected?.id || this.serviceOffering?.diskofferingid
|
||||||
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
|
|
||||||
}
|
|
||||||
if (instanceConfig.overridediskofferingid) {
|
if (instanceConfig.overridediskofferingid) {
|
||||||
this.overrideDiskOffering = _.find(this.options.diskOfferings, (option) => option.id === instanceConfig.overridediskofferingid)
|
this.overrideDiskOffering = _.find(this.options.diskOfferings, (option) => option.id === instanceConfig.overridediskofferingid)
|
||||||
} else {
|
} else {
|
||||||
this.overrideDiskOffering = null
|
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)
|
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.zone = _.find(this.options.zones, (option) => option.id === instanceConfig.zoneid)
|
||||||
this.affinityGroups = _.filter(this.options.affinityGroups, (option) => _.includes(instanceConfig.affinitygroupids, option.id))
|
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)))
|
this.networks = this.getSelectedNetworksWithExistingConfig(_.filter(this.options.networks, (option) => _.includes(instanceConfig.networkids, option.id)))
|
||||||
@ -1664,6 +1648,7 @@ export default {
|
|||||||
this.showRootDiskSizeChanger = false
|
this.showRootDiskSizeChanger = false
|
||||||
} else {
|
} else {
|
||||||
this.rootDiskSelected = null
|
this.rootDiskSelected = null
|
||||||
|
this.form.overridediskofferingid = undefined
|
||||||
}
|
}
|
||||||
this.showOverrideDiskOfferingOption = val
|
this.showOverrideDiskOfferingOption = val
|
||||||
},
|
},
|
||||||
@ -1905,7 +1890,6 @@ export default {
|
|||||||
if (this.loading.deploy) return
|
if (this.loading.deploy) return
|
||||||
this.formRef.value.validate().then(async () => {
|
this.formRef.value.validate().then(async () => {
|
||||||
const values = toRaw(this.form)
|
const values = toRaw(this.form)
|
||||||
|
|
||||||
if (!values.templateid && !values.isoid) {
|
if (!values.templateid && !values.isoid) {
|
||||||
this.$notification.error({
|
this.$notification.error({
|
||||||
message: this.$t('message.request.failed'),
|
message: this.$t('message.request.failed'),
|
||||||
@ -1994,7 +1978,7 @@ export default {
|
|||||||
if (this.selectedTemplateConfiguration) {
|
if (this.selectedTemplateConfiguration) {
|
||||||
deployVmData['details[0].configurationId'] = this.selectedTemplateConfiguration.id
|
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
|
deployVmData.overridediskofferingid = values.overridediskofferingid
|
||||||
if (values.rootdisksize && values.rootdisksize > 0) {
|
if (values.rootdisksize && values.rootdisksize > 0) {
|
||||||
deployVmData.rootdisksize = values.rootdisksize
|
deployVmData.rootdisksize = values.rootdisksize
|
||||||
|
|||||||
@ -233,6 +233,7 @@ export default {
|
|||||||
this.selectedRowKeys = value
|
this.selectedRowKeys = value
|
||||||
this.$emit('select-disk-offering-item', value[0])
|
this.$emit('select-disk-offering-item', value[0])
|
||||||
this.$emit('on-selected-disk-size', this.diskSelected)
|
this.$emit('on-selected-disk-size', this.diskSelected)
|
||||||
|
this.$emit('on-selected-root-disk-size', this.diskSelected)
|
||||||
},
|
},
|
||||||
handleSearch (value) {
|
handleSearch (value) {
|
||||||
this.filter = value
|
this.filter = value
|
||||||
|
|||||||
@ -16,6 +16,36 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.usage;
|
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.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.cloud.alert.AlertManager;
|
import com.cloud.alert.AlertManager;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.event.UsageEventDetailsVO;
|
import com.cloud.event.UsageEventDetailsVO;
|
||||||
@ -71,33 +101,6 @@ import com.cloud.utils.db.QueryBuilder;
|
|||||||
import com.cloud.utils.db.SearchCriteria;
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
import com.cloud.utils.db.TransactionLegacy;
|
import com.cloud.utils.db.TransactionLegacy;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
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.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
|
@Component
|
||||||
public class UsageManagerImpl extends ManagerBase implements UsageManager, Runnable {
|
public class UsageManagerImpl extends ManagerBase implements UsageManager, Runnable {
|
||||||
@ -1036,34 +1039,38 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
|||||||
|
|
||||||
private void createHelperRecord(UsageEventVO event) {
|
private void createHelperRecord(UsageEventVO event) {
|
||||||
String eventType = event.getType();
|
String eventType = event.getType();
|
||||||
if (isVMEvent(eventType)) {
|
try {
|
||||||
createVMHelperEvent(event);
|
if (isVMEvent(eventType)) {
|
||||||
} else if (isIPEvent(eventType)) {
|
createVMHelperEvent(event);
|
||||||
createIPHelperEvent(event);
|
} else if (isIPEvent(eventType)) {
|
||||||
} else if (isVolumeEvent(eventType)) {
|
createIPHelperEvent(event);
|
||||||
createVolumeHelperEvent(event);
|
} else if (isVolumeEvent(eventType)) {
|
||||||
} else if (isTemplateEvent(eventType)) {
|
createVolumeHelperEvent(event);
|
||||||
createTemplateHelperEvent(event);
|
} else if (isTemplateEvent(eventType)) {
|
||||||
} else if (isISOEvent(eventType)) {
|
createTemplateHelperEvent(event);
|
||||||
createISOHelperEvent(event);
|
} else if (isISOEvent(eventType)) {
|
||||||
} else if (isSnapshotEvent(eventType)) {
|
createISOHelperEvent(event);
|
||||||
createSnapshotHelperEvent(event);
|
} else if (isSnapshotEvent(eventType)) {
|
||||||
} else if (isLoadBalancerEvent(eventType)) {
|
createSnapshotHelperEvent(event);
|
||||||
createLoadBalancerHelperEvent(event);
|
} else if (isLoadBalancerEvent(eventType)) {
|
||||||
} else if (isPortForwardingEvent(eventType)) {
|
createLoadBalancerHelperEvent(event);
|
||||||
createPortForwardingHelperEvent(event);
|
} else if (isPortForwardingEvent(eventType)) {
|
||||||
} else if (isNetworkOfferingEvent(eventType)) {
|
createPortForwardingHelperEvent(event);
|
||||||
createNetworkOfferingEvent(event);
|
} else if (isNetworkOfferingEvent(eventType)) {
|
||||||
} else if (isVPNUserEvent(eventType)) {
|
createNetworkOfferingEvent(event);
|
||||||
handleVpnUserEvent(event);
|
} else if (isVPNUserEvent(eventType)) {
|
||||||
} else if (isSecurityGroupEvent(eventType)) {
|
handleVpnUserEvent(event);
|
||||||
createSecurityGroupEvent(event);
|
} else if (isSecurityGroupEvent(eventType)) {
|
||||||
} else if (isVmSnapshotEvent(eventType)) {
|
createSecurityGroupEvent(event);
|
||||||
handleVMSnapshotEvent(event);
|
} else if (isVmSnapshotEvent(eventType)) {
|
||||||
} else if (isVmSnapshotOnPrimaryEvent(eventType)) {
|
handleVMSnapshotEvent(event);
|
||||||
createVmSnapshotOnPrimaryEvent(event);
|
} else if (isVmSnapshotOnPrimaryEvent(eventType)) {
|
||||||
} else if (isBackupEvent(eventType)) {
|
createVmSnapshotOnPrimaryEvent(event);
|
||||||
createBackupEvent(event);
|
} else if (isBackupEvent(eventType)) {
|
||||||
|
createBackupEvent(event);
|
||||||
|
}
|
||||||
|
} catch (EntityExistsException e) {
|
||||||
|
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