[lxc-devel] [lxd/master] ceph: fix divide error

Mantwon on Github lxc-bot at linuxcontainers.org
Sun Sep 10 07:54:11 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 340 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170910/c97ffae0/attachment.bin>
-------------- next part --------------
From 7257f04e1ba417ac0a70ceb67ef89766f5dcee2d Mon Sep 17 00:00:00 2001
From: Greg Smith <me at smith.gr>
Date: Sun, 10 Sep 2017 00:52:59 -0700
Subject: [PATCH] ceph: fix divide error

Signed-off-by: Greg Smith <me at smith.gr>
---
 lxd/storage_ceph_utils.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/storage_ceph_utils.go b/lxd/storage_ceph_utils.go
index 1200677dc..a8bb541f2 100644
--- a/lxd/storage_ceph_utils.go
+++ b/lxd/storage_ceph_utils.go
@@ -1582,7 +1582,7 @@ func (s *storageCeph) rbdShrink(path string, size int64, fsType string,
 		"--id", s.UserName,
 		"--cluster", s.ClusterName,
 		"--pool", s.OSDPoolName,
-		"--size", fmt.Sprintf("%dM", (size/1024)),
+		"--size", fmt.Sprintf("%dM", (size/1024/1024)),
 		fmt.Sprintf("%s_%s", volumeTypeName, volumeName))
 	if err != nil {
 		logger.Errorf(`Could not shrink RBD storage volume "%s": %s`,
@@ -1637,7 +1637,7 @@ func (s *storageCeph) rbdGrow(path string, size int64, fsType string,
 		"--id", s.UserName,
 		"--cluster", s.ClusterName,
 		"--pool", s.OSDPoolName,
-		"--size", fmt.Sprintf("%dM", (size/1024)),
+		"--size", fmt.Sprintf("%dM", (size/1024/1024)),
 		fmt.Sprintf("%s_%s", volumeTypeName, volumeName))
 	if err != nil {
 		logger.Errorf(`Could not extend RBD storage volume "%s": %s`,


More information about the lxc-devel mailing list