Skip to content

Commit 3cabe69

Browse files
committed
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)
2 parents dfd5158 + 78e07cf commit 3cabe69

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
@@ -3070,7 +3070,10 @@ protected void setVAppPropertiesToConfigSpec(VmConfigInfo vAppConfig,
30703070
}
30713071

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

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
@@ -325,6 +325,7 @@ public boolean start() {
325325
_sanity = _sanityExecutor.scheduleAtFixedRate(new SanityCheck(), 1, _sanityCheckInterval, TimeUnit.DAYS);
326326
}
327327

328+
Runtime.getRuntime().addShutdownHook(new AbandonJob());
328329
TransactionLegacy usageTxn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
329330
try {
330331
if (_heartbeatLock.lock(3)) { // 3 second timeout
@@ -354,9 +355,11 @@ public boolean stop() {
354355
if (_sanity != null) {
355356
_sanity.cancel(true);
356357
}
358+
357359
return true;
358360
}
359361

362+
360363
@Override
361364
public void run() {
362365
(new ManagedContextRunnable() {
@@ -2241,4 +2244,17 @@ protected void runInContext() {
22412244
}
22422245
}
22432246
}
2247+
private class AbandonJob extends Thread {
2248+
@Override
2249+
public void run() {
2250+
s_logger.info("exitting Usage Manager");
2251+
deleteOpenjob();
2252+
}
2253+
private void deleteOpenjob() {
2254+
UsageJobVO job = _usageJobDao.isOwner(_hostname, _pid);
2255+
if (job != null) {
2256+
_usageJobDao.remove(job.getId());
2257+
}
2258+
}
2259+
}
22442260
}

0 commit comments

Comments
 (0)