diff options
| author | Ewan Mellor <ewan.mellor@citrix.com> | 2010-07-25 20:32:33 +0100 |
|---|---|---|
| committer | Ewan Mellor <ewan.mellor@citrix.com> | 2010-07-25 20:32:33 +0100 |
| commit | c5edaa2186add12947185cb1fd47e0a48eccafa9 (patch) | |
| tree | 5801e206126b1fc71de42fbecdb03c730268c3f6 /nova | |
| parent | 6d636cd416d4a0f8a778ea9cb04c41de6299714e (diff) | |
| download | nova-c5edaa2186add12947185cb1fd47e0a48eccafa9.tar.gz nova-c5edaa2186add12947185cb1fd47e0a48eccafa9.tar.xz nova-c5edaa2186add12947185cb1fd47e0a48eccafa9.zip | |
Replace hardcoded example URL, username, and password with flags called
xenapi_connection_url, xenapi_connection_username, xenapi_connection_password.
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/virt/xenapi.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/nova/virt/xenapi.py b/nova/virt/xenapi.py index 58fcd79c5..dc372e3e3 100644 --- a/nova/virt/xenapi.py +++ b/nova/virt/xenapi.py @@ -30,6 +30,17 @@ from nova.compute import power_state XenAPI = None +FLAGS = flags.FLAGS +flags.DEFINE_string('xenapi_connection_url', + None, + 'URL for connection to XenServer/Xen Cloud Platform. Required if connection_type=xenapi.') +flags.DEFINE_string('xenapi_connection_username', + 'root', + 'Username for connection to XenServer/Xen Cloud Platform. Used only if connection_type=xenapi.') +flags.DEFINE_string('xenapi_connection_password', + None, + 'Password for connection to XenServer/Xen Cloud Platform. Used only if connection_type=xenapi.') + def get_connection(_): """Note that XenAPI doesn't have a read-only connection mode, so @@ -37,10 +48,14 @@ def get_connection(_): # This is loaded late so that there's no need to install this # library when not using XenAPI. global XenAPI - if XenAPI is not None: + if XenAPI is None: XenAPI = __import__('XenAPI') - return XenAPIConnection('http://eli.testdev.hq.xensource.com', - 'root', 'xensource') + url = FLAGS.xenapi_connection_url + username = FLAGS.xenapi_connection_username + password = FLAGS.xenapi_connection_password + if not url or password is None: + raise Exception('Must specify xenapi_connection_url, xenapi_connection_username (optionally), and xenapi_connection_password to use connection_type=xenapi') + return XenAPIConnection(url, username, password) class XenAPIConnection(object): |
