Skip to content

Commit 78e07cf

Browse files
committed
Merge release branch 4.18 to 4.19
* 4.18: 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)
2 parents cadbb56 + 7affbb1 commit 78e07cf

File tree

4 files changed

+36
-16
lines changed

4 files changed

+36
-16
lines changed

plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3071,7 +3071,10 @@ protected void setVAppPropertiesToConfigSpec(VmConfigInfo vAppConfig,
30713071
}
30723072

30733073
private String appendFileType(String path, String fileType) {
3074-
if (path.toLowerCase().endsWith(fileType.toLowerCase())) {
3074+
if (StringUtils.isBlank(path)) {
3075+
throw new CloudRuntimeException("No path given, cannot append filetype " + fileType);
3076+
}
3077+
if (fileType == null || path.toLowerCase().endsWith(fileType.toLowerCase())) {
30753078
return path;
30763079
}
30773080

systemvm/debian/etc/logrotate.d/haproxy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
notifempty
55
maxsize 10M
66
postrotate
7-
/bin/kill -HUP `cat /var/run/rsyslog.pid 2> /dev/null` 2> /dev/null || true
7+
/usr/lib/rsyslog/rsyslog-rotate
88
endscript
99
}

ui/src/components/widgets/Status.vue

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,24 @@ export default {
168168
if (!(state && this.displayText)) {
169169
return ''
170170
}
171+
let result
171172
if (this.$route.path === '/vmsnapshot' || this.$route.path.includes('/vmsnapshot/')) {
172-
return this.$t('message.vmsnapshot.state.' + state.toLowerCase())
173+
result = this.$t('message.vmsnapshot.state.' + state.toLowerCase())
174+
} else if (this.$route.path === '/vm' || this.$route.path.includes('/vm/')) {
175+
result = this.$t('message.vm.state.' + state.toLowerCase())
176+
} else if (this.$route.path === '/volume' || this.$route.path.includes('/volume/')) {
177+
result = this.$t('message.volume.state.' + state.toLowerCase())
178+
} else if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
179+
result = this.$t('message.guestnetwork.state.' + state.toLowerCase())
180+
} else if (this.$route.path === '/publicip' || this.$route.path.includes('/publicip/')) {
181+
result = this.$t('message.publicip.state.' + state.toLowerCase())
173182
}
174-
if (this.$route.path === '/vm' || this.$route.path.includes('/vm/')) {
175-
return this.$t('message.vm.state.' + state.toLowerCase())
176-
}
177-
if (this.$route.path === '/volume' || this.$route.path.includes('/volume/')) {
178-
return this.$t('message.volume.state.' + state.toLowerCase())
179-
}
180-
if (this.$route.path === '/guestnetwork' || this.$route.path.includes('/guestnetwork/')) {
181-
return this.$t('message.guestnetwork.state.' + state.toLowerCase())
182-
}
183-
if (this.$route.path === '/publicip' || this.$route.path.includes('/publicip/')) {
184-
return this.$t('message.publicip.state.' + state.toLowerCase())
183+
184+
if (!result || (result.startsWith('message.') && result.endsWith('.state.' + state.toLowerCase()))) {
185+
// Nothing for snapshots, vpcs, gateways, vnpnconn, vpnuser, kubectl, event, project, account, infra. They're all self explanatory
186+
result = this.$t(state)
185187
}
186-
// Nothing for snapshots, vpcs, gateways, vnpnconn, vpnuser, kubectl, event, project, account, infra. They're all self explanatory
187-
return this.$t(state)
188+
return result
188189
},
189190
getStyle () {
190191
let styles = { display: 'inline-flex' }

usage/src/main/java/com/cloud/usage/UsageManagerImpl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ public boolean start() {
321321
_sanity = _sanityExecutor.scheduleAtFixedRate(new SanityCheck(), 1, _sanityCheckInterval, TimeUnit.DAYS);
322322
}
323323

324+
Runtime.getRuntime().addShutdownHook(new AbandonJob());
324325
TransactionLegacy usageTxn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
325326
try {
326327
if (_heartbeatLock.lock(3)) { // 3 second timeout
@@ -350,9 +351,11 @@ public boolean stop() {
350351
if (_sanity != null) {
351352
_sanity.cancel(true);
352353
}
354+
353355
return true;
354356
}
355357

358+
356359
@Override
357360
public void run() {
358361
(new ManagedContextRunnable() {
@@ -2235,4 +2238,17 @@ protected void runInContext() {
22352238
}
22362239
}
22372240
}
2241+
private class AbandonJob extends Thread {
2242+
@Override
2243+
public void run() {
2244+
s_logger.info("exitting Usage Manager");
2245+
deleteOpenjob();
2246+
}
2247+
private void deleteOpenjob() {
2248+
UsageJobVO job = _usageJobDao.isOwner(_hostname, _pid);
2249+
if (job != null) {
2250+
_usageJobDao.remove(job.getId());
2251+
}
2252+
}
2253+
}
22382254
}

0 commit comments

Comments
 (0)