Re: [PATCH 7/7] storage:dir: adapts .uploadVol .dowloadVol for ploop volume

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

 



On Mon, Apr 11, 2016 at 07:16:25PM +0300, Olga Krishtal wrote:
> In case of ploop volume, target path of the volume is the path to the
> directory that contains image file named root.hds and DiskDescriptor.xml.
> While using uploadVol and downloadVol callbacks we need to open root.hds
> itself.
> Upload or download operations with ploop volume are only allowed when
> images do not have snapshots. Otherwise operation fails.
> 
> Signed-off-by: Olga Krishtal <okrishtal@xxxxxxxxxxxxx>
> ---
>  src/storage/storage_backend.c | 99 +++++++++++++++++++++++++++++++++++++++++--
>  src/storage/storage_driver.c  | 51 +++++++++++++++++++++-
>  2 files changed, 146 insertions(+), 4 deletions(-)
> 

ACK

> +static int
> +virStorageBackendPloopHasSnapshots(char *path)
> +{
> +    virCommandPtr cmd = NULL;
> +    char *output = NULL;
> +    char *snap_tool = NULL;
> +    int ret = -1;
> +
> +    snap_tool = virFindFileInPath("ploop");
> +    if (!snap_tool) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       "%s", _("can't upload volume,"
> +                               " please install ploop tool "));

This error message has a trailing space so I replaced it with the one
used by other calls:
-                       "%s", _("can't upload volume,"
-                               " please install ploop tool "));
+                       "%s", _("unable to find ploop, please install "
+                               "ploop tools"));


> +        return ret;
> +    }
> +
> +    cmd = virCommandNewArgList(snap_tool, "snapshot-list", NULL);
> +    virCommandAddArgFormat(cmd, "%s/DiskDescriptor.xml", path);
> +    virCommandSetOutputBuffer(cmd, &output);
> +
> +    if ((ret = virCommandRun(cmd, NULL)) < 0)
> +        goto cleanup;
> +
> +    if (!strstr(output, "root.hds.")) {
> +        ret = 1;

> @@ -2296,7 +2343,6 @@ storageVolUpload(virStorageVolPtr obj,
>                         vol->name);
>          goto cleanup;
>      }
> -

Unrelated whitespace change.

>      if (!backend->uploadVol) {
>          virReportError(VIR_ERR_NO_SUPPORT, "%s",
>                         _("storage pool doesn't support volume upload"));
> @@ -2313,6 +2359,9 @@ storageVolUpload(virStorageVolPtr obj,
>          if (VIR_ALLOC(cbdata) < 0 ||
>              VIR_STRDUP(cbdata->pool_name, pool->def->name) < 0)
>              goto cleanup;
> +            if (vol->target.type == VIR_STORAGE_VOL_PLOOP &&
> +              VIR_STRDUP(cbdata->vol_path, vol->target.path) < 0)
> +            goto cleanup;

The indentation is off here.

Jan

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