-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.js
executable file
·93 lines (61 loc) · 1.64 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!./6-node
'use strict';
const qemuConfig = require('./qemu/config');
// read node version
const versions = process.version.split('.');
const major = Number( versions[0].match(/\d+/)[0] );
const minor = Number( versions[1].match(/\d+/)[0] );
const patch = Number( versions[2].match(/\d+/)[0] );
if (versions.length != 3 || major < 5 || (major == 5 && minor < 11) ) {
console.warn('Minimum supported node version is v5.11.0');
process.exit();
}
console.log(`Found node version ${major}.${minor}.${patch}, OK`);
if (qemuConfig.versions.major < 2 || (qemuConfig.versions.major == 2 && qemuConfig.versions.minor < 5) ) {
console.log('Minimum supported qemu version is v2.5.0');
process.exit();
}
console.log(`Found qemu version ${qemuConfig.version}, OK`);
if (!qemuConfig.vncSupport) {
console.log('qemu has no vnc support');
process.exit();
}
console.log('Found qemu vnc, OK');
if (!qemuConfig.spiceSupport) {
console.log('qemu has no spice support');
} else {
console.log('Found qemu spice, OK');
}
const app = require('./lib/app');
app.start();
/*
read qemu images
read qemu isos
read qemu machines aka configs
-> check if all requirements are mett
start webservice
TODO:
webservice:
file management
-create vm image
-upload vm image
-weget vm image
-wget iso
-upload iso
mv management
// result is emited to all connected clients
-create
-edit
-delete (with image deletion)
-start
-pause / resume
-stop
-reboot
-(migrate)
*/
/*
TODO:
- display network i/o
- display hdd usage x of y GB
- autorestart at x o'clock
*/