From a3581854d20c5a1f0b1b79b88520f1576df556f1 Mon Sep 17 00:00:00 2001 From: modeco80 Date: Sat, 2 Nov 2024 08:06:36 -0400 Subject: [PATCH] had to help this hellfest of a language along slightly --- cvmts/src/vm/qemu.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cvmts/src/vm/qemu.ts b/cvmts/src/vm/qemu.ts index 7857e5f..a0b4b00 100644 --- a/cvmts/src/vm/qemu.ts +++ b/cvmts/src/vm/qemu.ts @@ -33,7 +33,7 @@ export class QemuVMShim implements VM { } this.vm.on('statechange', async (newState) => { - if(newState == VMState.Started) { + if (newState == VMState.Started) { await this.PlaceVCPUThreadsIntoCGroup(); } }); @@ -63,8 +63,16 @@ export class QemuVMShim implements VM { } async PlaceVCPUThreadsIntoCGroup() { + let pin_vcpu_threads = false; if (this.cg_launcher) { - if (!this.resource_limits?.limitProcess) { + // messy as all hell but oh well + if (this.resource_limits?.limitProcess == undefined) { + pin_vcpu_threads = true; + } else { + pin_vcpu_threads = !this.resource_limits?.limitProcess; + } + + if (pin_vcpu_threads) { // Get all vCPUs and pin them to the CGroup. let cpu_res = await this.vm.QmpCommand('query-cpus-fast', {}); for (let cpu of cpu_res) {