[libvirt] [PATCH 3/4] qemu: Adapt to NVRAM store file format change

Laszlo Ersek lersek at redhat.com
Tue Jan 13 15:07:02 UTC 2015


comments below

On 01/13/15 14:41, Michal Privoznik wrote:
> This basically implements the availability of
> choosing NVRAM store file format in the qemu driver.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_command.c                            |  6 ++--
>  .../qemuxml2argv-bios-nvram-qcow2.args             | 10 ++++++
>  .../qemuxml2argv-bios-nvram-qcow2.xml              | 40 ++++++++++++++++++++++
>  tests/qemuxml2argvtest.c                           |  2 ++
>  4 files changed, 56 insertions(+), 2 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bios-nvram-qcow2.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-bios-nvram-qcow2.xml
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 3346e95..311cd98 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -7708,8 +7708,10 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
>          if (loader->nvram) {
>              virBufferFreeAndReset(&buf);
>              virBufferAsprintf(&buf,
> -                              "file=%s,if=pflash,format=raw,unit=%d",
> -                              loader->nvram, unit);
> +                              "file=%s,if=pflash,format=%s,unit=%d",
> +                              loader->nvram,
> +                              virDomainLoaderNVRAMFormatTypeToString(loader->nvramFormat),
> +                              unit);
>  
>              virCommandAddArg(cmd, "-drive");
>              virCommandAddArgBuffer(cmd, &buf);

This formats the command line fragment for unit#1. But, as discussed
before, we need to be able to specify the format for unit#0 as well,
here under VIR_DOMAIN_LOADER_TYPE_PFLASH. Not particularly necessary for
"readonly", but necessary for the unified (consequently: read-write)
case, when loader->nvram is NULL.

(I suggest (in line with libvirt tradition) that you *not* try to lock
down the various combinations of the flags; let qemu worry about that.
Just transform the config bits to syntactically valid qemu options. IOW
the above seems structurally sufficient; don't bother about the
interplay between readonly, nvram, etc etc.)

[snip]

Thanks!
Laszlo




More information about the libvir-list mailing list