cvmts: Delete cgroup on VM stop
Makes clean shutdown with systemd actually work. I've also made superqemu version a SemVer thing so that we don't need to bump it as often, only on a major or minor bump.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Cgroup management code
|
||||
// this sucks, ill mess with it later
|
||||
|
||||
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { appendFileSync, existsSync, mkdirSync, readFileSync, rmdirSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
export class CGroupController {
|
||||
@@ -46,6 +46,16 @@ export class CGroup {
|
||||
return false;
|
||||
}
|
||||
|
||||
DeleteSubgroup(name: string): void {
|
||||
let subgroup_root = path.join(this.path, name);
|
||||
if (!this.HasSubgroup(name)) {
|
||||
throw new Error(`Subgroup ${name} does not exist`);
|
||||
}
|
||||
|
||||
//console.log("Deleting subgroup", name);
|
||||
rmdirSync(subgroup_root);
|
||||
}
|
||||
|
||||
// Gets a CGroup inside of this cgroup.
|
||||
GetSubgroup(name: string): CGroup {
|
||||
// make the subgroup if it doesn't already exist
|
||||
|
||||
Reference in New Issue
Block a user