Update KVM

Closes-Bug:#1507878
Change-Id: Ib6cd914df0b7a2f5f5069a1abf09eaf90e6b8559
Signed-off-by: lingyu1 <ling.y.yu@intel.com>
This commit is contained in:
lingyu1 2015-12-10 01:50:36 +08:00
parent 48a509d98d
commit 33a4c9632d
6 changed files with 140 additions and 40 deletions

View File

@ -1,40 +1,50 @@
$fuel_settings = parseyaml(file('/etc/compute.yaml'))
$qemu_version = "1:2.4+dfsg-4ubuntu1"
if $operatingsystem == 'Ubuntu' {
package { 'qemu-block-extra':
ensure => "${qemu_version}",
}
package { 'qemu-utils':
ensure => "${qemu_version}",
}
package { 'qemu-system-common':
ensure => "${qemu_version}",
}
package { 'qemu-system-arm':
ensure => "${qemu_version}",
}
package { 'qemu-system-mips':
ensure => "${qemu_version}",
}
package { 'qemu-system-misc':
ensure => "${qemu_version}",
}
package { 'qemu-system-sparc':
ensure => "${qemu_version}",
}
package { 'qemu-system-x86':
ensure => "${qemu_version}",
}
package { 'qemu-system-ppc':
ensure => "${qemu_version}",
}
package { 'qemu-user':
ensure => "${qemu_version}",
}
package { 'qemu-system':
ensure => "${qemu_version}",
}
package { 'qemu':
ensure => "${qemu_version}",
if $fuel_settings['fuel-plugin-qemu']['use_kvm'] {
package { 'linux-headers-4.1.10-rt10nfv':
ensure => "1.0.OPNFV",
}
package { 'linux-image-4.1.10-rt10nfv':
ensure => "1.0.OPNFV",
}
} else {
package { 'qemu-block-extra':
ensure => "${qemu_version}",
}
package { 'qemu-utils':
ensure => "${qemu_version}",
}
package { 'qemu-system-common':
ensure => "${qemu_version}",
}
package { 'qemu-system-arm':
ensure => "${qemu_version}",
}
package { 'qemu-system-mips':
ensure => "${qemu_version}",
}
package { 'qemu-system-misc':
ensure => "${qemu_version}",
}
package { 'qemu-system-sparc':
ensure => "${qemu_version}",
}
package { 'qemu-system-x86':
ensure => "${qemu_version}",
}
package { 'qemu-system-ppc':
ensure => "${qemu_version}",
}
package { 'qemu-user':
ensure => "${qemu_version}",
}
package { 'qemu-system':
ensure => "${qemu_version}",
}
package { 'qemu':
ensure => "${qemu_version}",
}
}
} elsif $operatingsystem == 'CentOS' {
}

View File

@ -1,6 +1,6 @@
attributes:
metadata:
enabled: false
label: fuel-plugin-qemu
toggleable: true
weight: 70
use_kvm:
type: "checkbox"
weight: 20
value: false
label: "EXPERIMENTAL: KVM enhancements for NFV"

12
kvm/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
FROM ubuntu:14.04.3
RUN apt-get update
RUN apt-get install -y git fakeroot build-essential ncurses-dev xz-utils kernel-package bc
RUN echo "ALL ALL=NOPASSWD: ALL" > /etc/sudoers.d/open-sudo
RUN chmod 0440 /etc/sudoers.d/open-sudo
ADD ./build_kvm.sh /root/build_kvm.sh
RUN chmod +x /root/build_kvm.sh
RUN /root/build_kvm.sh

67
kvm/build_kvm.sh Executable file
View File

@ -0,0 +1,67 @@
#!/bin/bash
COMMIT="6d8b230"
if [ x$1 = x-c ]
then
COMMIT=$2
shift;shift
fi
SRC=${1:-/root}
CONFIG=${2:-arch/x86/configs/opnfv.config}
VERSION=${3:-1.0.OPNFV}
# Check for necessary build tools
if ! type git >/dev/null 2>/dev/null
then
echo "Build tools missing, run the command
apt-get install git fakeroot build-essential ncurses-dev xz-utils kernel-package
as root and try again"
exit 1
fi
# Make sure the source dir exists
if [ ! -d $SRC ]
then
echo "$SRC: no such directory"
exit 1
fi
(
cd $SRC
# Get the KVM for NFV kernel sources
if [ ! -d kvmfornfv ]
then
git clone https://gerrit.opnfv.org/gerrit/kvmfornfv
fi
cd kvmfornfv
git pull
if [ x$COMMIT != x ]
then
git checkout $COMMIT
else
git reset --hard
fi
cd kernel
# Workaround build bug on Ubuntu 14.04
cat <<EOF > arch/x86/boot/install.sh
#!/bin/sh
cp -a -- "\$2" "\$4/vmlinuz-\$1"
EOF
# Configure the kernel
cp $CONFIG .config
make oldconfig </dev/null
# Build the kernel deb's
make-kpkg clean
fakeroot make-kpkg --initrd --revision=$VERSION kernel_image kernel_headers
git checkout arch/x86/boot/install.sh
)
mv $SRC/kvmfornfv/*.deb .

View File

@ -35,6 +35,11 @@ function build_pkg {
sudo docker cp $container_id:/qemu-system-ppc_2.4+dfsg-4ubuntu1_amd64.deb ${DIR}/repositories/ubuntu/
sudo docker cp $container_id:/qemu-system-sparc_2.4+dfsg-4ubuntu1_amd64.deb ${DIR}/repositories/ubuntu/
sudo docker cp $container_id:/qemu-system-x86_2.4+dfsg-4ubuntu1_amd64.deb ${DIR}/repositories/ubuntu/
cd ${DIR}/kvm
sudo docker build -t kvm .
container_id=`sudo docker run -d kvm`
sudo docker cp $container_id:/linux-headers-4.1.10-rt10nfv_1.0.OPNFV_amd64.deb ${DIR}/repositories/ubuntu/
sudo docker cp $container_id:/linux-image-4.1.10-rt10nfv_1.0.OPNFV_amd64.deb ${DIR}/repositories/ubuntu/
;;
*) echo "Not supported system"; exit 1;;
esac

View File

@ -6,3 +6,9 @@
puppet_manifest: puppet/manifests/qemu-install.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: reboot
role: ['compute']
stage: pre_deployment
type: reboot
parameters:
timeout: 300