Commit 3bbe33c9 authored by Rémi Duraffort's avatar Rémi Duraffort
Browse files

schema: allow to use deploy overlays



Signed-off-by: default avatarRémi Duraffort <remi.duraffort@linaro.org>
parent 4c5246a2
......@@ -25,8 +25,11 @@ from voluptuous import Any, Optional, Required
from lava_common.schemas import action
def url():
return {
def url(extra=None):
if extra is None:
extra = {}
base_url = {
Required("url"): str,
Optional("compression"): Any("bz2", "gz", "xz", "zip", None),
Optional("archive"): "tar",
......@@ -34,6 +37,17 @@ def url():
Optional("sha256sum"): str,
Optional("sha512sum"): str,
}
return Any(
{**base_url, **extra},
{
**base_url,
**extra,
Required("format"): Any("cpio.newc", "ext4"),
Required("overlays"): {
str: {**base_url, Required("format"): Any("tar"), Required("path"): str}
},
},
)
def schema():
......
......@@ -28,6 +28,6 @@ from lava_common.schemas import deploy
def schema():
base = {
Required("to"): "download",
Required("images"): {Required(str, "'images' is empty"): {**deploy.url()}},
Required("images"): {Required(str, "'images' is empty"): deploy.url()},
}
return {**deploy.schema(), **base}
......@@ -26,18 +26,17 @@ from lava_common.schemas import deploy
def schema():
extra = {
Optional("apply-overlay"): bool,
Optional("sparse"): bool,
Optional("reboot"): Any(
"hard-reset", "fastboot-reboot", "fastboot-reboot-bootloader"
),
}
base = {
Required("to"): "fastboot",
Required("images"): {
Required(str, "'images' is empty"): {
**deploy.url(),
Optional("apply-overlay"): bool,
Optional("sparse"): bool,
Optional("reboot"): Any(
"hard-reset", "fastboot-reboot", "fastboot-reboot-bootloader"
),
}
},
Required("images"): {Required(str, "'images' is empty"): deploy.url(extra)},
Optional("docker"): {Required("image"): str},
Optional("connection"): "lxc", # FIXME: other possible values?
}
......
......@@ -29,10 +29,9 @@ def schema():
base = {
Required("to"): "iso-installer",
Required("images"): {
Required("iso"): {
**deploy.url(),
Optional("image_arg"): str, # TODO: is this optional?
},
Required("iso"): deploy.url(
{Optional("image_arg"): str} # TODO: is this optional?
),
Required("preseed"): deploy.url(),
},
Required("iso"): {
......
......@@ -31,10 +31,9 @@ def schema():
Required("images"): All(
{
Optional("recovery_image"): deploy.url(),
Optional(Match("test_binary(_\\w+)?$")): {
**deploy.url(),
Optional("rename"): str,
},
Optional(Match("test_binary(_\\w+)?$")): deploy.url(
{Optional("rename"): str}
),
},
Length(min=1),
),
......
......@@ -30,10 +30,9 @@ def schema():
base = {
Required("to"): "nbd",
Required("kernel", msg="needs a kernel to deploy"): {
**resource,
Optional("type"): Any("image", "uimage", "zimage"),
},
Required("kernel", msg="needs a kernel to deploy"): deploy.url(
{Optional("type"): Any("image", "uimage", "zimage")}
),
Required("nbdroot"): resource,
Required("initrd"): resource,
Optional("dtb"): resource,
......
......@@ -36,7 +36,9 @@ def schema():
{
Required("to"): "nfs",
Required("images"): {
Required(str, "'images' is empty"): {**deploy.url(), "image_arg": str}
Required(str, "'images' is empty"): deploy.url(
{Optional("image_arg"): str}
)
},
**deploy.schema(),
},
......
......@@ -28,6 +28,6 @@ from lava_common.schemas import deploy
def schema():
base = {
Required("to"): "recovery",
Required("images"): {Required(str, "'images' is empty"): {**deploy.url()}},
Required("images"): {Required(str, "'images' is empty"): deploy.url()},
}
return {**deploy.schema(), **base}
......@@ -27,23 +27,29 @@ from lava_common.schemas import deploy
def schema():
resource = deploy.url()
resource_ext = {
**resource,
Optional("install_modules"): bool,
Optional("install_overlay"): bool,
}
base = {
Required("to"): "tftp",
Required("kernel", msg="needs a kernel to deploy"): {
**resource,
Optional("type"): Any("image", "uimage", "zimage"),
},
Required("kernel", msg="needs a kernel to deploy"): deploy.url(
{Optional("type"): Any("image", "uimage", "zimage")}
),
Optional("dtb"): resource,
Optional("modules"): resource,
Optional("preseed"): resource,
Optional("ramdisk"): {**resource_ext, Optional("header"): "u-boot"},
Exclusive("nfsrootfs", "nfs"): {**resource_ext, Optional("prefix"): str},
Optional("ramdisk"): deploy.url(
{
Optional("install_modules"): bool,
Optional("install_overlay"): bool,
Optional("header"): "u-boot",
}
),
Exclusive("nfsrootfs", "nfs"): deploy.url(
{
Optional("install_modules"): bool,
Optional("install_overlay"): bool,
Optional("prefix"): str,
}
),
Exclusive("persistent_nfs", "nfs"): {
Required("address"): str,
Optional("install_overlay"): bool,
......
......@@ -26,15 +26,14 @@ from lava_common.schemas import deploy
def schema():
extra = {
Optional("format"): "qcow2",
Optional("image_arg"): str, # TODO: is this optional?
}
base = {
Required("to"): "tmpfs",
Required("images"): {
Required(str, "'images' is empty"): {
**deploy.url(),
Optional("format"): "qcow2",
Optional("image_arg"): str, # TODO: is this optional?
}
},
Required("images"): {Required(str, "'images' is empty"): deploy.url(extra)},
Optional("type"): "monitor",
Optional("uefi"): deploy.url(), # TODO: check the exact syntax
}
......
......@@ -28,6 +28,6 @@ from lava_common.schemas import deploy
def schema():
base = {
Required("to"): "u-boot-ums",
Required("image"): {**deploy.url(), Optional("root_partition"): Range(min=0)},
Required("image"): deploy.url({Optional("root_partition"): Range(min=0)}),
}
return {**deploy.schema(), **base}
......@@ -31,11 +31,12 @@ def schema():
Required("images"): All(
{
Required("boot"): deploy.url(),
Any(str): {
**deploy.url(),
Optional("apply-overlay"): bool,
Optional("root_partition"): Range(min=0),
},
Any(str): deploy.url(
{
Optional("apply-overlay"): bool,
Optional("root_partition"): Range(min=0),
}
),
},
Length(min=1),
),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment