mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Add support for enhanced networking on EC2.
This change adds a provider option, enhanced_networking, which installs the Intel virtual networking driver for SR-IOV using DKMS. It also modifies the EC2 AMI registration to include support for SR-IOV.
This commit is contained in:
parent
09fdb44bf2
commit
4093693c2e
8 changed files with 76 additions and 17 deletions
|
@ -1,3 +1,6 @@
|
|||
2014-11-23:
|
||||
Noah Fontes:
|
||||
* Add support for enhanced networking on EC2 images
|
||||
2014-07-12:
|
||||
Tiago Ilieve:
|
||||
* Fixes #96: AddBackports is now a common task
|
||||
|
|
26
bootstrapvz/common/tasks/kernel.py
Normal file
26
bootstrapvz/common/tasks/kernel.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
from bootstrapvz.base import Task
|
||||
from .. import phases
|
||||
from ..tasks import packages
|
||||
|
||||
|
||||
class AddDKMSPackages(Task):
|
||||
description = 'Adding DKMS and kernel header packages'
|
||||
phase = phases.package_installation
|
||||
successors = [packages.InstallPackages]
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
info.packages.add('dkms')
|
||||
kernel_pkg_arch = {'i386': '686-pae', 'amd64': 'amd64'}[info.manifest.system['architecture']]
|
||||
info.packages.add('linux-headers-' + kernel_pkg_arch)
|
||||
|
||||
|
||||
class UpdateInitramfs(Task):
|
||||
description = 'Rebuilding initramfs'
|
||||
phase = phases.system_modification
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
from bootstrapvz.common.tools import log_check_call
|
||||
# Update initramfs (-u) for all currently installed kernel versions (-k all)
|
||||
log_check_call(['chroot', info.root, 'update-initramfs', '-u', '-k', 'all'])
|
|
@ -13,6 +13,7 @@ from bootstrapvz.common.tasks import filesystem
|
|||
from bootstrapvz.common.tasks import boot
|
||||
from bootstrapvz.common.tasks import initd
|
||||
from bootstrapvz.common.tasks import loopback
|
||||
from bootstrapvz.common.tasks import kernel
|
||||
|
||||
|
||||
def initialize():
|
||||
|
@ -41,6 +42,7 @@ def validate_manifest(data, validator, error):
|
|||
virtualization = data['provider']['virtualization']
|
||||
backing = data['volume']['backing']
|
||||
partition_type = data['volume']['partitions']['type']
|
||||
enhanced_networking = data['provider']['enhanced_networking'] if 'enhanced_networking' in data['provider'] else None
|
||||
|
||||
if virtualization == 'pvm' and bootloader != 'pvgrub':
|
||||
error('Paravirtualized AMIs only support pvgrub as a bootloader', ['system', 'bootloader'])
|
||||
|
@ -58,6 +60,10 @@ def validate_manifest(data, validator, error):
|
|||
if partition_type != 'none':
|
||||
error('S3 backed AMIs currently only work with unpartitioned volumes', ['system', 'bootloader'])
|
||||
|
||||
if enhanced_networking == 'simple':
|
||||
if virtualization != 'hvm':
|
||||
error('Enhanced networking currently only works with HVM virtualization', ['provider', 'virtualization'])
|
||||
|
||||
|
||||
def resolve_tasks(taskset, manifest):
|
||||
taskset.update(task_groups.get_standard_groups(manifest))
|
||||
|
@ -106,6 +112,11 @@ def resolve_tasks(taskset, manifest):
|
|||
])
|
||||
taskset.discard(filesystem.FStab)
|
||||
|
||||
if 'enhanced_networking' in manifest.provider and manifest.provider['enhanced_networking'] == 'simple':
|
||||
taskset.update([kernel.AddDKMSPackages,
|
||||
tasks.network.InstallEnhancedNetworking,
|
||||
kernel.UpdateInitramfs])
|
||||
|
||||
taskset.update([filesystem.Format,
|
||||
volume.Delete,
|
||||
])
|
||||
|
|
|
@ -19,6 +19,10 @@ properties:
|
|||
enum:
|
||||
- pvm
|
||||
- hvm
|
||||
enhanced_networking:
|
||||
enum:
|
||||
- none
|
||||
- simple
|
||||
required: [virtualization]
|
||||
system:
|
||||
type: object
|
||||
|
|
|
@ -122,4 +122,7 @@ class RegisterAMI(Task):
|
|||
registration_params['kernel_id'] = config_get(akis_path, [info._ec2['region'],
|
||||
info.manifest.system['architecture']])
|
||||
|
||||
if 'enhanced_networking' in info.manifest.provider and info.manifest.provider['enhanced_networking'] == 'simple':
|
||||
registration_params['sriov_net_support'] = 'simple'
|
||||
|
||||
info._ec2['image'] = info._ec2['connection'].register_image(**registration_params)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from bootstrapvz.base import Task
|
||||
from bootstrapvz.common import phases
|
||||
from bootstrapvz.common.tasks import apt
|
||||
from bootstrapvz.common.tasks import kernel
|
||||
import os.path
|
||||
|
||||
|
||||
|
@ -29,30 +30,39 @@ class AddBuildEssentialPackage(Task):
|
|||
|
||||
|
||||
class InstallEnhancedNetworking(Task):
|
||||
description = 'Installing network drivers for SR-IOV support'
|
||||
phase = phases.package_installation
|
||||
description = 'Installing enhanced networking kernel driver using DKMS'
|
||||
phase = phases.system_modification
|
||||
successors = [kernel.UpdateInitramfs]
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
drivers_url = 'http://downloads.sourceforge.net/project/e1000/ixgbevf stable/2.11.3/ixgbevf-2.11.3.tar.gz'
|
||||
archive = os.path.join(info.root, 'tmp', 'ixgbevf-2.11.3.tar.gz')
|
||||
version = '2.15.3'
|
||||
drivers_url = 'http://downloads.sourceforge.net/project/e1000/ixgbevf stable/%s/ixgbevf-%s.tar.gz' % (version, version)
|
||||
archive = os.path.join(info.root, 'tmp', 'ixgbevf-%s.tar.gz' % (version))
|
||||
module_path = os.path.join(info.root, 'usr', 'src', 'ixgbevf-%s' % (version))
|
||||
|
||||
import urllib
|
||||
urllib.urlretrieve(drivers_url, archive)
|
||||
|
||||
from bootstrapvz.common.tools import log_check_call
|
||||
log_check_call('tar', '--ungzip',
|
||||
'--extract',
|
||||
'--file', archive,
|
||||
'--directory', os.path.join(info.root, 'tmp'))
|
||||
log_check_call(['tar', '--ungzip',
|
||||
'--extract',
|
||||
'--file', archive,
|
||||
'--directory', os.path.join(info.root, 'usr', 'src')])
|
||||
|
||||
src_dir = os.path.join('/tmp', os.path.basename(drivers_url), 'src')
|
||||
log_check_call(['chroot', info.root,
|
||||
'make', '--directory', src_dir])
|
||||
log_check_call(['chroot', info.root,
|
||||
'make', 'install',
|
||||
'--directory', src_dir])
|
||||
with open(os.path.join(module_path, 'dkms.conf'), 'w') as dkms_conf:
|
||||
dkms_conf.write("""PACKAGE_NAME="ixgbevf"
|
||||
PACKAGE_VERSION="%s"
|
||||
CLEAN="cd src/; make clean"
|
||||
MAKE="cd src/; make BUILD_KERNEL=${kernelver}"
|
||||
BUILT_MODULE_LOCATION[0]="src/"
|
||||
BUILT_MODULE_NAME[0]="ixgbevf"
|
||||
DEST_MODULE_LOCATION[0]="/updates"
|
||||
DEST_MODULE_NAME[0]="ixgbevf"
|
||||
AUTOINSTALL="yes"
|
||||
""" % (version))
|
||||
|
||||
ixgbevf_conf_path = os.path.join(info.root, 'etc/modprobe.d/ixgbevf.conf')
|
||||
with open(ixgbevf_conf_path, 'w') as ixgbevf_conf:
|
||||
ixgbevf_conf.write('options ixgbevf InterruptThrottleRate=1,1,1,1,1,1,1,1')
|
||||
for task in ['add', 'build', 'install']:
|
||||
# Invoke DKMS task using specified kernel module (-m) and version (-v)
|
||||
log_check_call(['chroot', info.root,
|
||||
'dkms', task, '-m', 'ixgbevf', '-v', version])
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
provider:
|
||||
name: ec2
|
||||
virtualization: hvm
|
||||
enhanced_networking: simple
|
||||
# credentials:
|
||||
# access-key: AFAKEACCESSKEYFORAWS
|
||||
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
provider:
|
||||
name: ec2
|
||||
virtualization: hvm
|
||||
enhanced_networking: simple
|
||||
# credentials:
|
||||
# access-key: AFAKEACCESSKEYFORAWS
|
||||
# secret-key: thes3cr3tkeyf0ryourawsaccount/FS4d8Qdva
|
||||
|
|
Loading…
Add table
Reference in a new issue