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

Re: [libvirt] [PATCH v4 4/7] qemu: Implement qemuDomainManagedSaveDefineXML



On Tue, Aug 08, 2017 at 13:32:52 +0530, Kothapally Madhu Pavan wrote:
> This commit adds qemu driver implementation to edit xml
> configuration of managed save state file of a domain.
> 
> Signed-off-by: Kothapally Madhu Pavan <kmp linux vnet ibm com>
> ---
>  src/qemu/qemu_driver.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index ec73dc1..b6db435 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -6842,6 +6842,46 @@ qemuDomainManagedSaveGetXMLDesc(virDomainPtr dom, unsigned int flags)
>      return ret;
>  }
>  
> +static int
> +qemuDomainManagedSaveDefineXML(virDomainPtr dom, const char *dxml,
> +                               unsigned int flags)
> +{
> +    virQEMUDriverPtr driver = dom->conn->privateData;
> +    virConnectPtr conn = dom->conn;
> +    virDomainObjPtr vm;
> +    char *path = NULL;
> +    int ret;
> +
> +    if (!(vm = qemuDomObjFromDomain(dom)))
> +        return -1;
> +
> +    path = qemuDomainManagedSavePath(driver, vm);
> +    virDomainObjEndAPI(&vm);
> +
> +    if (!path)
> +        goto error;
> +
> +    if (!virFileExists(path)) {
> +        virReportError(VIR_ERR_OPERATION_INVALID,
> +                       "%s",_("domain does not have managed save image"));
> +        goto error;
> +    }
> +
> +    ret = qemuDomainSaveImageDefineXML(conn, path, dxml, flags);
> +
> +    VIR_FREE(path);
> +
> +    if (ret < 0)
> +        goto error;
> +
> +    return ret;
> +
> + error:
> +    VIR_FREE(path);
> +    virDispatchError(conn);

Error dispatching is supposed to be done from the main API call where
you've added, so it does not need to be duplicated. Also it's possible
to just return ret, since it's set correctly in
qemuDomainSaveImageDefineXML.

Attachment: signature.asc
Description: PGP signature


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