Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Véron
slapos.core
Commits
6522e6f7
Commit
6522e6f7
authored
Jun 01, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'no_bridge'
Conflicts: slapos/grid/SlapObject.py
parents
d41f6522
0c37c785
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
19 deletions
+24
-19
CHANGES.txt
CHANGES.txt
+3
-1
slapos/format.py
slapos/format.py
+21
-18
No files found.
CHANGES.txt
View file @
6522e6f7
...
...
@@ -4,7 +4,9 @@ Changes
0.26 (Unreleased)
-----------------
* No change yet.
* slapformat: no_bridge option becomes 'not create_tap'.
create_tap is true by default. So a bridge is used and tap will be created by
default. [Cedric de Saint Martin]
0.25 (2012-05-16)
-----------------
...
...
slapos/format.py
View file @
6522e6f7
...
...
@@ -179,7 +179,7 @@ class Computer(object):
def
__getinitargs__
(
self
):
return
(
self
.
reference
,
self
.
interface
)
def
getAddress
(
self
):
def
getAddress
(
self
,
allow_tap
=
False
):
"""
Return a list of the interface address not attributed to any partition, (which
are therefore free for the computer itself).
...
...
@@ -201,12 +201,16 @@ class Computer(object):
if
address_dict
[
'addr'
]
not
in
computer_partition_address_list
:
return
address_dict
if
allow_tap
:
# all addresses on interface are for partition, so lets add new one
computer_tap
=
Tap
(
'compdummy'
)
computer_tap
.
createWithOwner
(
User
(
'root'
),
attach_to_tap
=
True
)
self
.
interface
.
addTap
(
computer_tap
)
return
self
.
interface
.
addAddr
()
# Can't find address
return
False
def
send
(
self
,
config
):
"""
Send a marshalled dictionary of the computer object serialized via_getDict.
...
...
@@ -851,10 +855,6 @@ class Parser(OptionParser):
help
=
"Don't actually do anything."
,
default
=
False
,
action
=
"store_true"
),
Option
(
"-b"
,
"--no_bridge"
,
help
=
"Don't use bridge but use real interface like eth0."
,
default
=
False
,
action
=
"store_true"
),
Option
(
"-v"
,
"--verbose"
,
default
=
False
,
action
=
"store_true"
,
...
...
@@ -979,7 +979,7 @@ def run(config):
computer
.
instance_root
=
config
.
instance_root
computer
.
software_root
=
config
.
software_root
config
.
logger
.
info
(
'Updating computer'
)
address
=
computer
.
getAddress
()
address
=
computer
.
getAddress
(
config
.
create_tap
)
computer
.
address
=
address
[
'addr'
]
computer
.
netmask
=
address
[
'netmask'
]
...
...
@@ -1006,7 +1006,7 @@ def run(config):
computer_definition
.
write
(
open
(
filepath
,
'w'
))
config
.
logger
.
info
(
'Stored computer definition in %r'
%
filepath
)
computer
.
construct
(
alter_user
=
config
.
alter_user
,
alter_network
=
config
.
alter_network
,
create_tap
=
not
config
.
no_bridge
)
alter_network
=
config
.
alter_network
,
create_tap
=
config
.
create_tap
)
# Dumping and sending to the erp5 the current configuration
if
not
config
.
dry_run
:
...
...
@@ -1020,6 +1020,7 @@ class Config(object):
cert_file
=
None
alter_network
=
None
alter_user
=
None
create_tap
=
None
computer_xml
=
None
logger
=
None
log_file
=
None
...
...
@@ -1080,6 +1081,8 @@ class Config(object):
self
.
alter_user
=
'True'
if
self
.
software_user
is
None
:
self
.
software_user
=
'slapsoft'
if
self
.
create_tap
is
None
:
self
.
create_tap
=
True
# set up logging
self
.
logger
=
logging
.
getLogger
(
"slapformat"
)
...
...
@@ -1088,7 +1091,7 @@ class Config(object):
self
.
logger
.
addHandler
(
logging
.
StreamHandler
())
# Convert strings to booleans
for
o
in
[
'alter_network'
,
'alter_user'
,
'
no_bridge
'
]:
for
o
in
[
'alter_network'
,
'alter_user'
,
'
create_tap
'
]:
attr
=
getattr
(
self
,
o
)
if
isinstance
(
attr
,
str
):
if
attr
.
lower
()
==
'true'
:
...
...
@@ -1105,12 +1108,12 @@ class Config(object):
if
not
self
.
dry_run
:
if
self
.
alter_user
:
self
.
checkRequiredBinary
([
'groupadd'
,
'useradd'
,
'usermod'
])
if
not
self
.
no_bridge
:
if
self
.
create_tap
:
self
.
checkRequiredBinary
([
'tunctl'
])
if
self
.
alter_network
:
self
.
checkRequiredBinary
([
'ip'
])
# Required, even for dry run
if
self
.
alter_network
and
not
self
.
no_bridge
:
if
self
.
alter_network
and
self
.
create_tap
:
self
.
checkRequiredBinary
([
'brctl'
])
# Check if root is needed
...
...
@@ -1149,8 +1152,8 @@ class Config(object):
self
.
logger
.
debug
(
"Verbose mode enabled."
)
if
self
.
dry_run
:
self
.
logger
.
info
(
"Dry-run mode enabled."
)
if
self
.
no_bridge
:
self
.
logger
.
info
(
"
No-bridge
mode enabled."
)
if
self
.
create_tap
:
self
.
logger
.
info
(
"
Tap
mode enabled."
)
# Calculate path once
self
.
computer_xml
=
os
.
path
.
abspath
(
self
.
computer_xml
)
...
...
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