From 8e1bce8a4c28e69f4c84ae33bec7afd70aa7f7aa Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Thu, 16 Nov 2017 18:05:01 +0100 Subject: Add support for kernel/initrd/cmdline --- website/docs/r/domain.html.markdown | 95 ++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) (limited to 'website') diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown index b047a6e7..a1e60fcb 100644 --- a/website/docs/r/domain.html.markdown +++ b/website/docs/r/domain.html.markdown @@ -59,6 +59,99 @@ The following arguments are supported: [below](#define-boot-device-order). * `emulator` - (Optional) The path of the emulator to use +### Kernel and boot arguments + +* `kernel` - (Optional) The path of the kernel to boot + +If you are using a qcow2 volume, you can pass the id of the volume (eg. `${libvirt_volume.kernel.id}`) +as they are local to the hypervisor. + +Given that you can define a volume from a remote http file, this means, you can also have remote kernels. + +```hcl +resource "libvirt_volume" "kernel" { + source = "http://download.opensuse.org/tumbleweed/repo/oss/boot/x86_64/loader/linux" + name = "kernel" + pool = "default" + format = "raw" +} + +resource "libvirt_domain" "domain-suse" { + name = "suse" + memory = "1024" + vcpu = 1 + + kernel = "${libvirt_volume.kernel.id}" + + // ... +} +``` + +* `kernel` - (Optional) The path of the initrd to boot. + +You can use it in the same way as the kernel. + +* `cmdlin` - (Optional) Arguments to the kernel + +resource "libvirt_domain" "domain-suse" { + name = "suse" + memory = "1024" + vcpu = 1 + + kernel = "${libvirt_volume.kernel.id}" + + cmdline { + arg1 = "value1" + arg2 = "value2" + } +} +``` + +Also note that the `cmd` block is actually a list of maps, so it is possible to +declare several of them by using either the literal list and map syntax as in +the following examples: + +```hcl +resource "libvirt_domain" "my_machine" { + //... + + cmdline { + arg1 = "value1" + } + cmdline { + arg2 = "value2" + } +} +``` + +```hcl +resource "libvirt_domain" "my_machine" { + ... + cmdline = [ + { + arg1 = "value1" + }, + { + arg2 = "value2" + } + ] +} +``` +The kernel supports passing the same option multiple times. If you need this, use separate cmdline blocks. + +```hcl +resource "libvirt_domain" "my_machine" { + //... + + cmdline { + arg1 = "value1" + } + cmdline { + arg1 = "value2" + } +} +``` + ### UEFI images Some extra arguments are also provided for using UEFI images: @@ -73,7 +166,7 @@ read-only. domain. However, `libvirt` can manage this automatically (and this is the recommended solution) if a mapping for the firmware to a _variables file_ exists in `/etc/libvirt/qemu.conf:nvram`. In that case, `libvirt` will copy that variables file into a file specific for this domain. - * `template` - (Optional) path to the file used to override variables from the master NVRAM +s * `template` - (Optional) path to the file used to override variables from the master NVRAM store. So you should typically use the firmware as this, -- cgit v1.2.3 From 81de2c8cea6a09b2112acfeade2120c2337bf366 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 24 Nov 2017 17:05:00 +0100 Subject: Typo in cmdline docs --- website/docs/r/domain.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'website') diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown index a1e60fcb..98b85a39 100644 --- a/website/docs/r/domain.html.markdown +++ b/website/docs/r/domain.html.markdown @@ -91,7 +91,7 @@ resource "libvirt_domain" "domain-suse" { You can use it in the same way as the kernel. -* `cmdlin` - (Optional) Arguments to the kernel +* `cmdline` - (Optional) Arguments to the kernel resource "libvirt_domain" "domain-suse" { name = "suse" -- cgit v1.2.3 From c3aad57b10355410bc3e897ba47ac916992cf626 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 24 Nov 2017 17:10:41 +0100 Subject: Add missing hcl markdown fence --- website/docs/r/domain.html.markdown | 1 + 1 file changed, 1 insertion(+) (limited to 'website') diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown index 98b85a39..2a0e50e8 100644 --- a/website/docs/r/domain.html.markdown +++ b/website/docs/r/domain.html.markdown @@ -93,6 +93,7 @@ You can use it in the same way as the kernel. * `cmdline` - (Optional) Arguments to the kernel +```hcl resource "libvirt_domain" "domain-suse" { name = "suse" memory = "1024" -- cgit v1.2.3 From 9f7f0253a320a3fe96c2970fa486064fd7cb3963 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Fri, 24 Nov 2017 17:11:39 +0100 Subject: Typo --- website/docs/r/domain.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'website') diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown index 2a0e50e8..f008501e 100644 --- a/website/docs/r/domain.html.markdown +++ b/website/docs/r/domain.html.markdown @@ -167,7 +167,7 @@ read-only. domain. However, `libvirt` can manage this automatically (and this is the recommended solution) if a mapping for the firmware to a _variables file_ exists in `/etc/libvirt/qemu.conf:nvram`. In that case, `libvirt` will copy that variables file into a file specific for this domain. -s * `template` - (Optional) path to the file used to override variables from the master NVRAM + * `template` - (Optional) path to the file used to override variables from the master NVRAM store. So you should typically use the firmware as this, -- cgit v1.2.3