Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
slapos
Commits
b5cb205a
Commit
b5cb205a
authored
Dec 06, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup : do not fetch parameters from inside functions
parent
b93fc69e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
slapos/recipe/kvm/__init__.py
slapos/recipe/kvm/__init__.py
+6
-5
No files found.
slapos/recipe/kvm/__init__.py
View file @
b5cb205a
...
@@ -74,7 +74,9 @@ class Recipe(BaseSlapRecipe):
...
@@ -74,7 +74,9 @@ class Recipe(BaseSlapRecipe):
check_port_listening_script
=
check_port_listening_script
,
check_port_listening_script
=
check_port_listening_script
,
)
)
kvm_conf
=
self
.
installKvm
(
vnc_ip
=
self
.
getLocalIPv4Address
())
kvm_conf
=
self
.
installKvm
(
vnc_ip
=
self
.
getLocalIPv4Address
(),
nbd_ip
=
self
.
parameter_dict
[
'nbd_ip'
],
nbd_port
=
self
.
parameter_dict
[
'nbd_port'
])
vnc_port
=
Recipe
.
VNC_BASE_PORT
+
kvm_conf
[
'vnc_display'
]
vnc_port
=
Recipe
.
VNC_BASE_PORT
+
kvm_conf
[
'vnc_display'
]
...
@@ -94,7 +96,7 @@ class Recipe(BaseSlapRecipe):
...
@@ -94,7 +96,7 @@ class Recipe(BaseSlapRecipe):
return
self
.
path_list
return
self
.
path_list
def
installKvm
(
self
,
vnc_ip
):
def
installKvm
(
self
,
vnc_ip
,
nbd_ip
,
nbd_port
):
"""
"""
Create kvm configuration dictionnary and instanciate a wrapper for kvm and
Create kvm configuration dictionnary and instanciate a wrapper for kvm and
kvm controller
kvm controller
...
@@ -140,9 +142,8 @@ class Recipe(BaseSlapRecipe):
...
@@ -140,9 +142,8 @@ class Recipe(BaseSlapRecipe):
if
retcode
!=
0
:
if
retcode
!=
0
:
raise
OSError
,
"Disk creation failed!"
raise
OSError
,
"Disk creation failed!"
# Options nbd_ip and nbd_port are provided by slapos master
kvm_conf
[
'nbd_ip'
]
=
nbd_ip
kvm_conf
[
'nbd_ip'
]
=
self
.
parameter_dict
[
'nbd_ip'
]
kvm_conf
[
'nbd_port'
]
=
nbd_port
kvm_conf
[
'nbd_port'
]
=
self
.
parameter_dict
[
'nbd_port'
]
# First octet has to represent a locally administered address
# First octet has to represent a locally administered address
octet_list
=
[
254
]
+
[
random
.
randint
(
0x00
,
0xff
)
for
x
in
range
(
5
)]
octet_list
=
[
254
]
+
[
random
.
randint
(
0x00
,
0xff
)
for
x
in
range
(
5
)]
...
...
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