2013-09-22 15:41:43 +02:00
|
|
|
from base import Task
|
|
|
|
from common import phases
|
2013-12-30 12:15:28 +01:00
|
|
|
from common.tasks import apt
|
2013-09-22 15:41:43 +02:00
|
|
|
import os.path
|
|
|
|
|
|
|
|
|
|
|
|
class EnableDHCPCDDNS(Task):
|
|
|
|
description = 'Configuring the DHCP client to set the nameservers'
|
|
|
|
phase = phases.system_modification
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-09-22 15:41:43 +02:00
|
|
|
# The dhcp client that ships with debian sets the DNS servers per default.
|
|
|
|
# For dhcpcd we need to configure it to do that.
|
|
|
|
from common.tools import sed_i
|
|
|
|
dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
|
|
|
|
sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
|
2013-12-30 12:15:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
class AddBuildEssentialPackage(Task):
|
|
|
|
description = 'Adding build-essential package'
|
|
|
|
phase = phases.preparation
|
|
|
|
predecessors = [apt.AddDefaultSources]
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-12-30 12:15:28 +01:00
|
|
|
info.packages.add('build-essential')
|
|
|
|
|
|
|
|
|
|
|
|
class InstallEnhancedNetworking(Task):
|
|
|
|
description = 'Installing network drivers for SR-IOV support'
|
|
|
|
phase = phases.package_installation
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-12-30 12:15:28 +01:00
|
|
|
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
|
2014-02-23 22:16:10 +01:00
|
|
|
log_check_call('tar', '--ungzip',
|
|
|
|
'--extract',
|
|
|
|
'--file', archive,
|
|
|
|
'--directory', os.path.join(info.root, 'tmp'))
|
2013-12-30 12:15:28 +01:00
|
|
|
|
|
|
|
src_dir = os.path.join('/tmp', os.path.basename(drivers_url), 'src')
|
2014-02-23 22:16:10 +01:00
|
|
|
log_check_call(['chroot', info.root,
|
|
|
|
'make', '--directory', src_dir])
|
|
|
|
log_check_call(['chroot', info.root,
|
|
|
|
'make', 'install',
|
|
|
|
'--directory', src_dir])
|
2013-12-30 12:15:28 +01:00
|
|
|
|
|
|
|
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')
|