Fix creating and cleaning up logical volumes if a target path is specified

* src/storage_backend_logical.c: Patch from Cole Robinson, fix
  creating and cleaning up logical volumes if a target path is
  specified.
Daniel
This commit is contained in:
Daniel Veillard 2008-08-20 13:33:01 +00:00
parent ace1b6bf98
commit ce9439358c
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,9 @@
Wed Aug 20 15:31:47 CEST 2008 Daniel Veillard <veillard@redhat.com>
* src/storage_backend_logical.c: Patch from Cole Robinson, fix
creating and cleaning up logical volumes if a target path is
specified.
Wed Aug 20 15:18:54 CEST 2008 Daniel Veillard <veillard@redhat.com>
* src/parthelper.c: Patch from Cole Robinson, fix size reporting for

View File

@ -453,6 +453,19 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
snprintf(size, sizeof(size)-1, "%lluK", vol->capacity/1024);
size[sizeof(size)-1] = '\0';
if (vol->target.path != NULL) {
/* A target path passed to CreateVol has no meaning */
VIR_FREE(vol->target.path);
}
if (VIR_ALLOC_N(vol->target.path, strlen(pool->def->target.path) +
1 + strlen(vol->name) + 1) < 0) {
virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("volume"));
return -1;
}
strcpy(vol->target.path, pool->def->target.path);
strcat(vol->target.path, "/");
strcat(vol->target.path, vol->name);
if (virRun(conn, cmdargv, NULL) < 0)
return -1;