]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix creating and cleaning up logical volumes if a target path is specified
authorDaniel Veillard <veillard@redhat.com>
Wed, 20 Aug 2008 13:33:01 +0000 (13:33 +0000)
committerDaniel Veillard <veillard@redhat.com>
Wed, 20 Aug 2008 13:33:01 +0000 (13:33 +0000)
* src/storage_backend_logical.c: Patch from Cole Robinson, fix
  creating and cleaning up logical volumes if a target path is
  specified.
Daniel

ChangeLog
src/storage_backend_logical.c

index 152e9707cc2fd0163524181532fb6578986176cf..e89bdbb9c9b0cad7ae0a02b29663a5103072a7db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 0c4f6a57021df5b710d8b338f78a373c7e142c7a..eb362c6fbb170735c766c843ea9f6119e14d0ba1 100644 (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;