Skip to content

Commit 46caef4

Browse files
authored
Merge pull request #134 from trozet/add_java_opts
Adds ability to pass Java options to ODL startup
2 parents 262374b + aebd403 commit 46caef4

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

README.markdown

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ Specifies the mode to use for security groups.
377377

378378
Default: `stateful`
379379

380-
Valid options: `transparent`, `learn`, `statless`
380+
Valid options: `transparent`, `learn`, `stateless`
381381

382382
##### `vpp_routing_node`
383383

@@ -388,6 +388,14 @@ Default: `''`
388388

389389
Valid options: A valid host name to a VPP node handling routing.
390390

391+
##### `java_opts`
392+
393+
Specifies the Java options to run ODL with as a string.
394+
395+
Default: `'-Djava.net.preferIPv4Stack=true'`
396+
397+
Valid options: A string of valid Java options.
398+
391399
## Limitations
392400

393401
- Tested on Fedora 22, 23, CentOS 7 and Ubuntu 14.04.

manifests/init.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
# Sets the mode to use for security groups (stateful, learn, stateless, transparent)
3737
# [*vpp_routing_node*]
3838
# Sets routing node for VPP deployments. Defaults to ''.
39+
# [*java_opts*]
40+
# Sets Java options for ODL in a string format. Defaults to '-Djava.net.preferIPv4Stack=true'.
3941
#
4042
class opendaylight (
4143
$default_features = $::opendaylight::params::default_features,
@@ -52,6 +54,7 @@
5254
$ha_node_index = $::opendaylight::params::ha_node_index,
5355
$security_group_mode = $::opendaylight::params::security_group_mode,
5456
$vpp_routing_node = $::opendaylight::params::vpp_routing_node,
57+
$java_opts = $::opendaylight::params::java_opts,
5558
) inherits ::opendaylight::params {
5659

5760
# Validate OS family

manifests/install.pp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
require => Yumrepo[$opendaylight::rpm_repo],
3030
}
3131
->
32-
# Configure the systemd file to force ipv4 binds (instead of ipv6)
33-
file_line { 'odl_start_ipv4':
32+
# Configure the systemd file with Java options
33+
file_line { 'java_options_systemd':
3434
ensure => present,
3535
path => '/usr/lib/systemd/system/opendaylight.service',
36-
line => 'Environment=_JAVA_OPTIONS=\'-Djava.net.preferIPv4Stack=true\'',
36+
line => "Environment=_JAVA_OPTIONS=\'${opendaylight::java_opts}\'",
37+
match => '^Environment.*',
3738
after => 'ExecStart=/opt/opendaylight/bin/start',
3839
}
3940
->

manifests/params.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
$ha_node_index = 0
2323
$security_group_mode = 'stateful'
2424
$vpp_routing_node = ''
25+
$java_opts = '-Djava.net.preferIPv4Stack=true'
2526
}

spec/spec_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ def tarball_install_tests(options = {})
347347
def rpm_install_tests(options = {})
348348
# Extract params
349349
rpm_repo = options.fetch(:rpm_repo, 'opendaylight-5-testing')
350+
java_opts = options.fetch(:java_opts, '-Djava.net.preferIPv4Stack=true')
350351

351352
# Default to CentOS 7 Yum repo URL
352353

@@ -376,10 +377,10 @@ def rpm_install_tests(options = {})
376377
}
377378

378379
it {
379-
should contain_file_line('odl_start_ipv4').with(
380+
should contain_file_line('java_options_systemd').with(
380381
'ensure' => 'present',
381382
'path' => '/usr/lib/systemd/system/opendaylight.service',
382-
'line' => 'Environment=_JAVA_OPTIONS=\'-Djava.net.preferIPv4Stack=true\'',
383+
'line' => "Environment=_JAVA_OPTIONS=\'#{java_opts}\'",
383384
'after' => 'ExecStart=/opt/opendaylight/bin/start',
384385
)
385386
}

0 commit comments

Comments
 (0)