mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge release branch 4.19 to main
* 4.19: protect against null-path (#8915) UI: Fix missing locale strings for Status widget (#8792) Add a shutdownhook to remove jobs owned by the process (#8896)
This commit is contained in:
commit
3cabe69cd5
@ -3070,7 +3070,10 @@ public class VmwareResource extends ServerResourceBase implements StoragePoolRes
|
||||
}
|
||||
|
||||
private String appendFileType(String path, String fileType) {
|
||||
if (path.toLowerCase().endsWith(fileType.toLowerCase())) {
|
||||
if (StringUtils.isBlank(path)) {
|
||||
throw new CloudRuntimeException("No path given, cannot append filetype " + fileType);
|
||||
}
|
||||
if (fileType == null || path.toLowerCase().endsWith(fileType.toLowerCase())) {
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,6 @@
|
||||
notifempty
|
||||
maxsize 10M
|
||||
postrotate
|
||||
/bin/kill -HUP `cat /var/run/rsyslog.pid 2> /dev/null` 2> /dev/null || true
|
||||
/usr/lib/rsyslog/rsyslog-rotate
|
||||
endscript
|
||||
}
|
||||
|
||||
@ -168,23 +168,24 @@ export default {
|
||||
if (!(state && this.displayText)) {
|
||||
return ''
|
||||
}
|
||||
let result
|
||||
if (this.$route.path === '/vmsnapshot' || this.$route.path.includes('/vmsnapshot/')) {
|
||||
return this.$t('message.vmsnapshot.state.' + state.toLowerCase())
|
||||
result = this.$t('message.vmsnapshot.state.' + state.toLowerCase())
|
||||
} else if (this.$route.path === '/vm' || this.$route.path.includes('/vm/')) {
|
||||
result = this.$t('message.vm.state.' + state.toLowerCase())
|
||||
} else if (this.$route.path === '/volume' || this.$route.path.includes('/volume/')) {
|
||||
result = this.$t('message.volume.state.' + state.toLowerCase())
|
||||
} else if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
|
||||
result = this.$t('message.guestnetwork.state.' + state.toLowerCase())
|
||||
} else if (this.$route.path === '/publicip' || this.$route.path.includes('/publicip/')) {
|
||||
result = this.$t('message.publicip.state.' + state.toLowerCase())
|
||||
}
|
||||
if (this.$route.path === '/vm' || this.$route.path.includes('/vm/')) {
|
||||
return this.$t('message.vm.state.' + state.toLowerCase())
|
||||
|
||||
if (!result || (result.startsWith('message.') && result.endsWith('.state.' + state.toLowerCase()))) {
|
||||
// Nothing for snapshots, vpcs, gateways, vnpnconn, vpnuser, kubectl, event, project, account, infra. They're all self explanatory
|
||||
result = this.$t(state)
|
||||
}
|
||||
if (this.$route.path === '/volume' || this.$route.path.includes('/volume/')) {
|
||||
return this.$t('message.volume.state.' + state.toLowerCase())
|
||||
}
|
||||
if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
|
||||
return this.$t('message.guestnetwork.state.' + state.toLowerCase())
|
||||
}
|
||||
if (this.$route.path === '/publicip' || this.$route.path.includes('/publicip/')) {
|
||||
return this.$t('message.publicip.state.' + state.toLowerCase())
|
||||
}
|
||||
// Nothing for snapshots, vpcs, gateways, vnpnconn, vpnuser, kubectl, event, project, account, infra. They're all self explanatory
|
||||
return this.$t(state)
|
||||
return result
|
||||
},
|
||||
getStyle () {
|
||||
let styles = { display: 'inline-flex' }
|
||||
|
||||
@ -325,6 +325,7 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||
_sanity = _sanityExecutor.scheduleAtFixedRate(new SanityCheck(), 1, _sanityCheckInterval, TimeUnit.DAYS);
|
||||
}
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new AbandonJob());
|
||||
TransactionLegacy usageTxn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
|
||||
try {
|
||||
if (_heartbeatLock.lock(3)) { // 3 second timeout
|
||||
@ -354,9 +355,11 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||
if (_sanity != null) {
|
||||
_sanity.cancel(true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
(new ManagedContextRunnable() {
|
||||
@ -2241,4 +2244,17 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||
}
|
||||
}
|
||||
}
|
||||
private class AbandonJob extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
s_logger.info("exitting Usage Manager");
|
||||
deleteOpenjob();
|
||||
}
|
||||
private void deleteOpenjob() {
|
||||
UsageJobVO job = _usageJobDao.isOwner(_hostname, _pid);
|
||||
if (job != null) {
|
||||
_usageJobDao.remove(job.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user