[PATCH] storage: Fix problem of creating a volume in LVM pool

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

 



LVM allows one specify the VG with VG path like "/dev/lv_pool", and
it gets the correct VG name internally by skipping "/dev".

<snip>
    vg_name = skip_dev_dir(cmd, argv[0], NULL);

    if (strrchr(vg_name, '/')) {
        log_error("Volume group name expected "
                  "(no slash)");
        return 0;
    }
</snip>

However, if the path is like "/dev/t/lv_pool", the VG name will be
"/t/lv_pool" then, definitely it's not a valid VG name, and LVM will
complain and fail.

This patch change the codes to use "pool->def->source.name" instead
of "pool->def->target.path" to avoid the problem.
---
 src/storage/storage_backend_logical.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 4de5442..8fe69ea 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -562,7 +562,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
     char size[100];
     const char *cmdargvnew[] = {
         LVCREATE, "--name", vol->name, "-L", size,
-        pool->def->target.path, NULL
+        pool->def->source.name, NULL
     };
     const char *cmdargvsnap[] = {
         LVCREATE, "--name", vol->name, "-L", size,
-- 
1.7.4

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