Re: [PATCH 2/2] check compression program at virsh save and dump

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

 



On Thu, Oct 28, 2010 at 07:28:34PM +0900, KAMEZAWA Hiroyuki wrote:
> >From bc55de1e6a8506adcde52aa95e2be9d4bb5bfb2e Mon Sep 17 00:00:00 2001
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
> Date: Thu, 28 Oct 2010 17:51:18 +0900
> Subject: [PATCH 2/2] check compression program availabilityy of virsh save and dump.
> 
> ---
>  src/qemu/qemu_driver.c |   28 ++++++++++++++++++++++++++++
>  1 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 51ad50b..61dc6e8 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -5740,6 +5740,22 @@ cleanup:
>      return ret;
>  }
>  
> +/* returns 1 if a compression program is available in PATH */
> +static int qemudCompressProgramAvailable(int compress)
> +{
> +    const char *prog;
> +    char *c;
> +
> +    if (compress == QEMUD_SAVE_FORMAT_RAW)
> +        return 1;
> +    prog = qemudSaveCompressionTypeToString(compress);
> +    c = virFindFileInPath(prog);
> +    if (!c)
> +        return 0;
> +    VIR_FREE(c);
> +    return 1;
> +}
> +
>  static int qemudDomainSave(virDomainPtr dom, const char *path)
>  {
>      struct qemud_driver *driver = dom->conn->privateData;
> @@ -5759,6 +5775,12 @@ static int qemudDomainSave(virDomainPtr dom, const char *path)
>                                      "in configuration file"));
>              return -1;
>          }
> +        if (!qemudCompressProgramAvailable(compressed)) {
> +            qemuReportError(VIR_ERR_OPERATION_FAILED,
> +                            "%s", _("Compression program for image format "
> +                                    "in configuration file isn't available"));
> +            return -1;
> +        }
>      }
>  
>      vm = virDomainFindByUUID(&driver->domains, dom->uuid);
> @@ -5922,6 +5944,12 @@ static int qemudDomainCoreDump(virDomainPtr dom,
>                               "configuration file"));
>             return -1;
>          }
> +        if (!qemudCompressProgramAvailable(compress)) {
> +            qemuReportError(VIR_ERR_OPERATION_FAILED,
> +                            "%s", _("Compression program for dump image format "
> +                                    "in configuration file isn't available"));
> +            return -1;
> +        }
>      }
>  
>      qemuDriverLock(driver);

ACK

Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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]