From ce9439358c3f022b2379edf081592a9346d83724 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 20 Aug 2008 13:33:01 +0000 Subject: [PATCH] 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 --- ChangeLog | 6 ++++++ src/storage_backend_logical.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 152e9707cc..e89bdbb9c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Aug 20 15:31:47 CEST 2008 Daniel Veillard + + * 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 * src/parthelper.c: Patch from Cole Robinson, fix size reporting for diff --git a/src/storage_backend_logical.c b/src/storage_backend_logical.c index 0c4f6a5702..eb362c6fbb 100644 --- a/src/storage_backend_logical.c +++ b/src/storage_backend_logical.c @@ -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;