Re: [PATCH v3 06/12] qemu: Generate cmd line at startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 14, 2018 at 17:05:35 +0100, Michal Privoznik wrote:
> This is the easier part. All we need to do here is put -object
> pr-manager-helper,id=$alias,path=$socketPath and then just
> reference the object in -drive file.pr-manager=$alias.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/qemu/qemu_command.c                            | 48 ++++++++++++++++++++++
>  .../disk-virtio-scsi-reservations-not-managed.args | 29 +++++++++++++
>  .../disk-virtio-scsi-reservations.args             | 29 +++++++++++++
>  tests/qemuxml2argvtest.c                           |  8 ++++
>  4 files changed, 114 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-reservations-not-managed.args
>  create mode 100644 tests/qemuxml2argvdata/disk-virtio-scsi-reservations.args
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index fa0aa5d5c..d1bef0d00 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c

[...]

> @@ -9789,6 +9805,36 @@ qemuBuildPanicCommandLine(virCommandPtr cmd,
>  }
>  
>  
> +static void
> +qemuBuildMasterPRCommandLine(virCommandPtr cmd,
> +                             const virDomainDef *def)
> +{
> +    size_t i;
> +    bool managedAdded = false;
> +
> +    for (i = 0; i < def->ndisks; i++) {
> +        const virDomainDiskDef *disk = def->disks[i];
> +        qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src);
> +        qemuDomainDiskPRDPtr prd = srcPriv->prd;
> +        virBuffer buf = VIR_BUFFER_INITIALIZER;
> +
> +        if (!prd || !prd->alias)
> +            continue;
> +
> +        if (virStoragePRDefIsManaged(disk->src->pr)) {
> +            if (managedAdded)
> +                continue;
> +
> +            managedAdded = true;
> +        }
> +
> +        virBufferAsprintf(&buf, "pr-manager-helper,id=%s,path=%s", prd->alias, prd->path);

We usually generate this from JSON string that will be necessary for the
hotplug step. The reason is that if it's ever necessary to add
additional arguments for the object, you don't need to fix two places.

> +        virCommandAddArg(cmd, "-object");
> +        virCommandAddArgBuffer(cmd, &buf);
> +    }
> +}
> +
> +
>  /**
>   * qemuBuildCommandLineValidate:
>   *

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux