git://git.onelab.eu
/
build.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d030fcf
)
lbuild-init-vm.sh : add option -m memory, to specify the amount of memory in MB,...
author
Mohamed Larabi
<mohamed.larabi@inria.fr>
Fri, 28 Feb 2014 14:34:28 +0000
(15:34 +0100)
committer
Mohamed Larabi
<mohamed.larabi@inria.fr>
Fri, 28 Feb 2014 14:34:28 +0000
(15:34 +0100)
lbuild-initvm.sh
patch
|
blob
|
history
diff --git
a/lbuild-initvm.sh
b/lbuild-initvm.sh
index
0b09cf7
..
f32d5c3
100755
(executable)
--- a/
lbuild-initvm.sh
+++ b/
lbuild-initvm.sh
@@
-22,6
+22,7
@@
export PATH=$PATH:/bin:/sbin
DEFAULT_FCDISTRO=f20
DEFAULT_PLDISTRO=lxc
DEFAULT_PERSONALITY=linux64
DEFAULT_FCDISTRO=f20
DEFAULT_PLDISTRO=lxc
DEFAULT_PERSONALITY=linux64
+DEFAULT_MEMORY=512
##########
# constant
##########
# constant
@@
-590,7
+591,7
@@
function write_lxc_xml_test () {
cat <<EOF
<domain type='lxc'>
<name>$lxc</name>
cat <<EOF
<domain type='lxc'>
<name>$lxc</name>
- <memory>
524288
</memory>
+ <memory>
$MEMORY
</memory>
<os>
<type arch='$arch2'>exe</type>
<init>/sbin/init</init>
<os>
<type arch='$arch2'>exe</type>
<init>/sbin/init</init>
@@
-629,7
+630,7
@@
function write_lxc_xml_build () {
cat <<EOF
<domain type='lxc'>
<name>$lxc</name>
cat <<EOF
<domain type='lxc'>
<name>$lxc</name>
- <memory>
524288
</memory>
+ <memory>
$MEMORY
</memory>
<os>
<type arch='$arch2'>exe</type>
<init>/sbin/init</init>
<os>
<type arch='$arch2'>exe</type>
<init>/sbin/init</init>
@@
-865,6
+866,7
@@
function usage () {
echo " -P pkgs_file - defines a set of extra packages to install in guest"
echo " by default we use devel.pkgs (build mode) or runtime.pkgs (test mode)"
echo " -i image - the location of the rootfs"
echo " -P pkgs_file - defines a set of extra packages to install in guest"
echo " by default we use devel.pkgs (build mode) or runtime.pkgs (test mode)"
echo " -i image - the location of the rootfs"
+ echo " -m memory - the amount of allocated memory in MB - defaults to $DEFAULT_MEMORY MB"
echo " -v be verbose"
exit 1
}
echo " -v be verbose"
exit 1
}
@@
-880,7
+882,7
@@
function main () {
exit 1
fi
exit 1
fi
- while getopts "n:f:d:p:r:P:i:v" opt ; do
+ while getopts "n:f:d:p:r:P:i:
m:
v" opt ; do
case $opt in
n) GUEST_HOSTNAME=$OPTARG;;
f) fcdistro=$OPTARG;;
case $opt in
n) GUEST_HOSTNAME=$OPTARG;;
f) fcdistro=$OPTARG;;
@@
-889,6
+891,7
@@
function main () {
r) REPO_URL=$OPTARG;;
P) PREINSTALLED=$OPTARG;;
i) IMAGE=$OPTARG;;
r) REPO_URL=$OPTARG;;
P) PREINSTALLED=$OPTARG;;
i) IMAGE=$OPTARG;;
+ m) MEMORY=$OPTARG;;
v) VERBOSE=true; set -x;;
*) usage ;;
esac
v) VERBOSE=true; set -x;;
*) usage ;;
esac
@@
-926,6
+929,10
@@
function main () {
[ -z "$fcdistro" ] && fcdistro=$DEFAULT_FCDISTRO
[ -z "$pldistro" ] && pldistro=$DEFAULT_PLDISTRO
[ -z "$personality" ] && personality=$DEFAULT_PERSONALITY
[ -z "$fcdistro" ] && fcdistro=$DEFAULT_FCDISTRO
[ -z "$pldistro" ] && pldistro=$DEFAULT_PLDISTRO
[ -z "$personality" ] && personality=$DEFAULT_PERSONALITY
+ [ -z "$MEMORY" ] && MEMORY=$DEFAULT_MEMORY
+
+ # set memory in KB
+ MEMORY=$(($MEMORY * 1024))
# the set of preinstalled packages - depends on mode
if [ -z "$PREINSTALLED"] ; then
# the set of preinstalled packages - depends on mode
if [ -z "$PREINSTALLED"] ; then