merged trunk fixed whitespace in rst
This commit is contained in:
1
Authors
1
Authors
@@ -40,6 +40,7 @@ Nachi Ueno <ueno.nachi@lab.ntt.co.jp> <openstack@lab.ntt.co.jp> <nati.ueno@gmail
|
|||||||
Paul Voccio <paul@openstack.org>
|
Paul Voccio <paul@openstack.org>
|
||||||
Rick Clark <rick@openstack.org>
|
Rick Clark <rick@openstack.org>
|
||||||
Rick Harris <rconradharris@gmail.com>
|
Rick Harris <rconradharris@gmail.com>
|
||||||
|
Rob Kost <kost@isi.edu>
|
||||||
Ryan Lane <rlane@wikimedia.org>
|
Ryan Lane <rlane@wikimedia.org>
|
||||||
Ryan Lucio <rlucio@internap.com>
|
Ryan Lucio <rlucio@internap.com>
|
||||||
Salvatore Orlando <salvatore.orlando@eu.citrix.com>
|
Salvatore Orlando <salvatore.orlando@eu.citrix.com>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ graft CA
|
|||||||
graft doc
|
graft doc
|
||||||
graft smoketests
|
graft smoketests
|
||||||
graft tools
|
graft tools
|
||||||
|
graft etc
|
||||||
include nova/api/openstack/notes.txt
|
include nova/api/openstack/notes.txt
|
||||||
include nova/auth/novarc.template
|
include nova/auth/novarc.template
|
||||||
include nova/auth/slap.sh
|
include nova/auth/slap.sh
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ gettext.install('nova', unicode=1)
|
|||||||
|
|
||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
|
from nova import version
|
||||||
from nova import wsgi
|
from nova import wsgi
|
||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
@@ -79,6 +80,8 @@ def run_app(paste_config_file):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
FLAGS(sys.argv)
|
FLAGS(sys.argv)
|
||||||
|
LOG.audit(_("Starting nova-api node (version %s)"),
|
||||||
|
version.version_string_with_vcs())
|
||||||
conf = wsgi.paste_config_file('nova-api.conf')
|
conf = wsgi.paste_config_file('nova-api.conf')
|
||||||
if conf:
|
if conf:
|
||||||
run_app(conf)
|
run_app(conf)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ if __name__ == '__main__':
|
|||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
FLAGS(sys.argv)
|
FLAGS(sys.argv)
|
||||||
|
|
||||||
direct.register_service('compute', compute_api.ComputeAPI())
|
direct.register_service('compute', compute_api.API())
|
||||||
direct.register_service('reflect', direct.Reflection())
|
direct.register_service('reflect', direct.Reflection())
|
||||||
router = direct.Router()
|
router = direct.Router()
|
||||||
with_json = direct.JsonParamsMiddleware(router)
|
with_json = direct.JsonParamsMiddleware(router)
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ from nova import exception
|
|||||||
from nova import flags
|
from nova import flags
|
||||||
from nova import log as logging
|
from nova import log as logging
|
||||||
from nova import quota
|
from nova import quota
|
||||||
|
from nova import rpc
|
||||||
from nova import utils
|
from nova import utils
|
||||||
|
from nova.api.ec2.cloud import ec2_id_to_id
|
||||||
from nova.auth import manager
|
from nova.auth import manager
|
||||||
from nova.cloudpipe import pipelib
|
from nova.cloudpipe import pipelib
|
||||||
from nova.db import migration
|
from nova.db import migration
|
||||||
@@ -95,6 +97,16 @@ flags.DECLARE('vpn_start', 'nova.network.manager')
|
|||||||
flags.DECLARE('fixed_range_v6', 'nova.network.manager')
|
flags.DECLARE('fixed_range_v6', 'nova.network.manager')
|
||||||
|
|
||||||
|
|
||||||
|
def param2id(object_id):
|
||||||
|
"""Helper function to convert various id types to internal id.
|
||||||
|
args: [object_id], e.g. 'vol-0000000a' or 'volume-0000000a' or '10'
|
||||||
|
"""
|
||||||
|
if '-' in object_id:
|
||||||
|
return ec2_id_to_id(object_id)
|
||||||
|
else:
|
||||||
|
return int(object_id)
|
||||||
|
|
||||||
|
|
||||||
class VpnCommands(object):
|
class VpnCommands(object):
|
||||||
"""Class for managing VPNs."""
|
"""Class for managing VPNs."""
|
||||||
|
|
||||||
@@ -553,6 +565,46 @@ class DbCommands(object):
|
|||||||
print migration.db_version()
|
print migration.db_version()
|
||||||
|
|
||||||
|
|
||||||
|
class VolumeCommands(object):
|
||||||
|
"""Methods for dealing with a cloud in an odd state"""
|
||||||
|
|
||||||
|
def delete(self, volume_id):
|
||||||
|
"""Delete a volume, bypassing the check that it
|
||||||
|
must be available.
|
||||||
|
args: volume_id_id"""
|
||||||
|
ctxt = context.get_admin_context()
|
||||||
|
volume = db.volume_get(ctxt, param2id(volume_id))
|
||||||
|
host = volume['host']
|
||||||
|
if volume['status'] == 'in-use':
|
||||||
|
print "Volume is in-use."
|
||||||
|
print "Detach volume from instance and then try again."
|
||||||
|
return
|
||||||
|
|
||||||
|
rpc.cast(ctxt,
|
||||||
|
db.queue_get_for(ctxt, FLAGS.volume_topic, host),
|
||||||
|
{"method": "delete_volume",
|
||||||
|
"args": {"volume_id": volume['id']}})
|
||||||
|
|
||||||
|
def reattach(self, volume_id):
|
||||||
|
"""Re-attach a volume that has previously been attached
|
||||||
|
to an instance. Typically called after a compute host
|
||||||
|
has been rebooted.
|
||||||
|
args: volume_id_id"""
|
||||||
|
ctxt = context.get_admin_context()
|
||||||
|
volume = db.volume_get(ctxt, param2id(volume_id))
|
||||||
|
if not volume['instance_id']:
|
||||||
|
print "volume is not attached to an instance"
|
||||||
|
return
|
||||||
|
instance = db.instance_get(ctxt, volume['instance_id'])
|
||||||
|
host = instance['host']
|
||||||
|
rpc.cast(ctxt,
|
||||||
|
db.queue_get_for(ctxt, FLAGS.compute_topic, host),
|
||||||
|
{"method": "attach_volume",
|
||||||
|
"args": {"instance_id": instance['id'],
|
||||||
|
"volume_id": volume['id'],
|
||||||
|
"mountpoint": volume['mountpoint']}})
|
||||||
|
|
||||||
|
|
||||||
CATEGORIES = [
|
CATEGORIES = [
|
||||||
('user', UserCommands),
|
('user', UserCommands),
|
||||||
('project', ProjectCommands),
|
('project', ProjectCommands),
|
||||||
@@ -563,7 +615,8 @@ CATEGORIES = [
|
|||||||
('network', NetworkCommands),
|
('network', NetworkCommands),
|
||||||
('service', ServiceCommands),
|
('service', ServiceCommands),
|
||||||
('log', LogCommands),
|
('log', LogCommands),
|
||||||
('db', DbCommands)]
|
('db', DbCommands),
|
||||||
|
('volume', VolumeCommands)]
|
||||||
|
|
||||||
|
|
||||||
def lazy_match(name, key_value_tuples):
|
def lazy_match(name, key_value_tuples):
|
||||||
|
|||||||
10
bin/stack
10
bin/stack
@@ -22,6 +22,7 @@
|
|||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
@@ -38,7 +39,6 @@ if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
|
|||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
|
|
||||||
import gflags
|
import gflags
|
||||||
from nova import utils
|
|
||||||
|
|
||||||
|
|
||||||
FLAGS = gflags.FLAGS
|
FLAGS = gflags.FLAGS
|
||||||
@@ -106,8 +106,12 @@ def do_request(controller, method, params=None):
|
|||||||
'X-OpenStack-Project': FLAGS.project}
|
'X-OpenStack-Project': FLAGS.project}
|
||||||
|
|
||||||
req = urllib2.Request(url, data, headers)
|
req = urllib2.Request(url, data, headers)
|
||||||
resp = urllib2.urlopen(req)
|
try:
|
||||||
return utils.loads(resp.read())
|
resp = urllib2.urlopen(req)
|
||||||
|
except urllib2.HTTPError, e:
|
||||||
|
print e.read()
|
||||||
|
sys.exit(1)
|
||||||
|
return json.loads(resp.read())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ class DbDriver(object):
|
|||||||
for member_uid in member_uids:
|
for member_uid in member_uids:
|
||||||
member = db.user_get(context.get_admin_context(), member_uid)
|
member = db.user_get(context.get_admin_context(), member_uid)
|
||||||
if not member:
|
if not member:
|
||||||
raise exception.NotFound("Project can't be created "
|
raise exception.NotFound(_("Project can't be created "
|
||||||
"because user %s doesn't exist"
|
"because user %s doesn't exist")
|
||||||
% member_uid)
|
% member_uid)
|
||||||
members.add(member)
|
members.add(member)
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class LdapDriver(object):
|
|||||||
def create_user(self, name, access_key, secret_key, is_admin):
|
def create_user(self, name, access_key, secret_key, is_admin):
|
||||||
"""Create a user"""
|
"""Create a user"""
|
||||||
if self.__user_exists(name):
|
if self.__user_exists(name):
|
||||||
raise exception.Duplicate("LDAP user %s already exists" % name)
|
raise exception.Duplicate(_("LDAP user %s already exists") % name)
|
||||||
if FLAGS.ldap_user_modify_only:
|
if FLAGS.ldap_user_modify_only:
|
||||||
if self.__ldap_user_exists(name):
|
if self.__ldap_user_exists(name):
|
||||||
# Retrieve user by name
|
# Retrieve user by name
|
||||||
@@ -310,7 +310,7 @@ class LdapDriver(object):
|
|||||||
def delete_user(self, uid):
|
def delete_user(self, uid):
|
||||||
"""Delete a user"""
|
"""Delete a user"""
|
||||||
if not self.__user_exists(uid):
|
if not self.__user_exists(uid):
|
||||||
raise exception.NotFound("User %s doesn't exist" % uid)
|
raise exception.NotFound(_("User %s doesn't exist") % uid)
|
||||||
self.__remove_from_all(uid)
|
self.__remove_from_all(uid)
|
||||||
if FLAGS.ldap_user_modify_only:
|
if FLAGS.ldap_user_modify_only:
|
||||||
# Delete attributes
|
# Delete attributes
|
||||||
@@ -432,15 +432,15 @@ class LdapDriver(object):
|
|||||||
description, member_uids=None):
|
description, member_uids=None):
|
||||||
"""Create a group"""
|
"""Create a group"""
|
||||||
if self.__group_exists(group_dn):
|
if self.__group_exists(group_dn):
|
||||||
raise exception.Duplicate("Group can't be created because "
|
raise exception.Duplicate(_("Group can't be created because "
|
||||||
"group %s already exists" % name)
|
"group %s already exists") % name)
|
||||||
members = []
|
members = []
|
||||||
if member_uids is not None:
|
if member_uids is not None:
|
||||||
for member_uid in member_uids:
|
for member_uid in member_uids:
|
||||||
if not self.__user_exists(member_uid):
|
if not self.__user_exists(member_uid):
|
||||||
raise exception.NotFound("Group can't be created "
|
raise exception.NotFound(_("Group can't be created "
|
||||||
"because user %s doesn't exist" %
|
"because user %s doesn't exist")
|
||||||
member_uid)
|
% member_uid)
|
||||||
members.append(self.__uid_to_dn(member_uid))
|
members.append(self.__uid_to_dn(member_uid))
|
||||||
dn = self.__uid_to_dn(uid)
|
dn = self.__uid_to_dn(uid)
|
||||||
if not dn in members:
|
if not dn in members:
|
||||||
@@ -455,8 +455,8 @@ class LdapDriver(object):
|
|||||||
def __is_in_group(self, uid, group_dn):
|
def __is_in_group(self, uid, group_dn):
|
||||||
"""Check if user is in group"""
|
"""Check if user is in group"""
|
||||||
if not self.__user_exists(uid):
|
if not self.__user_exists(uid):
|
||||||
raise exception.NotFound("User %s can't be searched in group "
|
raise exception.NotFound(_("User %s can't be searched in group "
|
||||||
"because the user doesn't exist" % uid)
|
"because the user doesn't exist") % uid)
|
||||||
if not self.__group_exists(group_dn):
|
if not self.__group_exists(group_dn):
|
||||||
return False
|
return False
|
||||||
res = self.__find_object(group_dn,
|
res = self.__find_object(group_dn,
|
||||||
@@ -467,10 +467,10 @@ class LdapDriver(object):
|
|||||||
def __add_to_group(self, uid, group_dn):
|
def __add_to_group(self, uid, group_dn):
|
||||||
"""Add user to group"""
|
"""Add user to group"""
|
||||||
if not self.__user_exists(uid):
|
if not self.__user_exists(uid):
|
||||||
raise exception.NotFound("User %s can't be added to the group "
|
raise exception.NotFound(_("User %s can't be added to the group "
|
||||||
"because the user doesn't exist" % uid)
|
"because the user doesn't exist") % uid)
|
||||||
if not self.__group_exists(group_dn):
|
if not self.__group_exists(group_dn):
|
||||||
raise exception.NotFound("The group at dn %s doesn't exist" %
|
raise exception.NotFound(_("The group at dn %s doesn't exist") %
|
||||||
group_dn)
|
group_dn)
|
||||||
if self.__is_in_group(uid, group_dn):
|
if self.__is_in_group(uid, group_dn):
|
||||||
raise exception.Duplicate(_("User %s is already a member of "
|
raise exception.Duplicate(_("User %s is already a member of "
|
||||||
@@ -481,15 +481,15 @@ class LdapDriver(object):
|
|||||||
def __remove_from_group(self, uid, group_dn):
|
def __remove_from_group(self, uid, group_dn):
|
||||||
"""Remove user from group"""
|
"""Remove user from group"""
|
||||||
if not self.__group_exists(group_dn):
|
if not self.__group_exists(group_dn):
|
||||||
raise exception.NotFound("The group at dn %s doesn't exist" %
|
raise exception.NotFound(_("The group at dn %s doesn't exist")
|
||||||
group_dn)
|
% group_dn)
|
||||||
if not self.__user_exists(uid):
|
if not self.__user_exists(uid):
|
||||||
raise exception.NotFound("User %s can't be removed from the "
|
raise exception.NotFound(_("User %s can't be removed from the "
|
||||||
"group because the user doesn't exist" %
|
"group because the user doesn't exist")
|
||||||
uid)
|
% uid)
|
||||||
if not self.__is_in_group(uid, group_dn):
|
if not self.__is_in_group(uid, group_dn):
|
||||||
raise exception.NotFound("User %s is not a member of the group" %
|
raise exception.NotFound(_("User %s is not a member of the group")
|
||||||
uid)
|
% uid)
|
||||||
# NOTE(vish): remove user from group and any sub_groups
|
# NOTE(vish): remove user from group and any sub_groups
|
||||||
sub_dns = self.__find_group_dns_with_member(group_dn, uid)
|
sub_dns = self.__find_group_dns_with_member(group_dn, uid)
|
||||||
for sub_dn in sub_dns:
|
for sub_dn in sub_dns:
|
||||||
@@ -509,8 +509,9 @@ class LdapDriver(object):
|
|||||||
def __remove_from_all(self, uid):
|
def __remove_from_all(self, uid):
|
||||||
"""Remove user from all roles and projects"""
|
"""Remove user from all roles and projects"""
|
||||||
if not self.__user_exists(uid):
|
if not self.__user_exists(uid):
|
||||||
raise exception.NotFound("User %s can't be removed from all "
|
raise exception.NotFound(_("User %s can't be removed from all "
|
||||||
"because the user doesn't exist" % uid)
|
"because the user doesn't exist")
|
||||||
|
% uid)
|
||||||
role_dns = self.__find_group_dns_with_member(
|
role_dns = self.__find_group_dns_with_member(
|
||||||
FLAGS.role_project_subtree, uid)
|
FLAGS.role_project_subtree, uid)
|
||||||
for role_dn in role_dns:
|
for role_dn in role_dns:
|
||||||
|
|||||||
@@ -40,15 +40,15 @@ from nova import version
|
|||||||
FLAGS = flags.FLAGS
|
FLAGS = flags.FLAGS
|
||||||
|
|
||||||
flags.DEFINE_string('logging_context_format_string',
|
flags.DEFINE_string('logging_context_format_string',
|
||||||
'(%(name)s %(nova_version)s): %(levelname)s '
|
'%(asctime)s %(levelname)s %(name)s '
|
||||||
'[%(request_id)s %(user)s '
|
'[%(request_id)s %(user)s '
|
||||||
'%(project)s] %(message)s',
|
'%(project)s] %(message)s',
|
||||||
'format string to use for log messages')
|
'format string to use for log messages with context')
|
||||||
|
|
||||||
flags.DEFINE_string('logging_default_format_string',
|
flags.DEFINE_string('logging_default_format_string',
|
||||||
'(%(name)s %(nova_version)s): %(levelname)s [N/A] '
|
'%(asctime)s %(levelname)s %(name)s [-] '
|
||||||
'%(message)s',
|
'%(message)s',
|
||||||
'format string to use for log messages')
|
'format string to use for log messages without context')
|
||||||
|
|
||||||
flags.DEFINE_string('logging_debug_format_suffix',
|
flags.DEFINE_string('logging_debug_format_suffix',
|
||||||
'from %(processName)s (pid=%(process)d) %(funcName)s'
|
'from %(processName)s (pid=%(process)d) %(funcName)s'
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ def call(context, topic, msg):
|
|||||||
|
|
||||||
def cast(context, topic, msg):
|
def cast(context, topic, msg):
|
||||||
"""Sends a message on a topic without waiting for a response"""
|
"""Sends a message on a topic without waiting for a response"""
|
||||||
LOG.debug("Making asynchronous cast...")
|
LOG.debug(_("Making asynchronous cast..."))
|
||||||
_pack_context(msg, context)
|
_pack_context(msg, context)
|
||||||
conn = Connection.instance()
|
conn = Connection.instance()
|
||||||
publisher = TopicPublisher(connection=conn, topic=topic)
|
publisher = TopicPublisher(connection=conn, topic=topic)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class SimpleScheduler(chance.ChanceScheduler):
|
|||||||
service = db.service_get_by_args(context.elevated(), host,
|
service = db.service_get_by_args(context.elevated(), host,
|
||||||
'nova-compute')
|
'nova-compute')
|
||||||
if not self.service_is_up(service):
|
if not self.service_is_up(service):
|
||||||
raise driver.WillNotSchedule("Host %s is not alive" % host)
|
raise driver.WillNotSchedule(_("Host %s is not alive") % host)
|
||||||
|
|
||||||
# TODO(vish): this probably belongs in the manager, if we
|
# TODO(vish): this probably belongs in the manager, if we
|
||||||
# can generalize this somehow
|
# can generalize this somehow
|
||||||
@@ -80,7 +80,7 @@ class SimpleScheduler(chance.ChanceScheduler):
|
|||||||
service = db.service_get_by_args(context.elevated(), host,
|
service = db.service_get_by_args(context.elevated(), host,
|
||||||
'nova-volume')
|
'nova-volume')
|
||||||
if not self.service_is_up(service):
|
if not self.service_is_up(service):
|
||||||
raise driver.WillNotSchedule("Host %s not available" % host)
|
raise driver.WillNotSchedule(_("Host %s not available") % host)
|
||||||
|
|
||||||
# TODO(vish): this probably belongs in the manager, if we
|
# TODO(vish): this probably belongs in the manager, if we
|
||||||
# can generalize this somehow
|
# can generalize this somehow
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ def WrapTwistedOptions(wrapped):
|
|||||||
try:
|
try:
|
||||||
self.parseArgs(*argv)
|
self.parseArgs(*argv)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise usage.UsageError("Wrong number of arguments.")
|
raise usage.UsageError(_("Wrong number of arguments."))
|
||||||
|
|
||||||
self.postOptions()
|
self.postOptions()
|
||||||
return args
|
return args
|
||||||
@@ -220,7 +220,7 @@ def stop(pidfile):
|
|||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
except OSError, err:
|
except OSError, err:
|
||||||
err = str(err)
|
err = str(err)
|
||||||
if err.find("No such process") > 0:
|
if err.find(_("No such process")) > 0:
|
||||||
if os.path.exists(pidfile):
|
if os.path.exists(pidfile):
|
||||||
os.remove(pidfile)
|
os.remove(pidfile)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ class NovaTestRunner(core.TextTestRunner):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
c = config.Config(stream=sys.stdout,
|
c = config.Config(stream=sys.stdout,
|
||||||
env=os.environ,
|
env=os.environ,
|
||||||
verbosity=3)
|
verbosity=3,
|
||||||
|
plugins=core.DefaultPluginManager())
|
||||||
|
|
||||||
runner = NovaTestRunner(stream=c.stream,
|
runner = NovaTestRunner(stream=c.stream,
|
||||||
verbosity=c.verbosity,
|
verbosity=c.verbosity,
|
||||||
|
|||||||
Reference in New Issue
Block a user