Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
026ec94a
Commit
026ec94a
authored
Jul 27, 2012
by
Christos Stavrakakis
Browse files
Get cluster name from Ganeti
Query Ganeti for getting the cluster name, instead of reading the ssconf files.
parent
d4c1275a
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-gtools/synnefo/ganeti/eventd.py
View file @
026ec94a
...
...
@@ -59,6 +59,7 @@ from ganeti import utils
from
ganeti
import
jqueue
from
ganeti
import
constants
from
ganeti
import
serializer
from
ganeti.cli
import
GetClient
from
synnefo
import
settings
from
synnefo.lib.amqp
import
AMQPClient
...
...
@@ -260,12 +261,15 @@ class JobFileHandler(pyinotify.ProcessEvent):
def
find_cluster_name
():
path
=
constants
.
DATA_DIR
+
"/ssconf_"
+
constants
.
SS_CLUSTER_NAME
f
=
open
(
path
)
name
=
f
.
readline
().
rstrip
()
f
.
close
()
global
handler_logger
try
:
cl
=
GetClient
()
name
=
cl
.
QueryClusterInfo
()[
'name'
]
except
Exception
as
e
:
handler_logger
.
error
(
'Can not get the name of the Cluster: %s'
%
e
)
raise
e
return
name
handler_logger
=
None
...
...
@@ -348,7 +352,9 @@ def main():
wm
=
pyinotify
.
WatchManager
()
mask
=
pyinotify
.
EventsCodes
.
ALL_FLAGS
[
"IN_MOVED_TO"
]
|
\
pyinotify
.
EventsCodes
.
ALL_FLAGS
[
"IN_CLOSE_WRITE"
]
cluster_name
=
find_cluster_name
()
handler
=
JobFileHandler
(
logger
,
cluster_name
)
notifier
=
pyinotify
.
Notifier
(
wm
,
handler
)
...
...
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