The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2115

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 8266b3abcb11241a9cc369cf988227a2aab0016c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Mon, 13 Jun 2016 16:35:11 -0400
Subject: [PATCH] lvm: Don't call lvextend on new LVM
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/storage_lvm.go | 47 +++++++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index e66c189..80de0ec 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -778,12 +778,21 @@ func (s *storageLvm) ImageDelete(fingerprint string) 
error {
 
 func (s *storageLvm) createDefaultThinPool() (string, error) {
        thinPoolName := daemonConfig["storage.lvm_thinpool_name"].Get()
+       isRecent, err := s.lvmVersionIsAtLeast("2.02.99")
+       if err != nil {
+               return "", fmt.Errorf("Error checking LVM version: %v", err)
+       }
+
+       size := "100%FREE"
+       if !isRecent {
+               size = "1G"
+       }
 
-       // Create a tiny 1G thinpool
+       // Create the thin pool
        output, err := tryExec(
                "lvcreate",
                "--poolmetadatasize", "1G",
-               "-L", "1G",
+               "-L", size,
                "--thinpool",
                fmt.Sprintf("%s/%s", s.vgName, thinPoolName))
 
@@ -799,23 +808,25 @@ func (s *storageLvm) createDefaultThinPool() (string, 
error) {
                        "Could not create LVM thin pool named %s", thinPoolName)
        }
 
-       // Grow it to the maximum VG size (two step process required by old LVM)
-       output, err = tryExec(
-               "lvextend",
-               "--alloc", "anywhere",
-               "-l", "100%FREE",
-               fmt.Sprintf("%s/%s", s.vgName, thinPoolName))
-
-       if err != nil {
-               s.log.Error(
-                       "Could not grow thin pool",
-                       log.Ctx{
-                               "name":   thinPoolName,
-                               "err":    err,
-                               "output": string(output)})
+       if !isRecent {
+               // Grow it to the maximum VG size (two step process required by 
old LVM)
+               output, err = tryExec(
+                       "lvextend",
+                       "--alloc", "anywhere",
+                       "-l", "100%FREE",
+                       fmt.Sprintf("%s/%s", s.vgName, thinPoolName))
 
-               return "", fmt.Errorf(
-                       "Could not grow LVM thin pool named %s", thinPoolName)
+               if err != nil {
+                       s.log.Error(
+                               "Could not grow thin pool",
+                               log.Ctx{
+                                       "name":   thinPoolName,
+                                       "err":    err,
+                                       "output": string(output)})
+
+                       return "", fmt.Errorf(
+                               "Could not grow LVM thin pool named %s", 
thinPoolName)
+               }
        }
 
        return thinPoolName, nil
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to