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) {
|
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;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,6 @@
|
|||||||
notifempty
|
notifempty
|
||||||
maxsize 10M
|
maxsize 10M
|
||||||
postrotate
|
postrotate
|
||||||
/bin/kill -HUP `cat /var/run/rsyslog.pid 2> /dev/null` 2> /dev/null || true
|
/usr/lib/rsyslog/rsyslog-rotate
|
||||||
endscript
|
endscript
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,23 +168,24 @@ export default {
|
|||||||
if (!(state && this.displayText)) {
|
if (!(state && this.displayText)) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
let result
|
||||||
if (this.$route.path === '/vmsnapshot' || this.$route.path.includes('/vmsnapshot/')) {
|
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 result
|
||||||
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)
|
|
||||||
},
|
},
|
||||||
getStyle () {
|
getStyle () {
|
||||||
let styles = { display: 'inline-flex' }
|
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);
|
_sanity = _sanityExecutor.scheduleAtFixedRate(new SanityCheck(), 1, _sanityCheckInterval, TimeUnit.DAYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Runtime.getRuntime().addShutdownHook(new AbandonJob());
|
||||||
TransactionLegacy usageTxn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
|
TransactionLegacy usageTxn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
|
||||||
try {
|
try {
|
||||||
if (_heartbeatLock.lock(3)) { // 3 second timeout
|
if (_heartbeatLock.lock(3)) { // 3 second timeout
|
||||||
@ -354,9 +355,11 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
|||||||
if (_sanity != null) {
|
if (_sanity != null) {
|
||||||
_sanity.cancel(true);
|
_sanity.cancel(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
(new ManagedContextRunnable() {
|
(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