|
|
591b7e |
From 6f8623c570247903e3cba925676677e44a99c69c Mon Sep 17 00:00:00 2001
|
|
|
591b7e |
From: Eduardo Otubo <otubo@redhat.com>
|
|
|
591b7e |
Date: Tue, 28 Apr 2020 08:22:05 +0200
|
|
|
591b7e |
Subject: [PATCH 2/3] swap file "size" being used before checked if str (#315)
|
|
|
591b7e |
|
|
|
591b7e |
RH-Author: Eduardo Otubo <otubo@redhat.com>
|
|
|
591b7e |
Message-id: <20200422130428.7663-3-otubo@redhat.com>
|
|
|
591b7e |
Patchwork-id: 96033
|
|
|
591b7e |
O-Subject: [RHEL-7.7.z/RHEL-7.8.z cloud-init PATCH 2/3] swap file "size" being used before checked if str (#315)
|
|
|
591b7e |
Bugzilla: 1801094
|
|
|
591b7e |
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
591b7e |
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
|
|
591b7e |
|
|
|
591b7e |
commit 46cf23c28812d3e3ba0c570defd9a05628af5556
|
|
|
591b7e |
Author: Eduardo Otubo <otubo@redhat.com>
|
|
|
591b7e |
Date: Tue Apr 14 18:16:25 2020 +0200
|
|
|
591b7e |
|
|
|
591b7e |
swap file "size" being used before checked if str (#315)
|
|
|
591b7e |
|
|
|
591b7e |
Swap file size variable was being used before checked if it's set to str
|
|
|
591b7e |
"auto". If set to "auto", it will break with:
|
|
|
591b7e |
|
|
|
591b7e |
failed to setup swap: unsupported operand type(s) for /: 'str' and 'int'
|
|
|
591b7e |
|
|
|
591b7e |
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
|
|
|
591b7e |
RHBZ: 1772505
|
|
|
591b7e |
|
|
|
591b7e |
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
|
|
|
591b7e |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
591b7e |
---
|
|
|
591b7e |
cloudinit/config/cc_mounts.py | 2 +-
|
|
|
591b7e |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
591b7e |
|
|
|
591b7e |
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
|
|
|
591b7e |
index 6884ddf..811781f 100644
|
|
|
591b7e |
--- a/cloudinit/config/cc_mounts.py
|
|
|
591b7e |
+++ b/cloudinit/config/cc_mounts.py
|
|
|
591b7e |
@@ -274,7 +274,6 @@ def setup_swapfile(fname, size=None, maxsize=None):
|
|
|
591b7e |
maxsize: the maximum size
|
|
|
591b7e |
"""
|
|
|
591b7e |
swap_dir = os.path.dirname(fname)
|
|
|
591b7e |
- mibsize = str(int(size / (2 ** 20)))
|
|
|
591b7e |
if str(size).lower() == "auto":
|
|
|
591b7e |
try:
|
|
|
591b7e |
memsize = util.read_meminfo()['total']
|
|
|
591b7e |
@@ -286,6 +285,7 @@ def setup_swapfile(fname, size=None, maxsize=None):
|
|
|
591b7e |
size = suggested_swapsize(fsys=swap_dir, maxsize=maxsize,
|
|
|
591b7e |
memsize=memsize)
|
|
|
591b7e |
|
|
|
591b7e |
+ mibsize = str(int(size / (2 ** 20)))
|
|
|
591b7e |
if not size:
|
|
|
591b7e |
LOG.debug("Not creating swap: suggested size was 0")
|
|
|
591b7e |
return
|
|
|
591b7e |
--
|
|
|
591b7e |
1.8.3.1
|
|
|
591b7e |
|