-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.js
More file actions
61 lines (43 loc) 路 1.47 KB
/
Copy pathclient.js
File metadata and controls
61 lines (43 loc) 路 1.47 KB
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
const path = require('path');
const virtcrud = require('./index');
async function vbox() {
let vbox = await virtcrud.getProvider('vbox');
if( !await vbox.requirements() )
{
return;
}
vbox.privateKey = 'C:/Users/chris/.baker/baker_rsa';
await vbox.create('test-ovf',
{
ovf: require('path').join(require('os').homedir(), '.bakerx','.persist','images','bionic', 'box.ovf'),
bridged: true
});
}
async function hyperv() {
let hyperv = await virtcrud.getProvider('hyperv');
// Add user to Hyper-V admin
// await hyperv.setup();
// Prepare basic dir structure
const fs = require('fs-extra');
let workingDir = path.join(require('os').homedir(), ".virtcrud");
if( !fs.existsSync( workingDir ) ) { fs.mkdirSync(workingDir) }
fs.emptyDirSync( workingDir );
// Copy base image into vm dir
let baseImage = path.join( require('os').homedir(),
".slim/registry/ubuntu-20.04-ci-hyperv/rootfs.vhd");
let vmImage = path.join( workingDir, "rootfs.vhd");
fs.copyFileSync( baseImage, vmImage );
// cloudinit iso
let iso = path.join( require('os').homedir(),
".slim/registry/ubuntu-20.04-ci-hyperv/cidata.iso");
// await hyperv.stop("VX");
// await hyperv.delete("VX");
await hyperv.create("VX", {disk: vmImage, iso: iso});
}
async function vf() {
let vf = await virtcrud.getProvider('vf');
await vf.create( "hello");
}
(async () => {
await vf();
})();