Skip to content

Commit

Permalink
pkg/instance: support injected boot for vmm
Browse files Browse the repository at this point in the history
If pkg/build produces a kernel, inject it into vmm config too.
This will allow continuous build with vmm VM type.

Update #712
  • Loading branch information
dvyukov committed Sep 11, 2018
1 parent ff2962a commit 4ae17b1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/instance/instance.go
Expand Up @@ -93,7 +93,7 @@ func SetConfigImage(cfg *mgrconfig.Config, imageDir string) error {
if keyFile := filepath.Join(imageDir, "key"); osutil.IsExist(keyFile) {
cfg.SSHKey = keyFile
}
if cfg.Type == "qemu" {
if cfg.Type == "qemu" || cfg.Type == "vmm" {
kernel := filepath.Join(imageDir, "kernel")
if !osutil.IsExist(kernel) {
kernel = ""
Expand All @@ -103,19 +103,19 @@ func SetConfigImage(cfg *mgrconfig.Config, imageDir string) error {
initrd = ""
}
if kernel != "" || initrd != "" {
qemu := make(map[string]interface{})
if err := json.Unmarshal(cfg.VM, &qemu); err != nil {
return fmt.Errorf("failed to parse qemu config: %v", err)
vmConfig := make(map[string]interface{})
if err := json.Unmarshal(cfg.VM, &vmConfig); err != nil {
return fmt.Errorf("failed to parse VM config: %v", err)
}
if kernel != "" {
qemu["kernel"] = kernel
vmConfig["kernel"] = kernel
}
if initrd != "" {
qemu["initrd"] = initrd
vmConfig["initrd"] = initrd
}
vmCfg, err := json.Marshal(qemu)
vmCfg, err := json.Marshal(vmConfig)
if err != nil {
return fmt.Errorf("failed to serialize qemu config: %v", err)
return fmt.Errorf("failed to serialize VM config: %v", err)
}
cfg.VM = vmCfg
}
Expand Down

0 comments on commit 4ae17b1

Please sign in to comment.