Revision 685
Added by Borja Sotomayor over 14 years ago
trunk/doc/manual/opennebula.tex | ||
---|---|---|
48 | 48 |
haizea -c /usr/share/haizea/etc/sample_opennebula.conf |
49 | 49 |
\end{wideshellverbatim} |
50 | 50 |
|
51 |
The above assumes that you are running OpenNebula and Haizea in the same machine and with the same user. If this is not the case, you have to set the \texttt{ONE\_AUTH} environment variable (as described in the OpenNebula documentation) for the user and machine running Haizea. The variable must contain the username and password of the OpenNebula administrator user (typically called \texttt{oneadmin}) with the format \texttt{username:password}. |
|
51 |
The above assumes that you are running OpenNebula and Haizea in the same machine and with the same user. If this is not the case, you have to set the \texttt{ONE\_AUTH} environment variable (as described in the OpenNebula documentation) for the user and machine running Haizea. The variable must contain the path to a file containing the username and password of the OpenNebula administrator user (typically called \texttt{oneadmin}) with the format \texttt{username:password}.
|
|
52 | 52 |
|
53 | 53 |
By default, Haizea runs as a daemon when running in OpenNebula mode. For this chapter, you may want to run it in the foreground so you can see the Haizea log messages in your console: |
54 | 54 |
|
trunk/src/haizea/common/opennebula_xmlrpc.py | ||
---|---|---|
1 | 1 |
import xmlrpclib |
2 | 2 |
import os |
3 |
import os.path |
|
3 | 4 |
import hashlib |
4 | 5 |
|
5 | 6 |
try: |
... | ... | |
9 | 10 |
import elementtree.ElementTree as ET |
10 | 11 |
|
11 | 12 |
class OpenNebulaXMLRPCClient(object): |
13 |
|
|
14 |
DEFAULT_ONE_AUTH = "~/.one/one_auth" |
|
15 |
|
|
12 | 16 |
def __init__(self, host, port, user, password): |
13 | 17 |
uri = "http://%s:%i" % (host, port) |
14 | 18 |
self.rpc = xmlrpclib.ServerProxy(uri) |
... | ... | |
30 | 34 |
@staticmethod |
31 | 35 |
def get_userpass_from_env(): |
32 | 36 |
if not os.environ.has_key("ONE_AUTH"): |
33 |
return None
|
|
37 |
one_auth = OpenNebulaXMLRPCClient.DEFAULT_ONE_AUTH
|
|
34 | 38 |
else: |
35 |
auth = os.environ["ONE_AUTH"] |
|
36 |
user, passw = auth.split(":") |
|
39 |
one_auth = os.environ["ONE_AUTH"] |
|
40 |
|
|
41 |
one_auth = os.path.expanduser(one_auth) |
|
42 |
|
|
43 |
if not os.path.exists(one_auth): |
|
44 |
raise Exception("Authorization file %s does not exists" % one_auth) |
|
45 |
|
|
46 |
f = open(one_auth, "r") |
|
47 |
try: |
|
48 |
line = f.readline().strip() |
|
49 |
user, passw = line.split(":") |
|
37 | 50 |
return user, passw |
51 |
except: |
|
52 |
raise Exception("Authorization file is malformed") |
|
53 |
|
|
38 | 54 |
|
39 | 55 |
def hostpool_info(self): |
40 | 56 |
try: |
Also available in: Unified diff
Add support for new ONE_AUTH in OpenNebula (instead of containing a username and password, the environment variable points to a file with this information)