Re: [libvirt] [PATCH] Compressed save image format for Qemu.

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

 



On Fri, Aug 07, 2009 at 03:56:29PM +0200, Chris Lalancette wrote:
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 3c92635..b146330 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c

Is part of the change missing ?  Nothing is added
the 'compressed' field to the struct qemud_save_header 
that appears just before qemudDomainSave(), nor incrementing
the save version to '2'.

> @@ -3437,11 +3437,26 @@ static int qemudDomainSave(virDomainPtr dom,
>      struct qemud_save_header header;
>      int ret = -1;
>      virDomainEventPtr event = NULL;
> +    int internalret;
>  
>      memset(&header, 0, sizeof(header));
>      memcpy(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic));
>      header.version = QEMUD_SAVE_VERSION;
>  
> +    if (driver->saveImageFormat == NULL)
> +        header.compressed = QEMUD_SAVE_FORMAT_RAW;
> +    else if (STREQ(driver->saveImageFormat, "raw"))
> +        header.compressed = QEMUD_SAVE_FORMAT_RAW;
> +    else if (STREQ(driver->saveImageFormat, "gzip"))
> +        header.compressed = QEMUD_SAVE_FORMAT_GZIP;
> +    else if (STREQ(driver->saveImageFormat, "bzip2"))
> +        header.compressed = QEMUD_SAVE_FORMAT_BZIP2;
> +    else {
> +        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
> +                         "%s", _("Invalid save image format specified in configuration file"));
> +        return -1;
> +    }
> +
>      qemuDriverLock(driver);
>      vm = virDomainFindByUUID(&driver->domains, dom->uuid);
>  
> @@ -3514,11 +3529,25 @@ static int qemudDomainSave(virDomainPtr dom,
>          virReportOOMError(dom->conn);
>          goto cleanup;
>      }
> -    if (virAsprintf(&command, "migrate \"exec:"
> -                  "dd of='%s' oflag=append conv=notrunc 2>/dev/null"
> -                  "\"", safe_path) == -1) {
> +
> +    if (header.compressed == QEMUD_SAVE_FORMAT_RAW)
> +        internalret = virAsprintf(&command, "migrate \"exec:"
> +                                  "dd of='%s' oflag=append conv=notrunc 2>/dev/null"
> +                                  "\"", safe_path);
> +    else if (header.compressed == QEMUD_SAVE_FORMAT_GZIP)
> +        internalret = virAsprintf(&command, "migrate \"exec:"
> +                                  "gzip -c >> '%s' 2>/dev/null\"", safe_path);
> +    else if (header.compressed == QEMUD_SAVE_FORMAT_BZIP2)
> +        internalret = virAsprintf(&command, "migrate \"exec:"
> +                                  "bzip2 -c >> '%s' 2>/dev/null\"", safe_path);
> +    else {
> +        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
> +                         _("Invalid compress format %d"),
> +                         header.compressed);
> +        goto cleanup;
> +    }
> +    if (internalret < 0) {
>          virReportOOMError(dom->conn);
> -        command = NULL;
>          goto cleanup;
>      }
>  

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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