File: virt2.mcl

package info (click to toggle)
mgmt 0.0.26.git.2024.10.25.85e1d6c0e8-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,364 kB
  • sloc: sh: 2,471; yacc: 1,285; makefile: 543; python: 196; lisp: 77
file content (52 lines) | stat: -rw-r--r-- 914 bytes parent folder | download
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
# qemu-img create -b fedora-23.qcow2 -f qcow2 fedora-23-scratch.qcow2

import "fmt"
import "os"
import "golang/strings"
import "example"

$input = example.str2int(strings.trim_space(os.readfile("/tmp/cpu-count")))
$count = if $input > 8 {
	8
} else {
	if $input < 1 {
		1
	} else {
		$input
	}
}

file "/tmp/output" {
	state => $const.res.file.state.exists,
	content => fmt.printf("requesting: %d cpus\n", $count),
}

virt "mgmt4" {
	uri => "qemu:///session",
	cpus => $count,
	maxcpus => 8,
	memory => 524288,
	state => "running",
	transient => false,
	boot => ["hd", ],
	disk => [
		struct{
			source => "~/.local/share/libvirt/images/fedora-23-scratch.qcow2",
			type => "qcow2",
		},
	],
	osinit => "",
	cdrom => [
	],
	network => [
	],
	filesystem => [
	],
	auth => struct{
		username => "",
		password => "",
	},
	hotcpus => true,	# this is the default
	restartondiverge => "",
	restartonrefresh => false,
}