mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-18 09:23:10 +00:00
Merge pull request #588 from nitkon/master
cli: Error out if initrd/rootfs not define in config file
This commit is contained in:
commit
22aedc4fb6
@ -327,6 +327,11 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
errors.New("having both an image and an initrd defined in the configuration file is not supported")
|
errors.New("having both an image and an initrd defined in the configuration file is not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if image == "" && initrd == "" {
|
||||||
|
return vc.HypervisorConfig{},
|
||||||
|
errors.New("either image or initrd must be defined in the configuration file")
|
||||||
|
}
|
||||||
|
|
||||||
firmware, err := h.firmware()
|
firmware, err := h.firmware()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return vc.HypervisorConfig{}, err
|
return vc.HypervisorConfig{}, err
|
||||||
|
@ -636,7 +636,7 @@ func TestMinimalRuntimeConfigWithVsock(t *testing.T) {
|
|||||||
defaultHypervisorPath = hypervisorPath
|
defaultHypervisorPath = hypervisorPath
|
||||||
defaultKernelPath = kernelPath
|
defaultKernelPath = kernelPath
|
||||||
|
|
||||||
for _, file := range []string{proxyPath, shimPath, hypervisorPath, kernelPath} {
|
for _, file := range []string{proxyPath, shimPath, hypervisorPath, kernelPath, imagePath} {
|
||||||
err = writeFile(file, "foo", testFileMode)
|
err = writeFile(file, "foo", testFileMode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -648,6 +648,7 @@ func TestMinimalRuntimeConfigWithVsock(t *testing.T) {
|
|||||||
# Runtime configuration file
|
# Runtime configuration file
|
||||||
[hypervisor.qemu]
|
[hypervisor.qemu]
|
||||||
use_vsock = true
|
use_vsock = true
|
||||||
|
image = "` + imagePath + `"
|
||||||
|
|
||||||
[proxy.kata]
|
[proxy.kata]
|
||||||
path = "` + proxyPath + `"
|
path = "` + proxyPath + `"
|
||||||
|
Loading…
Reference in New Issue
Block a user