[libvirt] [PATCH v8 09/11] qemu: Introduce qemuDomainPrepareDiskSource

Peter Krempa pkrempa at redhat.com
Tue Sep 19 13:48:55 UTC 2017


On Thu, Sep 14, 2017 at 08:51:54 -0400, John Ferlan wrote:
> Introduce a function to setup any TLS needs for a disk source.
> 
> If there's a configuration or other error setting up the disk source
> for TLS, then cause the domain startup to fail.
> 
> For VxHS, follow the chardevTLS model where if the src->haveTLS hasn't
> been configured, then take the system/global cfg->haveTLS setting for
> the storage source *and* mark that we've done so via the tlsFromConfig
> setting in storage source.
> 
> Next, if we are using TLS, then generate an alias into a virStorageSource
> 'tlsAlias' field that will be used to create the TLS object and added to
> the disk object in order to link the two together for QEMU.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_domain.c    | 71 +++++++++++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_domain.h    | 11 ++++++++
>  src/qemu/qemu_process.c   |  4 +++
>  src/util/virstoragefile.c |  5 +++-
>  src/util/virstoragefile.h |  6 ++++
>  5 files changed, 96 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 05f8e9488..b93b7de63 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c

[...]

> +
> +/* qemuProcessPrepareDiskSource:
> + * @def: live domain definition
> + * @driver: qemu driver
> + *
> + * Iterate through all disk devices to setup/check any that would be
> + * using TLS.

Don't add this here. This function is generic.

> + *
> + * Returns 0 on success, -1 on failure
> + */
> +int
> +qemuDomainPrepareDiskSource(virDomainDefPtr def,
> +                            virQEMUDriverConfigPtr cfg)
> +{
> +    size_t i;
> +
> +    for (i = 0; i < def->ndisks; i++) {
> +        if (qemuDomainPrepareDiskSourceTLS(def->disks[i]->src,
> +                                           def->disks[i]->info.alias,
> +                                           cfg) < 0)
> +            return -1;
> +    }
> +
> +    return 0;
> +}
> +
>  
>  int
>  qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)

ACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170919/d5362ec6/attachment-0001.sig>


More information about the libvir-list mailing list