[lxc-devel] [lxd/master] patches: do not parse volume.size for lvm
brauner on Github
lxc-bot at linuxcontainers.org
Sun Feb 26 00:55:59 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 471 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170226/4bfb4896/attachment.bin>
-------------- next part --------------
From 7ca72c812b69efb6104fd0fe703bfe4c2a59ee5a Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sun, 26 Feb 2017 01:53:55 +0100
Subject: [PATCH] patches: do not parse volume.size for lvm
It really doesn't make a lot of sense to look at the size of the volume group.
Simply set the default.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/patches.go | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/lxd/patches.go b/lxd/patches.go
index dbe91fe..605b860 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -5,7 +5,6 @@ import (
"os"
"os/exec"
"path/filepath"
- "strconv"
"strings"
"syscall"
@@ -796,21 +795,7 @@ func upgradeFromStorageTypeLvm(name string, d *Daemon, defaultPoolName string, d
poolConfig["lvm.vg_name"] = daemonConfig["storage.lvm_vg_name"].Get()
poolConfig["volume.size"] = daemonConfig["storage.lvm_volume_size"].Get()
- if poolConfig["volume.size"] == "" {
- // Get size of the volume group.
- output, err := tryExec("vgs", "--nosuffix", "--units", "b", "--noheadings", "-o", "size", defaultPoolName)
- if err != nil {
- return err
- }
- tmp := string(output)
- tmp = strings.TrimSpace(tmp)
- szFloat, err := strconv.ParseFloat(tmp, 32)
- if err != nil {
- return err
- }
- szInt64 := shared.Round(szFloat)
- poolConfig["volume.size"] = fmt.Sprintf("%dGB", szInt64)
- } else {
+ if poolConfig["volume.size"] != "" {
// In case stuff like GiB is used which
// share.dParseByteSizeString() doesn't handle.
if strings.Contains(poolConfig["volume.size"], "i") {
More information about the lxc-devel
mailing list