summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorArmando Migliaccio <armando.migliaccio@citrix.com>2010-12-02 12:56:47 +0000
committerArmando Migliaccio <armando.migliaccio@citrix.com>2010-12-02 12:56:47 +0000
commitd9472dabe9f7f5c7993f23d4873fa9d3bec3e111 (patch)
tree17f4a8f0d20999779c5377b1dde04363e8d806f5 /nova
parentb684bc26fc7c7f41cf90e0294af35b2bda243733 (diff)
parentf8afbcc08b65d4d6764a6dc66c804816573ab3b4 (diff)
merge trunk
Diffstat (limited to 'nova')
-rw-r--r--nova/api/ec2/cloud.py7
-rw-r--r--nova/api/openstack/auth.py22
-rw-r--r--nova/api/openstack/faults.py2
-rw-r--r--nova/api/openstack/servers.py5
-rw-r--r--nova/auth/nova_openldap.schema84
-rw-r--r--nova/auth/nova_sun.schema16
-rw-r--r--nova/auth/openssh-lpk_openldap.schema19
-rw-r--r--nova/auth/openssh-lpk_sun.schema10
-rwxr-xr-xnova/auth/slap.sh112
-rw-r--r--nova/compute/manager.py8
-rw-r--r--nova/compute/monitor.py2
-rw-r--r--nova/crypto.py4
-rw-r--r--nova/db/sqlalchemy/api.py6
-rw-r--r--nova/db/sqlalchemy/models.py3
-rw-r--r--nova/flags.py35
-rw-r--r--nova/network/linux_net.py4
-rw-r--r--nova/objectstore/bucket.py2
-rw-r--r--nova/objectstore/image.py4
-rw-r--r--nova/tests/api/openstack/fakes.py1
-rw-r--r--nova/tests/api/openstack/test_api.py8
-rw-r--r--nova/tests/api/openstack/test_auth.py4
-rw-r--r--nova/tests/api/openstack/test_servers.py2
22 files changed, 210 insertions, 150 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 9327bf0d4..884372ce7 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -994,8 +994,11 @@ class CloudController(object):
return True
def describe_images(self, context, image_id=None, **kwargs):
- imageSet = self.image_service.index(context, image_id)
- return {'imagesSet': imageSet}
+ # Note: image_id is a list!
+ images = self.image_service.index(context)
+ if image_id:
+ images = filter(lambda x: x['imageId'] in image_id, images)
+ return {'imagesSet': images}
def deregister_image(self, context, image_id, **kwargs):
self.image_service.deregister(context, image_id)
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py
index ff428ff70..205035915 100644
--- a/nova/api/openstack/auth.py
+++ b/nova/api/openstack/auth.py
@@ -23,10 +23,7 @@ class Context(object):
class BasicApiAuthManager(object):
""" Implements a somewhat rudimentary version of OpenStack Auth"""
- def __init__(self, host=None, db_driver=None):
- if not host:
- host = FLAGS.host
- self.host = host
+ def __init__(self, db_driver=None):
if not db_driver:
db_driver = FLAGS.db_driver
self.db = utils.import_object(db_driver)
@@ -47,7 +44,7 @@ class BasicApiAuthManager(object):
except KeyError:
return faults.Fault(webob.exc.HTTPUnauthorized())
- token, user = self._authorize_user(username, key)
+ token, user = self._authorize_user(username, key, req)
if user and token:
res = webob.Response()
res.headers['X-Auth-Token'] = token.token_hash
@@ -82,8 +79,13 @@ class BasicApiAuthManager(object):
return {'id': user.id}
return None
- def _authorize_user(self, username, key):
- """ Generates a new token and assigns it to a user """
+ def _authorize_user(self, username, key, req):
+ """Generates a new token and assigns it to a user.
+
+ username - string
+ key - string API key
+ req - webob.Request object
+ """
user = self.auth.get_user_from_access_key(key)
if user and user.name == username:
token_hash = hashlib.sha1('%s%s%f' % (username, key,
@@ -91,12 +93,10 @@ class BasicApiAuthManager(object):
token_dict = {}
token_dict['token_hash'] = token_hash
token_dict['cdn_management_url'] = ''
- token_dict['server_management_url'] = self._get_server_mgmt_url()
+ # Same as auth url, e.g. http://foo.org:8774/baz/v1.0
+ token_dict['server_management_url'] = req.url
token_dict['storage_url'] = ''
token_dict['user_id'] = user.id
token = self.db.auth_create_token(self.context, token_dict)
return token, user
return None, None
-
- def _get_server_mgmt_url(self):
- return 'https://%s/v1.0/' % self.host
diff --git a/nova/api/openstack/faults.py b/nova/api/openstack/faults.py
index e69e51439..224a7ef0b 100644
--- a/nova/api/openstack/faults.py
+++ b/nova/api/openstack/faults.py
@@ -47,7 +47,7 @@ class Fault(webob.exc.HTTPException):
"""Generate a WSGI response based on the exception passed to ctor."""
# Replace the body with fault details.
code = self.wrapped_exc.status_int
- fault_name = self._fault_names.get(code, "cloudServersFault")
+ fault_name = self._fault_names.get(code, "computeFault")
fault_data = {
fault_name: {
'code': code,
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index 1d8aa2fa4..44e69b82c 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -63,7 +63,7 @@ def _entity_detail(inst):
inst_dict = {}
mapped_keys = dict(status='state', imageId='image_id',
- flavorId='instance_type', name='server_name', id='id')
+ flavorId='instance_type', name='display_name', id='id')
for k, v in mapped_keys.iteritems():
inst_dict[k] = inst[v]
@@ -78,7 +78,7 @@ def _entity_detail(inst):
def _entity_inst(inst):
""" Filters all model attributes save for id and name """
- return dict(server=dict(id=inst['id'], name=inst['server_name']))
+ return dict(server=dict(id=inst['id'], name=inst['display_name']))
class Controller(wsgi.Controller):
@@ -213,7 +213,6 @@ class Controller(wsgi.Controller):
if not image:
raise Exception("Image not found")
- inst['server_name'] = env['server']['name']
inst['image_id'] = image_id
inst['user_id'] = user_id
inst['launch_time'] = ltime
diff --git a/nova/auth/nova_openldap.schema b/nova/auth/nova_openldap.schema
new file mode 100644
index 000000000..4047361de
--- /dev/null
+++ b/nova/auth/nova_openldap.schema
@@ -0,0 +1,84 @@
+#
+# Person object for Nova
+# inetorgperson with extra attributes
+# Author: Vishvananda Ishaya <vishvananda@yahoo.com>
+#
+#
+
+# using internet experimental oid arc as per BP64 3.1
+objectidentifier novaSchema 1.3.6.1.3.1.666.666
+objectidentifier novaAttrs novaSchema:3
+objectidentifier novaOCs novaSchema:4
+
+attributetype (
+ novaAttrs:1
+ NAME 'accessKey'
+ DESC 'Key for accessing data'
+ EQUALITY caseIgnoreMatch
+ SUBSTR caseIgnoreSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ SINGLE-VALUE
+ )
+
+attributetype (
+ novaAttrs:2
+ NAME 'secretKey'
+ DESC 'Secret key'
+ EQUALITY caseIgnoreMatch
+ SUBSTR caseIgnoreSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ SINGLE-VALUE
+ )
+
+attributetype (
+ novaAttrs:3
+ NAME 'keyFingerprint'
+ DESC 'Fingerprint of private key'
+ EQUALITY caseIgnoreMatch
+ SUBSTR caseIgnoreSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+ SINGLE-VALUE
+ )
+
+attributetype (
+ novaAttrs:4
+ NAME 'isAdmin'
+ DESC 'Is user an administrator?'
+ EQUALITY booleanMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
+ SINGLE-VALUE
+ )
+
+attributetype (
+ novaAttrs:5
+ NAME 'projectManager'
+ DESC 'Project Managers of a project'
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
+ )
+
+objectClass (
+ novaOCs:1
+ NAME 'novaUser'
+ DESC 'access and secret keys'
+ AUXILIARY
+ MUST ( uid )
+ MAY ( accessKey $ secretKey $ isAdmin )
+ )
+
+objectClass (
+ novaOCs:2
+ NAME 'novaKeyPair'
+ DESC 'Key pair for User'
+ SUP top
+ STRUCTURAL
+ MUST ( cn $ sshPublicKey $ keyFingerprint )
+ )
+
+objectClass (
+ novaOCs:3
+ NAME 'novaProject'
+ DESC 'Container for project'
+ SUP groupOfNames
+ STRUCTURAL
+ MUST ( cn $ projectManager )
+ )
diff --git a/nova/auth/nova_sun.schema b/nova/auth/nova_sun.schema
new file mode 100644
index 000000000..e925e05e4
--- /dev/null
+++ b/nova/auth/nova_sun.schema
@@ -0,0 +1,16 @@
+#
+# Person object for Nova
+# inetorgperson with extra attributes
+# Author: Vishvananda Ishaya <vishvananda@yahoo.com>
+# Modified for strict RFC 4512 compatibility by: Ryan Lane <ryan@ryandlane.com>
+#
+# using internet experimental oid arc as per BP64 3.1
+dn: cn=schema
+attributeTypes: ( 1.3.6.1.3.1.666.666.3.1 NAME 'accessKey' DESC 'Key for accessing data' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
+attributeTypes: ( 1.3.6.1.3.1.666.666.3.2 NAME 'secretKey' DESC 'Secret key' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
+attributeTypes: ( 1.3.6.1.3.1.666.666.3.3 NAME 'keyFingerprint' DESC 'Fingerprint of private key' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE)
+attributeTypes: ( 1.3.6.1.3.1.666.666.3.4 NAME 'isAdmin' DESC 'Is user an administrator?' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
+attributeTypes: ( 1.3.6.1.3.1.666.666.3.5 NAME 'projectManager' DESC 'Project Managers of a project' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
+objectClasses: ( 1.3.6.1.3.1.666.666.4.1 NAME 'novaUser' DESC 'access and secret keys' SUP top AUXILIARY MUST ( uid ) MAY ( accessKey $ secretKey $ isAdmin ) )
+objectClasses: ( 1.3.6.1.3.1.666.666.4.2 NAME 'novaKeyPair' DESC 'Key pair for User' SUP top STRUCTURAL MUST ( cn $ sshPublicKey $ keyFingerprint ) )
+objectClasses: ( 1.3.6.1.3.1.666.666.4.3 NAME 'novaProject' DESC 'Container for project' SUP groupOfNames STRUCTURAL MUST ( cn $ projectManager ) )
diff --git a/nova/auth/openssh-lpk_openldap.schema b/nova/auth/openssh-lpk_openldap.schema
new file mode 100644
index 000000000..93351da6d
--- /dev/null
+++ b/nova/auth/openssh-lpk_openldap.schema
@@ -0,0 +1,19 @@
+#
+# LDAP Public Key Patch schema for use with openssh-ldappubkey
+# Author: Eric AUGE <eau@phear.org>
+#
+# Based on the proposal of : Mark Ruijter
+#
+
+
+# octetString SYNTAX
+attributetype ( 1.3.6.1.4.1.24552.500.1.1.1.13 NAME 'sshPublicKey'
+ DESC 'MANDATORY: OpenSSH Public key'
+ EQUALITY octetStringMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
+
+# printableString SYNTAX yes|no
+objectclass ( 1.3.6.1.4.1.24552.500.1.1.2.0 NAME 'ldapPublicKey' SUP top AUXILIARY
+ DESC 'MANDATORY: OpenSSH LPK objectclass'
+ MAY ( sshPublicKey $ uid )
+ )
diff --git a/nova/auth/openssh-lpk_sun.schema b/nova/auth/openssh-lpk_sun.schema
new file mode 100644
index 000000000..5f52db3b6
--- /dev/null
+++ b/nova/auth/openssh-lpk_sun.schema
@@ -0,0 +1,10 @@
+#
+# LDAP Public Key Patch schema for use with openssh-ldappubkey
+# Author: Eric AUGE <eau@phear.org>
+#
+# Schema for Sun Directory Server.
+# Based on the original schema, modified by Stefan Fischer.
+#
+dn: cn=schema
+attributeTypes: ( 1.3.6.1.4.1.24552.500.1.1.1.13 NAME 'sshPublicKey' DESC 'MANDATORY: OpenSSH Public key' EQUALITY octetStringMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
+objectClasses: ( 1.3.6.1.4.1.24552.500.1.1.2.0 NAME 'ldapPublicKey' SUP top AUXILIARY DESC 'MANDATORY: OpenSSH LPK objectclass' MAY ( sshPublicKey $ uid ) )
diff --git a/nova/auth/slap.sh b/nova/auth/slap.sh
index fdc0e39dc..797675d2e 100755
--- a/nova/auth/slap.sh
+++ b/nova/auth/slap.sh
@@ -20,115 +20,9 @@
apt-get install -y slapd ldap-utils python-ldap
-cat >/etc/ldap/schema/openssh-lpk_openldap.schema <<LPK_SCHEMA_EOF
-#
-# LDAP Public Key Patch schema for use with openssh-ldappubkey
-# Author: Eric AUGE <eau@phear.org>
-#
-# Based on the proposal of : Mark Ruijter
-#
-
-
-# octetString SYNTAX
-attributetype ( 1.3.6.1.4.1.24552.500.1.1.1.13 NAME 'sshPublicKey'
- DESC 'MANDATORY: OpenSSH Public key'
- EQUALITY octetStringMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )
-
-# printableString SYNTAX yes|no
-objectclass ( 1.3.6.1.4.1.24552.500.1.1.2.0 NAME 'ldapPublicKey' SUP top AUXILIARY
- DESC 'MANDATORY: OpenSSH LPK objectclass'
- MAY ( sshPublicKey $ uid )
- )
-LPK_SCHEMA_EOF
-
-cat >/etc/ldap/schema/nova.schema <<NOVA_SCHEMA_EOF
-#
-# Person object for Nova
-# inetorgperson with extra attributes
-# Author: Vishvananda Ishaya <vishvananda@yahoo.com>
-#
-#
-
-# using internet experimental oid arc as per BP64 3.1
-objectidentifier novaSchema 1.3.6.1.3.1.666.666
-objectidentifier novaAttrs novaSchema:3
-objectidentifier novaOCs novaSchema:4
-
-attributetype (
- novaAttrs:1
- NAME 'accessKey'
- DESC 'Key for accessing data'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
- SINGLE-VALUE
- )
-
-attributetype (
- novaAttrs:2
- NAME 'secretKey'
- DESC 'Secret key'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
- SINGLE-VALUE
- )
-
-attributetype (
- novaAttrs:3
- NAME 'keyFingerprint'
- DESC 'Fingerprint of private key'
- EQUALITY caseIgnoreMatch
- SUBSTR caseIgnoreSubstringsMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
- SINGLE-VALUE
- )
-
-attributetype (
- novaAttrs:4
- NAME 'isAdmin'
- DESC 'Is user an administrator?'
- EQUALITY booleanMatch
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
- SINGLE-VALUE
- )
-
-attributetype (
- novaAttrs:5
- NAME 'projectManager'
- DESC 'Project Managers of a project'
- SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
- )
-
-objectClass (
- novaOCs:1
- NAME 'novaUser'
- DESC 'access and secret keys'
- AUXILIARY
- MUST ( uid )
- MAY ( accessKey $ secretKey $ isAdmin )
- )
-
-objectClass (
- novaOCs:2
- NAME 'novaKeyPair'
- DESC 'Key pair for User'
- SUP top
- STRUCTURAL
- MUST ( cn $ sshPublicKey $ keyFingerprint )
- )
-
-objectClass (
- novaOCs:3
- NAME 'novaProject'
- DESC 'Container for project'
- SUP groupOfNames
- STRUCTURAL
- MUST ( cn $ projectManager )
- )
-
-NOVA_SCHEMA_EOF
+abspath=`dirname "$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"`
+cp $abspath/openssh-lpk_openldap.schema /etc/ldap/schema/openssh-lpk_openldap.schema
+cp $abspath/nova_openldap.schema /etc/ldap/schema/nova_openldap.schema
mv /etc/ldap/slapd.conf /etc/ldap/slapd.conf.orig
cat >/etc/ldap/slapd.conf <<SLAPD_CONF_EOF
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 890d79fba..e826bdaa2 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -47,7 +47,7 @@ from nova.compute import power_state
FLAGS = flags.FLAGS
-flags.DEFINE_string('instances_path', utils.abspath('../instances'),
+flags.DEFINE_string('instances_path', '$state_path/instances',
'where instances are stored on disk')
flags.DEFINE_string('compute_driver', 'nova.virt.connection.get_connection',
'Driver to use for volume creation')
@@ -101,6 +101,12 @@ class ComputeManager(manager.Manager):
"""
instance_ref = self.db.instance_create(context, kwargs)
inst_id = instance_ref['id']
+ # Set sane defaults if not specified
+ if 'display_name' not in kwargs:
+ display_name = "Server %s" % instance_ref['internal_id']
+ instance_ref['display_name'] = display_name
+ self.db.instance_update(context, inst_id,
+ {'display_name': display_name})
elevated = context.elevated()
if not security_groups:
diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py
index ce45b14f6..22653113a 100644
--- a/nova/compute/monitor.py
+++ b/nova/compute/monitor.py
@@ -46,7 +46,7 @@ flags.DEFINE_integer('monitoring_instances_delay', 5,
'Sleep time between updates')
flags.DEFINE_integer('monitoring_instances_step', 300,
'Interval of RRD updates')
-flags.DEFINE_string('monitoring_rrd_path', '/var/nova/monitor/instances',
+flags.DEFINE_string('monitoring_rrd_path', '$state_path/monitor/instances',
'Location of RRD files')
diff --git a/nova/crypto.py b/nova/crypto.py
index d73559587..aacc50b17 100644
--- a/nova/crypto.py
+++ b/nova/crypto.py
@@ -40,9 +40,9 @@ from nova import flags
FLAGS = flags.FLAGS
flags.DEFINE_string('ca_file', 'cacert.pem', 'Filename of root CA')
-flags.DEFINE_string('keys_path', utils.abspath('../keys'),
+flags.DEFINE_string('keys_path', '$state_path/keys',
'Where we keep our keys')
-flags.DEFINE_string('ca_path', utils.abspath('../CA'),
+flags.DEFINE_string('ca_path', '$state_path/CA',
'Where we keep our root CA')
flags.DEFINE_boolean('use_intermediate_ca', False,
'Should we use intermediate CAs for each project?')
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index afa55fc03..dd9649054 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -530,6 +530,12 @@ def fixed_ip_update(context, address, values):
#functions between the two of them as well.
@require_context
def instance_create(context, values):
+ """Create a new Instance record in the database.
+
+ context - request context object
+ values - dict containing column values.
+ 'internal_id' is auto-generated and should not be specified.
+ """
instance_ref = models.Instance()
instance_ref.update(values)
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 01b5cf350..fe0a9a921 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -178,8 +178,6 @@ class Instance(BASE, NovaBase):
kernel_id = Column(String(255))
ramdisk_id = Column(String(255))
- server_name = Column(String(255))
-
# image_id = Column(Integer, ForeignKey('images.id'), nullable=True)
# kernel_id = Column(Integer, ForeignKey('images.id'), nullable=True)
# ramdisk_id = Column(Integer, ForeignKey('images.id'), nullable=True)
@@ -212,6 +210,7 @@ class Instance(BASE, NovaBase):
launched_at = Column(DateTime)
terminated_at = Column(DateTime)
+ # User editable field for display in user-facing UIs
display_name = Column(String(255))
display_description = Column(String(255))
diff --git a/nova/flags.py b/nova/flags.py
index f7ae26050..1f94feb08 100644
--- a/nova/flags.py
+++ b/nova/flags.py
@@ -24,6 +24,7 @@ where they're used.
import getopt
import os
import socket
+import string
import sys
import gflags
@@ -38,11 +39,12 @@ class FlagValues(gflags.FlagValues):
"""
- def __init__(self):
+ def __init__(self, extra_context=None):
gflags.FlagValues.__init__(self)
self.__dict__['__dirty'] = []
self.__dict__['__was_already_parsed'] = False
self.__dict__['__stored_argv'] = []
+ self.__dict__['__extra_context'] = extra_context
def __call__(self, argv):
# We're doing some hacky stuff here so that we don't have to copy
@@ -112,7 +114,7 @@ class FlagValues(gflags.FlagValues):
def ParseNewFlags(self):
if '__stored_argv' not in self.__dict__:
return
- new_flags = FlagValues()
+ new_flags = FlagValues(self)
for k in self.__dict__['__dirty']:
new_flags[k] = gflags.FlagValues.__getitem__(self, k)
@@ -134,9 +136,29 @@ class FlagValues(gflags.FlagValues):
def __getattr__(self, name):
if self.IsDirty(name):
self.ParseNewFlags()
- return gflags.FlagValues.__getattr__(self, name)
+ val = gflags.FlagValues.__getattr__(self, name)
+ if type(val) is str:
+ tmpl = string.Template(val)
+ context = [self, self.__dict__['__extra_context']]
+ return tmpl.substitute(StrWrapper(context))
+ return val
+class StrWrapper(object):
+ """Wrapper around FlagValues objects
+
+ Wraps FlagValues objects for string.Template so that we're
+ sure to return strings."""
+ def __init__(self, context_objs):
+ self.context_objs = context_objs
+
+ def __getitem__(self, name):
+ for context in self.context_objs:
+ val = getattr(context, name, False)
+ if val:
+ return str(val)
+ raise KeyError(name)
+
FLAGS = FlagValues()
gflags.FLAGS = FLAGS
gflags.DEFINE_flag(gflags.HelpFlag(), FLAGS)
@@ -201,8 +223,6 @@ DEFINE_string('rabbit_virtual_host', '/', 'rabbit virtual host')
DEFINE_integer('rabbit_retry_interval', 10, 'rabbit connection retry interval')
DEFINE_integer('rabbit_max_retries', 12, 'rabbit connection attempts')
DEFINE_string('control_exchange', 'nova', 'the main exchange to connect to')
-DEFINE_string('cc_host', '127.0.0.1', 'ip of api server')
-DEFINE_integer('cc_port', 8773, 'cloud controller port')
DEFINE_string('ec2_url', 'http://127.0.0.1:8773/services/Cloud',
'Url to ec2 api server')
@@ -222,8 +242,11 @@ DEFINE_string('vpn_key_suffix',
DEFINE_integer('auth_token_ttl', 3600, 'Seconds for auth tokens to linger')
+DEFINE_string('state_path', os.path.join(os.path.dirname(__file__), '../'),
+ "Top-level directory for maintaining nova's state")
+
DEFINE_string('sql_connection',
- 'sqlite:///%s/nova.sqlite' % os.path.abspath("./"),
+ 'sqlite:///$state_path/nova.sqlite',
'connection string for sql database')
DEFINE_string('compute_manager', 'nova.compute.manager.ComputeManager',
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 391abfb76..0fefd9415 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -38,7 +38,7 @@ flags.DEFINE_string('dhcpbridge_flagfile',
'/etc/nova/nova-dhcpbridge.conf',
'location of flagfile for dhcpbridge')
-flags.DEFINE_string('networks_path', utils.abspath('../networks'),
+flags.DEFINE_string('networks_path', '$state_path/networks',
'Location to keep network config files')
flags.DEFINE_string('public_interface', 'vlan1',
'Interface for public IP addresses')
@@ -46,6 +46,8 @@ flags.DEFINE_string('vlan_interface', 'eth0',
'network device for vlans')
flags.DEFINE_string('dhcpbridge', _bin_file('nova-dhcpbridge'),
'location of nova-dhcpbridge')
+flags.DEFINE_string('cc_host', utils.get_my_ip(), 'ip of api server')
+flags.DEFINE_integer('cc_port', 8773, 'cloud controller port')
flags.DEFINE_string('routing_source_ip', '127.0.0.1',
'Public IP of network host')
flags.DEFINE_bool('use_nova_chains', False,
diff --git a/nova/objectstore/bucket.py b/nova/objectstore/bucket.py
index 697982538..82767e52f 100644
--- a/nova/objectstore/bucket.py
+++ b/nova/objectstore/bucket.py
@@ -33,7 +33,7 @@ from nova.objectstore import stored
FLAGS = flags.FLAGS
-flags.DEFINE_string('buckets_path', utils.abspath('../buckets'),
+flags.DEFINE_string('buckets_path', '$state_path/buckets',
'path to s3 buckets')
diff --git a/nova/objectstore/image.py b/nova/objectstore/image.py
index 4554444fa..7292dbab8 100644
--- a/nova/objectstore/image.py
+++ b/nova/objectstore/image.py
@@ -39,8 +39,8 @@ from nova.objectstore import bucket
FLAGS = flags.FLAGS
-flags.DEFINE_string('images_path', utils.abspath('../images'),
- 'path to decrypted images')
+flags.DEFINE_string('images_path', '$state_path/images',
+ 'path to decrypted images')
class Image(object):
diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py
index 639a2ebe4..6e91ca7bb 100644
--- a/nova/tests/api/openstack/fakes.py
+++ b/nova/tests/api/openstack/fakes.py
@@ -54,7 +54,6 @@ def fake_auth_init(self):
self.db = FakeAuthDatabase()
self.context = Context()
self.auth = FakeAuthManager()
- self.host = 'foo'
@webob.dec.wsgify
diff --git a/nova/tests/api/openstack/test_api.py b/nova/tests/api/openstack/test_api.py
index dd83991b9..d8b202e21 100644
--- a/nova/tests/api/openstack/test_api.py
+++ b/nova/tests/api/openstack/test_api.py
@@ -50,12 +50,12 @@ class APITest(unittest.TestCase):
api.application = succeed
resp = Request.blank('/').get_response(api)
- self.assertFalse('cloudServersFault' in resp.body, resp.body)
+ self.assertFalse('computeFault' in resp.body, resp.body)
self.assertEqual(resp.status_int, 200, resp.body)
api.application = raise_webob_exc
resp = Request.blank('/').get_response(api)
- self.assertFalse('cloudServersFault' in resp.body, resp.body)
+ self.assertFalse('computeFault' in resp.body, resp.body)
self.assertEqual(resp.status_int, 404, resp.body)
api.application = raise_api_fault
@@ -65,10 +65,10 @@ class APITest(unittest.TestCase):
api.application = fail
resp = Request.blank('/').get_response(api)
- self.assertTrue('{"cloudServersFault' in resp.body, resp.body)
+ self.assertTrue('{"computeFault' in resp.body, resp.body)
self.assertEqual(resp.status_int, 500, resp.body)
api.application = fail
resp = Request.blank('/.xml').get_response(api)
- self.assertTrue('<cloudServersFault' in resp.body, resp.body)
+ self.assertTrue('<computeFault' in resp.body, resp.body)
self.assertEqual(resp.status_int, 500, resp.body)
diff --git a/nova/tests/api/openstack/test_auth.py b/nova/tests/api/openstack/test_auth.py
index 29f4b8874..14e720be4 100644
--- a/nova/tests/api/openstack/test_auth.py
+++ b/nova/tests/api/openstack/test_auth.py
@@ -62,14 +62,14 @@ class Test(unittest.TestCase):
f = fakes.FakeAuthManager()
f.add_user('derp', nova.auth.manager.User(1, 'herp', None, None, None))
- req = webob.Request.blank('/v1.0/')
+ req = webob.Request.blank('/v1.0/', {'HTTP_HOST': 'foo'})
req.headers['X-Auth-User'] = 'herp'
req.headers['X-Auth-Key'] = 'derp'
result = req.get_response(nova.api.API('os'))
self.assertEqual(result.status, '204 No Content')
self.assertEqual(len(result.headers['X-Auth-Token']), 40)
self.assertEqual(result.headers['X-Server-Management-Url'],
- "https://foo/v1.0/")
+ "http://foo/v1.0/")
self.assertEqual(result.headers['X-CDN-Management-Url'],
"")
self.assertEqual(result.headers['X-Storage-Url'], "")
diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py
index 8cfc6c45a..530d06760 100644
--- a/nova/tests/api/openstack/test_servers.py
+++ b/nova/tests/api/openstack/test_servers.py
@@ -44,7 +44,7 @@ def return_servers(context, user_id=1):
def stub_instance(id, user_id=1):
- return Instance(id=id, state=0, image_id=10, server_name='server%s' % id,
+ return Instance(id=id, state=0, image_id=10, display_name='server%s' % id,
user_id=user_id)