Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
snf-image
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
snf-image
Commits
7d8c80c9
Commit
7d8c80c9
authored
Sep 28, 2016
by
Yiannis Tsiouris
Committed by
GitHub
Sep 28, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #86 from skalkoto/develop
Add support for Network Manager
parents
7538331f
fc552789
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
123 additions
and
6 deletions
+123
-6
docs/interface.rst
docs/interface.rst
+6
-0
snf-image-helper/common.sh.in
snf-image-helper/common.sh.in
+20
-0
snf-image-helper/networking/Makefile.am
snf-image-helper/networking/Makefile.am
+1
-1
snf-image-helper/networking/ifcfg.sh.in
snf-image-helper/networking/ifcfg.sh.in
+0
-0
snf-image-helper/networking/ifupdown.sh.in
snf-image-helper/networking/ifupdown.sh.in
+0
-0
snf-image-helper/networking/nm.sh.in
snf-image-helper/networking/nm.sh.in
+86
-0
snf-image-helper/tasks/50ConfigureNetwork.in
snf-image-helper/tasks/50ConfigureNetwork.in
+10
-5
No files found.
docs/interface.rst
View file @
7d8c80c9
...
...
@@ -228,6 +228,12 @@ All image formats properties
you want to write a custom configuration task check
:ref:`Configuration Tasks Environment<configuration-tasks-environment>`.
* **NM_NETWORKING=bool**
If this property is defined with a yes value, the *ConfigureNetwork* task
will try to configure the Ganeti-provided NICs by creating Network Manager
configuration files, instead of using the distro-specific network
configuration mechanism (*ifupdown* for Debian, *ifcfg* for Red Hat, etc.).
* **EXCLUDE_ALL_TASKS=bool**
If this property is defined with a yes value, the image will not be
configured at all, during the deployment. This is really handy because it
...
...
snf-image-helper/common.sh.in
View file @
7d8c80c9
...
...
@@ -290,6 +290,26 @@ get_distro() {
fi
}
get_networking_tool() {
local root_dir distro tool
root_dir=$1
if check_yes_no SNF_IMAGE_PROPERTY_NM_NETWORKING; then
tool="nm"
else
distro=$(get_base_distro "$root_dir")
if [ "$distro" = debian ]; then
tool=ifupdown
elif [ "$distro" = redhat ]; then
tool=ifcfg
else
tool=$distro
fi
fi
echo "@networkingdir@/$tool.sh"
}
get_partition_table() {
local dev output
dev="$1"
...
...
snf-image-helper/networking/Makefile.am
View file @
7d8c80c9
networkingdir
=
$(libdir)
/
$(PACKAGE)
/networking
dist_networking_SCRIPTS
=
debian.sh redhat.sh freebsd.sh openbsd.sh netbsd
.sh
dist_networking_SCRIPTS
=
ifupdown.sh ifcfg.sh freebsd.sh openbsd.sh netbsd.sh nm
.sh
edit
=
sed
\
-e
's|@sysconfdir[@]|
$(sysconfdir)
|g'
\
...
...
snf-image-helper/networking/
redhat
.sh.in
→
snf-image-helper/networking/
ifcfg
.sh.in
View file @
7d8c80c9
File moved
snf-image-helper/networking/
debia
n.sh.in
→
snf-image-helper/networking/
ifupdow
n.sh.in
View file @
7d8c80c9
File moved
snf-image-helper/networking/nm.sh.in
0 → 100644
View file @
7d8c80c9
#! /bin/bash
# Copyright (C) 2016 GRNET S.A.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# Script for configuring network manager connections
set
-e
.
"@commondir@/common.sh"
networking_opts
"
$@
"
SYSTEM_CONNECTIONS
=
"
$SNF_IMAGE_TARGET
/etc/NetworkManager/system-connections/"
if
[
"
$initialize
"
=
yes
]
;
then
exit
0
fi
if
[
"
$finalize
"
=
yes
]
;
then
exit
0
fi
if
[
"
$ipv4
"
=
"none"
]
;
then
ipv4_section+
=
"method=disabled"
elif
[
"
$ipv4
"
=
"dhcp"
]
;
then
ipv4_section+
=
"method=auto"
else
ipv4_section+
=
"method=manual
address1=
$IP
/
${
SUBNET
##*/
}
"
if
[
-n
"
$GATEWAY
"
]
;
then
ipv4_section+
=
",
$GATEWAY
"
fi
fi
if
[
"
$ipv6
"
!=
'none'
]
;
then
ipv6_section
=
"method=auto"
else
ipv6_section
=
"method=disabled"
fi
connection
=
"
$SYSTEM_CONNECTIONS
/Wired connection
$index
"
cat
>
"
$connection
"
<<
EOF
[connection]
id=Wired connection
$index
uuid=
$(
cat
/proc/sys/kernel/random/uuid
)
type=ethernet
autoconnect=true
[ethernet]
mac-address=
$MAC
mac-address-blacklist=
[ipv4]
dns-search=
$ipv4_section
[ipv6]
addr-gen-mode=eui64
dns-search=
ip6-privacy=0
$ipv6_section
EOF
# For security, the 'keyfile' plugin that will read the connection files found
# under /etc/NetworkManager/system-connections will ignore files that are
# readable or writeable by any user or group other than 'root' since private
# keys and passphrases may be stored in plaintext inside the file.
chown
0:0
"
$connection
"
chmod
600
"
$connection
"
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
snf-image-helper/tasks/50ConfigureNetwork.in
View file @
7d8c80c9
...
...
@@ -42,17 +42,20 @@ fi
# Check if the image overwrites the task
check_if_overwritten
distro
=
$(
get_base_distro
"
$SNF_IMAGE_TARGET
"
)
networking_tool
=
$(
get_networking_tool
"
$SNF_IMAGE_TARGET
"
)
if
[
!
-f
"
@networkingdir@/
$distro
.sh
"
]
;
then
if
[
!
-f
"
$networking_tool
"
]
;
then
warn
"Don't know how to configure the network for this OS"
exit
0
else
echo
"Using
$networking_tool
"
fi
export
SNF_IMAGE_TARGET
# Initialize the driver
"@networkingdir@/
$distro
.sh"
-i
echo
"Running:
$networking_tool
-i"
"
$networking_tool
"
-i
for
index
in
$(
seq
0
$((
SNF_IMAGE_NIC_COUNT-1
))
)
;
do
dhcp
=
no
...
...
@@ -129,12 +132,14 @@ for index in $(seq 0 $((SNF_IMAGE_NIC_COUNT-1))); do
fi
fi
"@networkingdir@/
$distro
.sh"
$ARGS
echo
"Running:
$networking_tool
$ARGS
"
"
$networking_tool
"
$ARGS
done
# Finalize the driver
"@networkingdir@/
$distro
.sh"
-f
echo
"Running:
$networking_tool
-f"
"
$networking_tool
"
-f
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment