diff --git a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java index 3a551fce7eb..b503610eb3c 100644 --- a/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -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; } diff --git a/systemvm/debian/etc/logrotate.d/haproxy b/systemvm/debian/etc/logrotate.d/haproxy index 464209791a3..a6b72b6f77a 100644 --- a/systemvm/debian/etc/logrotate.d/haproxy +++ b/systemvm/debian/etc/logrotate.d/haproxy @@ -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 } diff --git a/ui/src/components/widgets/Status.vue b/ui/src/components/widgets/Status.vue index 6575d409a3c..22b7849aa61 100644 --- a/ui/src/components/widgets/Status.vue +++ b/ui/src/components/widgets/Status.vue @@ -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' } diff --git a/usage/src/main/java/com/cloud/usage/UsageManagerImpl.java b/usage/src/main/java/com/cloud/usage/UsageManagerImpl.java index 554009d95c5..b036bc3c520 100644 --- a/usage/src/main/java/com/cloud/usage/UsageManagerImpl.java +++ b/usage/src/main/java/com/cloud/usage/UsageManagerImpl.java @@ -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()); + } + } + } }