VirtBuilderRes is a resource for building virtual machine images. It is based on the amazing virt-builder tool which is part of the guestfs suite of tools. TODO: Add autoedges with the virt resource disk path!
| 85 | // on the amazing virt-builder tool which is part of the guestfs suite of tools. |
| 86 | // TODO: Add autoedges with the virt resource disk path! |
| 87 | type VirtBuilderRes struct { |
| 88 | traits.Base // add the base methods without re-implementation |
| 89 | |
| 90 | init *engine.Init |
| 91 | |
| 92 | // Output is the full absolute file path where the image will be |
| 93 | // created. If this file exists, then no action will be performed. |
| 94 | // TODO: Consider adding a "overwrite" type mechanism in the future, |
| 95 | // when we can find a safe way to do so. |
| 96 | Output string `lang:"output" yaml:"output"` |
| 97 | |
| 98 | // OSVersion specifies which distro and version to use for installation. |
| 99 | // You will need to pick from the output of `virt-builder --list`. |
| 100 | OSVersion string `lang:"os_version" yaml:"os_version"` |
| 101 | |
| 102 | // Arch specifies the CPU architecture to use for this machine. You will |
| 103 | // need to pick from the output of `virt-builder --list`. Note that not |
| 104 | // all OSVersion+Arch combinations may exist. |
| 105 | Arch string `lang:"arch" yaml:"arch"` |
| 106 | |
| 107 | // Hostname for the new machine. |
| 108 | Hostname string `lang:"hostname" yaml:"hostname"` |
| 109 | |
| 110 | // Format is the disk image format. You likely want "raw" or "qcow2". |
| 111 | Format string `lang:"format" yaml:"format"` |
| 112 | |
| 113 | // Size is the disk size of the new virtual machine in bytes. |
| 114 | Size int `lang:"size" yaml:"size"` |
| 115 | |
| 116 | // Packages is the list of packages to install. If Bootstrap is true, |
| 117 | // then it will add additional packages that we install if needed. |
| 118 | Packages []string `lang:"packages" yaml:"packages"` |
| 119 | |
| 120 | // Update specifies that we should update the installed packages during |
| 121 | // image build. This defaults to true. |
| 122 | Update bool `lang:"update" yaml:"update"` |
| 123 | |
| 124 | // SelinuxRelabel specifies that we should do an selinux relabel on the |
| 125 | // final image. This defaults to true. |
| 126 | SelinuxRelabel bool `lang:"selinux_relabel" yaml:"selinux_relabel"` |
| 127 | |
| 128 | // NoSetup can be set to true to disable trying to install the package |
| 129 | // for the virt-builder binary. |
| 130 | NoSetup bool `lang:"no_setup" yaml:"no_setup"` |
| 131 | |
| 132 | // SSHKeys is a list of additional keys to add to the machine. This is |
| 133 | // not a map because you may wish to add more than one to that user |
| 134 | // account. |
| 135 | SSHKeys []*SSHKeyInfo `lang:"ssh_keys" yaml:"ssh_keys"` |
| 136 | |
| 137 | // RootSSHInject disables installing the root ssh key into the new vm. |
| 138 | // If one is not present, then nothing is done. This defaults to true. |
| 139 | RootSSHInject bool `lang:"root_ssh_inject" yaml:"root_ssh_inject"` |
| 140 | |
| 141 | // RootPasswordSelector is a string in the virt-builder format. See the |
| 142 | // manual page "USERS AND PASSWORDS" section for more information. |
| 143 | RootPasswordSelector string `lang:"root_password_selector" yaml:"root_password_selector"` |
| 144 |