[libvirt] [PATCH v6 2/3] qemu: Implement extended loader and nvram
Ján Tomko
jtomko at redhat.com
Tue Sep 9 15:17:26 UTC 2014
On 09/01/2014 05:22 PM, Michal Privoznik wrote:
> QEMU now supports UEFI with the following command line:
>
> -drive file=/usr/share/OVMF/OVMF_CODE.fd,if=pflash,format=raw,unit=0,readonly=on \
> -drive file=/usr/share/OVMF/OVMF_VARS.fd,if=pflash,format=raw,unit=1 \
>
> where the first line reflects <loader> and the second one <nvram>.
> Moreover, these two lines obsoletes the -bios argument.
s/obsoletes/obsolete/
>
> Note that UEFI is unusable without ACPI. This is handled properly now.
> Among with this extension, the variable file is expected to be
> writable and hence we need security drivers to label it.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> Acked-by: Laszlo Ersek <lersek at redhat.com>
> ---
> src/qemu/qemu_command.c | 94 +++++++++++++++++++++-
> src/security/security_dac.c | 8 ++
> src/security/security_selinux.c | 8 ++
> .../qemuxml2argvdata/qemuxml2argv-bios-nvram.args | 10 +++
> tests/qemuxml2argvtest.c | 2 +
> 5 files changed, 118 insertions(+), 4 deletions(-)
> create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bios-nvram.args
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 3cb2e0b..510f378 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7370,6 +7370,94 @@ qemuBuildChrDeviceCommandLine(virCommandPtr cmd,
> return 0;
> }
>
> +static int
> +qemuBuilDomainLoaderCommandLine(virCommandPtr cmd,
Missing 'd' in Build.
> + virDomainDefPtr def,
> + virQEMUCapsPtr qemuCaps)
> +{
> + int ret = -1;
> + virDomainLoaderDefPtr loader = def->os.loader;
> + virBuffer buf = VIR_BUFFER_INITIALIZER;
> + int unit = 0;
> +
> + if (!loader)
> + return 0;
> +
> + switch ((virDomainLoader) loader->type) {
> + case VIR_DOMAIN_LOADER_TYPE_ROM:
> + virCommandAddArg(cmd, "-bios");
> + virCommandAddArg(cmd, loader->path);
> + break;
> +
> + case VIR_DOMAIN_LOADER_TYPE_PFLASH:
> + /* UEFI is supported only for x86_64 currently */
> + if (def->os.arch != VIR_ARCH_X86_64) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("pflash is not supported for %s guest achitecture"),
s/achitecture/architecture/
> + virArchToString(def->os.arch));
> + goto cleanup;
> + }
> +
> + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE)) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("this qemu doesn't support -drive"));
All these errors are probably very unlikely, but 'this QEMU' or 'this QEMU
binary' would be nicer IMO.
> + goto cleanup;
> + }
> + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT)) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("this qemu doesn't support passing "
> + "drive format"));
> + goto cleanup;
> + }
> + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI) &&
> + def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("ACPI must be enabled in order to use UEFI"));
> + goto cleanup;
> + }
> +
> + virBufferAsprintf(&buf,
> + "file=%s,if=pflash,format=raw,unit=%d",
> + loader->path, unit);
> + unit++;
> +
> + if (loader->readonly) {
> + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY)) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("this qemu doesn't support passing "
> + "readonly attribute"));
> + goto cleanup;
> + }
> +
> + virBufferAsprintf(&buf, ",readonly=%s",
> + virTristateSwitchTypeToString(loader->readonly));
> + }
> +
ACK if you fix at least 30 % of the typos.
Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140909/52b0f104/attachment-0001.sig>
More information about the libvir-list
mailing list