Merge lp:~fginther/adt-cloud-worker/uci-nova-swapfile into lp:~canonical-ci-engineering/adt-cloud-worker/uci-nova

Proposed by Celso Providelo
Status: Merged
Approved by: Francis Ginther
Approved revision: 13
Merged at revision: 13
Proposed branch: lp:~fginther/adt-cloud-worker/uci-nova-swapfile
Merge into: lp:~canonical-ci-engineering/adt-cloud-worker/uci-nova
Diff against target: 25 lines (+8/-0)
1 file modified
uci-nova (+8/-0)
To merge this branch: bzr merge lp:~fginther/adt-cloud-worker/uci-nova-swapfile
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Thomi Richards (community) Approve
Review via email: mp+257563@code.launchpad.net

Commit message

Add a 4GB swapfile as a way to extend available RAM.

Description of the change

Add a 4GB swapfile as a way to extend available RAM.

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

How id this better / worse / different to using the '--swap' option to 'nova boot' ?

review: Needs Information
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

also, don't forget to set a commit message :D

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

<fginther> thomi, just saw that. I'll comment in both places. --swap only works if the nova flavor is already to configured to have a swap partition.

In that case, this LGTM

review: Approve
Revision history for this message
Francis Ginther (fginther) wrote :

> How id this better / worse / different to using the '--swap' option to 'nova
> boot' ?

"nova --swap" requires that the nova flavor already have swap configured (this option appears to allow you to specify less then what the flavor specifies). I did try both methods on bootstack and didn't notice any functional differences. Performance may be different but a better testcase first would be helpful.

Revision history for this message
Celso Providelo (cprov) wrote :

Francis,

Thanks for working on this.

As discussed on IRC, it might consume few seconds on the cloud-init setup and 4 GB of disk. Since we recently bumped the disk from 10 to 50 GB, there should be no sensible side-effect on tests that do not need swap.

FTR, that is another change that has no value for core-image-testing.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'uci-nova'
2--- uci-nova 2015-04-23 18:21:49 +0000
3+++ uci-nova 2015-04-27 18:35:56 +0000
4@@ -214,6 +214,12 @@
5 archive_setup="mirror_release=\`awk '/^deb .*(debian|ubuntu)/ { print \$2,\$3; exit }' \"\$root/etc/apt/sources.list\"\`; echo \"deb \${mirror_release} main restricted universe multiverse\ndeb \${mirror_release}-updates main restricted universe multiverse\ndeb-src \${mirror_release} main restricted universe multiverse\ndeb-src \${mirror_release}-updates main restricted universe multiverse\" > /etc/apt/sources.list"
6 fi
7
8+ # Add a swapfile to extend the amount of RAM available to process. As this
9+ # is a local file on the boot disk, it does not need any support within the
10+ # nova flavor. This does consume space on the boot disk and is not ideal
11+ # from the performance perspective.
12+ swap_setup="fallocate -l 4G /swapfile; chmod 600 /swapfile; mkswap /swapfile; swapon /swapfile; echo \"/swapfile none swap sw 0 0\" >> /etc/fstab"
13+
14 # generate cloud-init user data; mostly for manage_etc_hosts, but also get
15 # rid of some unnecessary stuff in the VM
16 #
17@@ -234,6 +240,8 @@
18 # Setup archive and do an update after changing the apt sources
19 - ${archive_setup}
20 - apt-get update
21+ # Add a swapfile
22+ - ${swap_setup}
23 # Make apt faster:
24 - echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/90nolanguages
25 - echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/autopkgtest

Subscribers

People subscribed via source and target branches