[libvirt] Some problem with the save function

Chris Lalancette clalance at redhat.com
Fri Sep 18 06:53:01 UTC 2009


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




More information about the libvir-list mailing list