[libvirt] [PATCH] Ignore specified target path when creating logical vol

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

 



Specifying a target path when creating a storage
volume has no effect, since volumes only really use
the pool's target path and 'name' field to
establish the volume's target. Logical volumes
expect a target path to be passed, and it can
only cause problems.

The attached patch erases the passed target volume
and fills it in with the one generated from the
create operation.

Thanks,
Cole
commit 3e2a4e2fa460a34330a08ab77fe67bcbd542f519
Author: Cole (Work Acct) <crobinso@xxxxxxxxxxxxxxxxxxxxx>
Date:   Tue Aug 12 21:55:54 2008 -0400

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

diff --git a/src/storage_backend_logical.c b/src/storage_backend_logical.c
index 0c4f6a5..eb362c6 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;
 
--
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]