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

Re: [libvirt] [PATCH 10/27] Add APIs for issuing 'memsave' and 'pmemsave' monitor commands



On Thu, 2009-09-24 at 16:00 +0100, Daniel P. Berrange wrote:
> * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add new APIs
>   qemuMonitorSaveVirtualMemory() and qemuMonitorSavePhysicalMemory()
> * src/qemu/qemu_driver.c: Use the new qemuMonitorSaveVirtualMemory()
>   and qemuMonitorSavePhysicalMemory() APIs
> ---
>  src/qemu/qemu_driver.c       |   21 ++++-----------
>  src/qemu/qemu_monitor_text.c |   54 ++++++++++++++++++++++++++++++++++++++++++
>  src/qemu/qemu_monitor_text.h |   10 +++++++
>  3 files changed, 70 insertions(+), 15 deletions(-)
> 
...
> diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
> index 8be8047..a5f43c5 100644
> --- a/src/qemu/qemu_monitor_text.c
> +++ b/src/qemu/qemu_monitor_text.c
> @@ -810,3 +810,57 @@ cleanup:
>      return ret;
>  }
>  
> +static int qemuMonitorSaveMemory(const virDomainObjPtr vm,
> +                                 const char *cmdtype,
> +                                 unsigned long long offset,
> +                                 size_t length,
> +                                 const char *path)
> +{
> +    char *cmd = NULL;
> +    char *reply = NULL;
> +    char *safepath = NULL;
> +    int ret = -1;
> +
> +    if (!(safepath = qemudEscapeMonitorArg(path))) {
> +        virReportOOMError(NULL);
> +        goto cleanup;
> +    }

That's new, would have made sense as a separate patch

> +
> +    if (virAsprintf(&cmd, "%s %llu %zi \"%s\"", cmdtype, offset, length, safepath) < 0) {
> +        virReportOOMError(NULL);
> +        goto cleanup;
> +    }
> +
> +    if (qemudMonitorCommand(vm, cmd, &reply) < 0) {
> +        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
> +                         _("could save memory region to '%s'"), path);
> +        goto cleanup;
> +    }
> +
> +    /* XXX what is printed on failure ? */

No debug, but I assume that's fixed in 26/27

ACK

Cheers,
Mark.


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