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

Re: [libvirt] Some problem with the save function



Charles Duffy wrote:
> Daniel Berteaud wrote:
>> - the second problem is present since libvirt 0.7.1. Now that the saved
>> file can be compressed, it seems we cannot save in a raw format any
>> more.
> 
> Yeeowch.
> 
> How's this for a fix?

Ah, you beat me to it, but...

> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index a65334f..ff30421 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -3912,10 +3912,15 @@ static int qemudDomainSave(virDomainPtr dom,
>          goto cleanup;
>      }
>  
> -    if (STREQ (prog, "raw"))
> +    const char *args;

I think you'll get a warning about "mixing code and data" here.  At least, it's
not at the top of a block, so we should move it to the top of a block.
Otherwise it looks OK to me.

> +    if (STREQ (prog, "raw")) {
>          prog = "cat";
> +        args = "";
> +    } else {
> +        args = "-c";
> +    }
>      internalret = virAsprintf(&command, "migrate \"exec:"
> -                              "%s -c >> '%s' 2>/dev/null\"", prog, safe_path);
> +                              "%s %s >> '%s' 2>/dev/null\"", prog, args, safe_path);
>  
>      if (internalret < 0) {
>          virReportOOMError(dom->conn);

-- 
Chris Lalancette


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