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

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

 



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@xxxxxxxxxxxxxxxxxx>
> ---
>  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

--
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