had to help this hellfest of a language along slightly

This commit is contained in:
modeco80
2024-11-02 08:06:36 -04:00
parent 9fbdb84822
commit a3581854d2

View File

@@ -33,7 +33,7 @@ export class QemuVMShim implements VM {
} }
this.vm.on('statechange', async (newState) => { this.vm.on('statechange', async (newState) => {
if(newState == VMState.Started) { if (newState == VMState.Started) {
await this.PlaceVCPUThreadsIntoCGroup(); await this.PlaceVCPUThreadsIntoCGroup();
} }
}); });
@@ -63,8 +63,16 @@ export class QemuVMShim implements VM {
} }
async PlaceVCPUThreadsIntoCGroup() { async PlaceVCPUThreadsIntoCGroup() {
let pin_vcpu_threads = false;
if (this.cg_launcher) { 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. // Get all vCPUs and pin them to the CGroup.
let cpu_res = await this.vm.QmpCommand('query-cpus-fast', {}); let cpu_res = await this.vm.QmpCommand('query-cpus-fast', {});
for (let cpu of cpu_res) { for (let cpu of cpu_res) {