Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-ganeti
Commits
02f99608
Commit
02f99608
authored
16 years ago
by
Oleksiy Mishchenko
Browse files
Options
Downloads
Patches
Plain Diff
Fix for gnt-cluster init.
Reviewed-by: iustinp
parent
e69d05fd
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/bootstrap.py
+37
-2
37 additions, 2 deletions
lib/bootstrap.py
lib/ssconf.py
+11
-1
11 additions, 1 deletion
lib/ssconf.py
with
48 additions
and
3 deletions
lib/bootstrap.py
+
37
−
2
View file @
02f99608
...
...
@@ -229,9 +229,9 @@ def InitCluster(cluster_name, hypervisor_type, mac_prefix, def_bridge,
master_node_config
=
objects
.
Node
(
name
=
hostname
.
name
,
primary_ip
=
hostname
.
ip
,
secondary_ip
=
secondary_ip
)
cfg
=
config
.
ConfigWriter
()
cfg
.
InitConfig
(
constants
.
CONFIG_VERSION
,
cluster_config
,
master_node_config
)
cfg
=
InitConfig
(
constants
.
CONFIG_VERSION
,
cluster_config
,
master_node_config
)
ssh
.
WriteKnownHostsFile
(
cfg
,
constants
.
SSH_KNOWN_HOSTS_FILE
)
# start the master ip
...
...
@@ -239,6 +239,41 @@ def InitCluster(cluster_name, hypervisor_type, mac_prefix, def_bridge,
rpc
.
call_node_start_master
(
hostname
.
name
,
True
)
def
InitConfig
(
version
,
cluster_config
,
master_node_config
,
cfg_file
=
constants
.
CLUSTER_CONF_FILE
):
"""
Create the initial cluster configuration.
It will contain the current node, which will also be the master
node, and no instances.
@type version: int
@param version: Configuration version
@type cluster_config: objects.Cluster
@param cluster_config: Cluster configuration
@type master_node_config: objects.Node
@param master_node_config: Master node configuration
@type file_name: string
@param file_name: Configuration file path
@rtype: ssconf.SimpleConfigWriter
@returns: Initialized config instance
"""
nodes
=
{
master_node_config
.
name
:
master_node_config
,
}
config_data
=
objects
.
ConfigData
(
version
=
version
,
cluster
=
cluster_config
,
nodes
=
nodes
,
instances
=
{},
serial_no
=
1
)
cfg
=
ssconf
.
SimpleConfigWriter
.
FromDict
(
config_data
.
ToDict
(),
cfg_file
)
cfg
.
Save
()
return
cfg
def
FinalizeClusterDestroy
(
master
):
"""
Execute the last steps of cluster destroy
...
...
This diff is collapsed.
Click to expand it.
lib/ssconf.py
+
11
−
1
View file @
02f99608
...
...
@@ -35,7 +35,7 @@ from ganeti import utils
from
ganeti
import
serializer
class
SimpleConfigReader
:
class
SimpleConfigReader
(
object
)
:
"""
Simple class to read configuration file.
"""
...
...
@@ -74,6 +74,16 @@ class SimpleConfigReader:
def
GetNodeList
(
self
):
return
self
.
_config_data
[
"
nodes
"
].
keys
()
@classmethod
def
FromDict
(
cls
,
val
,
cfg_file
=
constants
.
CLUSTER_CONF_FILE
):
"""
Alternative construction from a dictionary.
"""
obj
=
SimpleConfigReader
.
__new__
(
cls
)
obj
.
_config_data
=
val
obj
.
_file_name
=
cfg_file
return
obj
class
SimpleConfigWriter
(
SimpleConfigReader
):
"""
Simple class to write configuration file.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment