Install enhanced networking drivers on HVM AMIs

This commit is contained in:
Anders Ingemann 2013-12-30 12:15:28 +01:00
parent 44f3296426
commit 4ef77f1b69

View file

@ -1,5 +1,6 @@
from base import Task
from common import phases
from common.tasks import apt
import os.path
@ -13,3 +14,41 @@ class EnableDHCPCDDNS(Task):
from common.tools import sed_i
dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
class AddBuildEssentialPackage(Task):
description = 'Adding build-essential package'
phase = phases.preparation
predecessors = [apt.AddDefaultSources]
def run(self, info):
info.packages.add('build-essential')
class InstallEnhancedNetworking(Task):
description = 'Installing network drivers for SR-IOV support'
phase = phases.package_installation
def run(self, 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')
import urllib
urllib.urlretrieve(drivers_url, archive)
from common.tools import log_check_call
log_check_call('/bin/tar', '--ungzip',
'--extract',
'--file', archive,
'--directory', os.path.join(info.root, 'tmp'))
src_dir = os.path.join('/tmp', os.path.basename(drivers_url), 'src')
log_check_call(['/usr/sbin/chroot', info.root,
'/usr/bin/make', '--directory', src_dir])
log_check_call(['/usr/sbin/chroot', info.root,
'/usr/bin/make', 'install',
'--directory', src_dir])
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')