FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 02-17-2012, 12:33 PM
Vratislav Podzimek
 
Default Add swapSameAsRam and use it for autopartitioning

Resolves: rhbz#744129
---
constants.py | 3 +++
installclass.py | 2 +-
iutil.py | 15 +++++++++++++++
3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/constants.py b/constants.py
index 7455322..77f9c94 100644
--- a/constants.py
+++ b/constants.py
@@ -89,3 +89,6 @@ DD_FIRMWARE = "/tmp/DD/lib/firmware"
DD_RPMS = "/tmp/DD-*"

TRANSLATIONS_UPDATE_DIR="/tmp/updates/po"
+
+#see rhbz#744129 for details
+SWAP_SIZE_LIMIT = 100 * 1024
diff --git a/installclass.py b/installclass.py
index a417762..9514097 100644
--- a/installclass.py
+++ b/installclass.py
@@ -191,7 +191,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = iutil.swapSuggestion()
+ (minswap, maxswap) = iutil.swapSameAsRam()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, asVol=True))

diff --git a/iutil.py b/iutil.py
index a477172..f7254e2 100644
--- a/iutil.py
+++ b/iutil.py
@@ -479,6 +479,21 @@ def swapSuggestion(quiet=0):

return (minswap, maxswap)

+def swapSameAsRam(quiet=0):
+ mem = memInstalled() / 1024
+ mem = ((mem / 16) + 1) * 16
+ if not quiet:
+ log.info("Detected %sM of memory", mem)
+
+ #see #rhbz587152
+ if mem <= SWAP_SIZE_LIMIT:
+ log.info("Swap attempt of %sM to %sM", mem, mem)
+ return (mem, mem)
+ else:
+ log.warning("Cannot create swap of size %sM, using upper bound %sM",
+ mem, SWAP_SIZE_LIMIT)
+ return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
+
## Create a directory path. Don't fail if the directory already exists.
# @param dir The directory path to create.
def mkdirChain(dir):
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 02-24-2012, 10:15 AM
Vratislav Podzimek
 
Default Add swapSameAsRam and use it for autopartitioning

Resolves: rhbz#744129
---
constants.py | 3 +++
installclass.py | 2 +-
iutil.py | 15 +++++++++++++++
3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/constants.py b/constants.py
index 5ccc0f6..119102c 100644
--- a/constants.py
+++ b/constants.py
@@ -93,3 +93,6 @@ TRANSLATIONS_UPDATE_DIR="/tmp/updates/po"
# number of retries before displaying an error dialog
YUM_DOWNLOAD_RETRIES = 3
YUM_DOWNLOAD_DELAY = 3
+
+#see rhbz#744129 for details
+SWAP_SIZE_LIMIT = 128 * 1024
diff --git a/installclass.py b/installclass.py
index a417762..9514097 100644
--- a/installclass.py
+++ b/installclass.py
@@ -191,7 +191,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = iutil.swapSuggestion()
+ (minswap, maxswap) = iutil.swapSameAsRam()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, asVol=True))

diff --git a/iutil.py b/iutil.py
index a477172..f7254e2 100644
--- a/iutil.py
+++ b/iutil.py
@@ -479,6 +479,21 @@ def swapSuggestion(quiet=0):

return (minswap, maxswap)

+def swapSameAsRam(quiet=0):
+ mem = memInstalled() / 1024
+ mem = ((mem / 16) + 1) * 16
+ if not quiet:
+ log.info("Detected %sM of memory", mem)
+
+ #see #rhbz587152
+ if mem <= SWAP_SIZE_LIMIT:
+ log.info("Swap attempt of %sM to %sM", mem, mem)
+ return (mem, mem)
+ else:
+ log.warning("Cannot create swap of size %sM, using upper bound %sM",
+ mem, SWAP_SIZE_LIMIT)
+ return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
+
## Create a directory path. Don't fail if the directory already exists.
# @param dir The directory path to create.
def mkdirChain(dir):
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-20-2012, 11:48 AM
Vratislav Podzimek
 
Default Add swapSameAsRam and use it for autopartitioning

See rhbz#744129 for details

(ported 0ff17d6012e6cfa2458d3fa282dfd5094a4f5787 from rhel6-branch)
---
pyanaconda/installclass.py | 2 +-
pyanaconda/storage/devicelibs/swap.py | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 0855319..9f9a5d3 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -185,7 +185,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = swap.swapSuggestion()
+ (minswap, maxswap) = swap.swapSameAsRam()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, lv=True, encrypted=True))

diff --git a/pyanaconda/storage/devicelibs/swap.py b/pyanaconda/storage/devicelibs/swap.py
index 9ce7356..b95e829 100644
--- a/pyanaconda/storage/devicelibs/swap.py
+++ b/pyanaconda/storage/devicelibs/swap.py
@@ -31,6 +31,8 @@ from . import dm
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)

+#see rhbz#744129 for details
+SWAP_SIZE_LIMIT = 128 * 1024

def mkswap(device, label=', progress=None):
# We use -f to force since mkswap tends to refuse creation on lvs with
@@ -166,3 +168,25 @@ def swapSuggestion(quiet=0):

return (minswap, maxswap)

+def swapSameAsRam(quiet=0):
+ """
+ Checks if we can create a swap with the same size as RAM (see rhbz#587152)
+ and returns max(RAMsize, SWAP_SIZE_LIMIT).
+
+ @param quiet: whether the size information should be logged
+
+ """
+
+ mem = iutil.memInstalled() / 1024
+ mem = ((mem / 16) + 1) * 16
+ if not quiet:
+ log.info("Detected %sM of memory", mem)
+
+ #see #rhbz587152
+ if mem <= SWAP_SIZE_LIMIT:
+ log.info("Swap attempt of %sM to %sM", mem, mem)
+ return (mem, mem)
+ else:
+ log.warning("Cannot create swap of size %sM, using upper bound %sM",
+ mem, SWAP_SIZE_LIMIT)
+ return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-25-2012, 02:01 PM
Vratislav Podzimek
 
Default Add swapSameAsRam and use it for autopartitioning

The algorithm in swapSuggestion has changed to using less swap space than RAM
size which is not enough for hibernation. So we need to use a different
algorithm for autopartitioning and the swap with the same size as RAM should be
a good default.

(ported 0ff17d6012e6cfa2458d3fa282dfd5094a4f5787 from rhel6-branch)
---
pyanaconda/installclass.py | 2 +-
pyanaconda/storage/devicelibs/swap.py | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 0855319..9f9a5d3 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -185,7 +185,7 @@ class BaseInstallClass(object):
if bootreq:
autorequests.extend(bootreq)

- (minswap, maxswap) = swap.swapSuggestion()
+ (minswap, maxswap) = swap.swapSameAsRam()
autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
grow=True, lv=True, encrypted=True))

diff --git a/pyanaconda/storage/devicelibs/swap.py b/pyanaconda/storage/devicelibs/swap.py
index c4a46b1..52209ff 100644
--- a/pyanaconda/storage/devicelibs/swap.py
+++ b/pyanaconda/storage/devicelibs/swap.py
@@ -31,6 +31,8 @@ from . import dm
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)

+#see rhbz#744129 for details
+SWAP_SIZE_LIMIT = 128 * 1024

def mkswap(device, label=', progress=None):
# We use -f to force since mkswap tends to refuse creation on lvs with
@@ -166,3 +168,25 @@ def swapSuggestion(quiet=0):

return (minswap, maxswap)

+def swapSameAsRam(quiet=0):
+ """
+ Checks if we can create a swap with the same size as RAM (see rhbz#587152)
+ and returns max(RAMsize, SWAP_SIZE_LIMIT).
+
+ @param quiet: whether the size information should be logged
+
+ """
+
+ mem = iutil.memInstalled() / 1024
+ mem = ((mem / 16) + 1) * 16
+ if not quiet:
+ log.info("Detected %sM of memory", mem)
+
+ #see #rhbz587152
+ if mem <= SWAP_SIZE_LIMIT:
+ log.info("Swap attempt of %sM to %sM", mem, mem)
+ return (mem / 2, mem)
+ else:
+ log.warning("Cannot create swap of size %sM, using upper bound %sM",
+ mem, SWAP_SIZE_LIMIT)
+ return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
--
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 10:05 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org