make it work properly
This commit is contained in:
parent
5b939879f9
commit
86f4eee585
3 changed files with 10 additions and 5 deletions
|
@ -57,7 +57,7 @@ export class SocketComputerServer {
|
|||
async InitVM() {
|
||||
// Create the VM definition
|
||||
let diskpath = '/srv/collabvm/vms/socket1/winxp.qcow2';
|
||||
let slotDef: QemuVmDefinition = Slot_PCDef('2G', '-netdev tap,ifname=ktsocket1,script=no,downscript=no,id=vm.wan', 'rtl8139', 'c0:11:ab:69:44:02', true, diskpath, 'qcow2');
|
||||
let slotDef: QemuVmDefinition = Slot_PCDef('2G', '-netdev vde,id=vm.wan,sock=/srv/collabvm/socket_vde2_switch.ctl', 'rtl8139', 'c0:11:ab:69:44:02', true, diskpath, 'qcow2');
|
||||
|
||||
// Create the VM
|
||||
this.vm = new SocketVM(new QemuVMShim(slotDef, {
|
||||
|
|
|
@ -13,6 +13,8 @@ import pino from 'pino';
|
|||
import { JPEGEncoder } from './JPEGEncoder.js';
|
||||
import { Rect, Size, VMDisplay } from './display/types.js';
|
||||
|
||||
let sleep = (ms: number) => new Promise<void>((r, rj) => setTimeout(() => r(), ms));
|
||||
|
||||
export class SocketVM extends EventEmitter {
|
||||
private vm;
|
||||
private display: VMDisplay | null = null;
|
||||
|
@ -282,6 +284,8 @@ export class SocketVM extends EventEmitter {
|
|||
}
|
||||
|
||||
private async VMStopped() {
|
||||
// magic sleep. Makes it work.
|
||||
await sleep(50);
|
||||
await this.vm.Start();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,12 +72,13 @@ class CGroupLimitedProcess extends EventEmitter implements IProcess {
|
|||
|
||||
this.process = execaCommand(command, opts);
|
||||
|
||||
this.stdin = this.process.stdin;
|
||||
this.stdout = this.process.stdout;
|
||||
this.stderr = this.process.stderr;
|
||||
|
||||
let self = this;
|
||||
this.process.on('spawn', () => {
|
||||
// asshole
|
||||
self.stdin = self.process.stdin;
|
||||
self.stdout = self.process.stdout;
|
||||
self.stderr = self.process.stderr;
|
||||
|
||||
self.initCgroup();
|
||||
|
||||
if(self.limits.limitProcess) {
|
||||
|
|
Loading…
Reference in a new issue