select version for amzn-driver

This commit is contained in:
Carlos Meza 2018-01-31 20:25:15 -08:00
parent 71ba58327c
commit 0e199f8ec1
3 changed files with 40 additions and 3 deletions

View file

@ -124,6 +124,28 @@ Example:
virtualization: hvm
enhanced_networking: simple
Amazon Drivers
~~~~~~~~~~~~~~
Define the version for the Amazon Elastic Network
Adapter (ENA) driver.
Read more about this on the `Amazon Drivers git repo`__.
__ https://github.com/amzn/amzn-drivers
- ``amzn-driver-version``: Default: master
Valid values: ``master``, ``#.#.#``
``optional``
Example:
.. code-block:: yaml
---
provider:
name: ec2
amzn-driver-version: 1.5.0
Image
~~~~~

View file

@ -24,6 +24,9 @@ properties:
enum:
- none
- simple
amzn-driver-version:
type: string
pattern: "^([0-9]+\\.?){3}$"
required: [description, virtualization]
system:
type: object

View file

@ -135,13 +135,25 @@ class InstallENANetworking(Task):
@classmethod
def run(cls, info):
version = '1.0.0'
drivers_url = 'https://github.com/amzn/amzn-drivers'
version = info.manifest.provider.get('amzn-driver-version', 'master')
if version != 'master':
version = 'ena_linux_' + version
drivers_url = 'https://codeload.github.com/amzn/amzn-drivers/tar.gz/' + version
module_path = os.path.join(info.root, 'usr', 'src',
'amzn-drivers-%s' % (version))
archive = os.path.join(info.root, 'tmp', 'amzn-drivers-%s.tar.gz' % (version))
import urllib
urllib.urlretrieve(drivers_url, archive)
from bootstrapvz.common.tools import log_check_call
log_check_call(['git', 'clone', drivers_url, module_path])
log_check_call(['tar', '--ungzip',
'--extract',
'--file', archive,
'--directory', os.path.join(info.root, 'usr',
'src')])
with open(os.path.join(module_path, 'dkms.conf'), 'w') as dkms_conf:
dkms_conf.write("""PACKAGE_NAME="ena"