aboutsummaryrefslogtreecommitdiffstats
path: root/vm/vmm/vmm.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-09-19 11:56:08 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-09-20 14:53:44 +0200
commit845e8c5895c22aed67742893fed6553eeecda18c (patch)
tree8664459188dd7e968a0d042e26205bcefef94d04 /vm/vmm/vmm.go
parenta6a09fb2a09beadffc216bb4e1f8070226356ba1 (diff)
vm/vmm: remove cpu parameter, make template optional
CPU is not used. Remove it. Template is not strictly necessary. Make it optional.
Diffstat (limited to 'vm/vmm/vmm.go')
-rw-r--r--vm/vmm/vmm.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/vm/vmm/vmm.go b/vm/vmm/vmm.go
index 953bdcba4..4d67fc67e 100644
--- a/vm/vmm/vmm.go
+++ b/vm/vmm/vmm.go
@@ -25,7 +25,6 @@ func init() {
type Config struct {
Count int `json:"count"` // number of VMs to use
- CPU int `json:"cpu"` // number of VM CPUs
Mem int `json:"mem"` // amount of VM memory in MBs
Kernel string `json:"kernel"` // kernel to boot
Template string `json:"template"` // vm template
@@ -58,7 +57,6 @@ var ipRegex = regexp.MustCompile(`bound to (([0-9]+\.){3}3)`)
func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
cfg := &Config{
Count: 1,
- CPU: 1,
Mem: 512,
}
@@ -75,9 +73,6 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if env.Debug {
cfg.Count = 1
}
- if cfg.CPU > 1 {
- return nil, fmt.Errorf("invalid config param cpu: %v, want 1", cfg.CPU)
- }
if cfg.Mem < 128 || cfg.Mem > 1048576 {
return nil, fmt.Errorf("invalid config param mem: %v, want [128-1048576]", cfg.Mem)
}
@@ -87,9 +82,6 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if !osutil.IsExist(cfg.Kernel) {
return nil, fmt.Errorf("kernel '%v' does not exist", cfg.Kernel)
}
- if cfg.Template == "" {
- return nil, fmt.Errorf("missing config param template")
- }
pool := &Pool{
cfg: cfg,
env: env,
@@ -142,12 +134,14 @@ func (inst *instance) Boot() error {
mem := fmt.Sprintf("%vM", inst.cfg.Mem)
startArgs := []string{
"start", inst.vmName,
- "-t", inst.cfg.Template,
"-b", inst.cfg.Kernel,
"-d", inst.image,
"-m", mem,
"-L", // add a local network interface
}
+ if inst.cfg.Template != "" {
+ startArgs = append(startArgs, "-t", inst.cfg.Template)
+ }
if _, err := inst.vmctl(startArgs...); err != nil {
return err
}