Skip to content

Commit

Permalink
lxc/init: Add error handling for launching container when image is of…
Browse files Browse the repository at this point in the history
… type VM

Signed-off-by: Kadin Sayani <[email protected]>
  • Loading branch information
kadinsayani committed Sep 19, 2024
1 parent 2704b3e commit b222930
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lxc/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ func (c *cmdInit) create(conf *config.Config, args []string, launch bool) (lxd.I
return nil, "", errors.New(i18n.G("Asked for a VM but image is of type container"))
}

if imgInfo.Type != "container" && !c.flagVM {
return nil, "", errors.New(i18n.G("Asked for a container but image is of type VM"))
}

req.Type = api.InstanceType(imgInfo.Type)
}

Expand Down

0 comments on commit b222930

Please sign in to comment.