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
b122534a
Commit
b122534a
authored
Apr 05, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hack to dramatically speed up slapformat.
First add all IPs, then think if it was right.
parent
29dab6d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
slapos/format.py
slapos/format.py
+25
-0
No files found.
slapos/format.py
View file @
b122534a
...
@@ -386,6 +386,22 @@ class Computer(object):
...
@@ -386,6 +386,22 @@ class Computer(object):
os
.
chown
(
self
.
software_root
,
slapsoft_pw
.
pw_uid
,
slapsoft_pw
.
pw_gid
)
os
.
chown
(
self
.
software_root
,
slapsoft_pw
.
pw_uid
,
slapsoft_pw
.
pw_gid
)
os
.
chmod
(
self
.
software_root
,
0755
)
os
.
chmod
(
self
.
software_root
,
0755
)
# Speed hack:
# Blindly add all IPs from existing configuration, just to speed up actual
# computer configuration later on.
for
partition
in
self
.
partition_list
:
try
:
for
address
in
partition
.
address_list
:
try
:
netmask
=
netmaskToPrefixIPv6
(
address
[
'netmask'
])
except
:
continue
callAndRead
([
'ip'
,
'addr'
,
'add'
,
'%s/%s'
%
(
address
[
'addr'
],
netmask
),
'dev'
,
self
.
interface
.
name
])
except
ValueError
:
pass
try
:
try
:
for
partition_index
,
partition
in
enumerate
(
self
.
partition_list
):
for
partition_index
,
partition
in
enumerate
(
self
.
partition_list
):
# Reconstructing User's
# Reconstructing User's
...
@@ -1096,6 +1112,15 @@ def run(config):
...
@@ -1096,6 +1112,15 @@ def run(config):
if
config
.
output_definition_file
:
if
config
.
output_definition_file
:
write_computer_definition
(
config
,
computer
)
write_computer_definition
(
config
,
computer
)
# Add all IPs from existing configuration, just to speed up actual
# computer configuration later on.
for
partition
in
computer
.
partition_list
:
partition
.
interface
.
addIPv4LocalAddress
()
for
address_dict
in
partition
.
interface
.
getGlobalScopeAddressList
():
callAndRead
([
'ip'
,
'addr'
,
'add'
,
'%s/%s'
%
(
address_dict
[
'addr'
],
address_dict
[
'netmask'
]),
'dev'
,
partition
.
interface
.
name
])
computer
.
construct
(
alter_user
=
config
.
alter_user
,
computer
.
construct
(
alter_user
=
config
.
alter_user
,
alter_network
=
config
.
alter_network
,
alter_network
=
config
.
alter_network
,
create_tap
=
config
.
create_tap
)
create_tap
=
config
.
create_tap
)
...
...
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