summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorEd Leafe <ed@leafe.com>2011-01-21 16:10:26 -0500
committerEd Leafe <ed@leafe.com>2011-01-21 16:10:26 -0500
commit09188c61d5359750f9deadcf912f0fa5fbf005b7 (patch)
tree53006dc213fc28f8c74179516f109c93603f429a /nova
parent75f93d83be59a85b63a267dc22458a133c591f8e (diff)
parentec60562b1a6d18e6df4024870468c0501dc692f9 (diff)
Resolved trunk merge conflicts
Diffstat (limited to 'nova')
-rw-r--r--nova/api/direct.py12
-rw-r--r--nova/api/ec2/cloud.py4
-rw-r--r--nova/auth/dbdriver.py4
-rw-r--r--nova/auth/ldapdriver.py43
-rw-r--r--nova/compute/api.py7
-rw-r--r--nova/console/manager.py2
-rw-r--r--nova/console/xvp.py14
-rw-r--r--nova/db/sqlalchemy/api.py3
-rw-r--r--nova/log.py8
-rw-r--r--nova/network/manager.py2
-rw-r--r--nova/objectstore/handler.py4
-rw-r--r--nova/objectstore/image.py13
-rw-r--r--nova/rpc.py2
-rw-r--r--nova/scheduler/simple.py4
-rw-r--r--nova/service.py4
-rw-r--r--nova/twistd.py4
-rw-r--r--nova/virt/libvirt_conn.py5
-rw-r--r--nova/volume/driver.py33
-rw-r--r--nova/volume/manager.py40
-rw-r--r--nova/wsgi.py2
20 files changed, 136 insertions, 74 deletions
diff --git a/nova/api/direct.py b/nova/api/direct.py
index 81b3ae202..208b6d086 100644
--- a/nova/api/direct.py
+++ b/nova/api/direct.py
@@ -142,9 +142,15 @@ class Reflection(object):
if argspec[2]:
args_out.insert(0, ('**%s' % argspec[2],))
+ if f.__doc__:
+ short_doc = f.__doc__.split('\n')[0]
+ doc = f.__doc__
+ else:
+ short_doc = doc = _('not available')
+
methods['/%s/%s' % (route, k)] = {
- 'short_doc': f.__doc__.split('\n')[0],
- 'doc': f.__doc__,
+ 'short_doc': short_doc,
+ 'doc': doc,
'name': k,
'args': list(reversed(args_out))}
@@ -196,6 +202,8 @@ class ServiceWrapper(wsgi.Controller):
# TODO(termie): do some basic normalization on methods
method = getattr(self.service_handle, action)
+ # NOTE(vish): make sure we have no unicode keys for py2.6.
+ params = dict([(str(k), v) for (k, v) in params.iteritems()])
result = method(context, **params)
if type(result) is dict or type(result) is list:
return self._serialize(result, req)
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 05976afb9..264b9127c 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -59,7 +59,7 @@ def _gen_key(context, user_id, key_name):
# creation before creating key_pair
try:
db.key_pair_get(context, user_id, key_name)
- raise exception.Duplicate("The key_pair %s already exists"
+ raise exception.Duplicate(_("The key_pair %s already exists")
% key_name)
except exception.NotFound:
pass
@@ -133,7 +133,7 @@ class CloudController(object):
return result
def _get_availability_zone_by_host(self, context, host):
- services = db.service_get_all_by_host(context, host)
+ services = db.service_get_all_by_host(context.elevated(), host)
if len(services) > 0:
return services[0]['availability_zone']
return 'unknown zone'
diff --git a/nova/auth/dbdriver.py b/nova/auth/dbdriver.py
index 0eb6fe588..d8dad8edd 100644
--- a/nova/auth/dbdriver.py
+++ b/nova/auth/dbdriver.py
@@ -119,8 +119,8 @@ class DbDriver(object):
for member_uid in member_uids:
member = db.user_get(context.get_admin_context(), member_uid)
if not member:
- raise exception.NotFound("Project can't be created "
- "because user %s doesn't exist"
+ raise exception.NotFound(_("Project can't be created "
+ "because user %s doesn't exist")
% member_uid)
members.add(member)
diff --git a/nova/auth/ldapdriver.py b/nova/auth/ldapdriver.py
index fb9a118b7..342fa40ac 100644
--- a/nova/auth/ldapdriver.py
+++ b/nova/auth/ldapdriver.py
@@ -146,7 +146,7 @@ class LdapDriver(object):
def create_user(self, name, access_key, secret_key, is_admin):
"""Create a user"""
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 self.__ldap_user_exists(name):
# Retrieve user by name
@@ -310,7 +310,7 @@ class LdapDriver(object):
def delete_user(self, uid):
"""Delete a user"""
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)
if FLAGS.ldap_user_modify_only:
# Delete attributes
@@ -432,15 +432,15 @@ class LdapDriver(object):
description, member_uids=None):
"""Create a group"""
if self.__group_exists(group_dn):
- raise exception.Duplicate("Group can't be created because "
- "group %s already exists" % name)
+ raise exception.Duplicate(_("Group can't be created because "
+ "group %s already exists") % name)
members = []
if member_uids is not None:
for member_uid in member_uids:
if not self.__user_exists(member_uid):
- raise exception.NotFound("Group can't be created "
- "because user %s doesn't exist" %
- member_uid)
+ raise exception.NotFound(_("Group can't be created "
+ "because user %s doesn't exist")
+ % member_uid)
members.append(self.__uid_to_dn(member_uid))
dn = self.__uid_to_dn(uid)
if not dn in members:
@@ -455,8 +455,8 @@ class LdapDriver(object):
def __is_in_group(self, uid, group_dn):
"""Check if user is in group"""
if not self.__user_exists(uid):
- raise exception.NotFound("User %s can't be searched in group "
- "because the user doesn't exist" % uid)
+ raise exception.NotFound(_("User %s can't be searched in group "
+ "because the user doesn't exist") % uid)
if not self.__group_exists(group_dn):
return False
res = self.__find_object(group_dn,
@@ -467,10 +467,10 @@ class LdapDriver(object):
def __add_to_group(self, uid, group_dn):
"""Add user to group"""
if not self.__user_exists(uid):
- raise exception.NotFound("User %s can't be added to the group "
- "because the user doesn't exist" % uid)
+ raise exception.NotFound(_("User %s can't be added to the group "
+ "because the user doesn't exist") % uid)
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)
if self.__is_in_group(uid, group_dn):
raise exception.Duplicate(_("User %(uid)s is already a member of "
@@ -481,15 +481,15 @@ class LdapDriver(object):
def __remove_from_group(self, uid, group_dn):
"""Remove user from group"""
if not self.__group_exists(group_dn):
- raise exception.NotFound("The group at dn %s doesn't exist" %
- group_dn)
+ raise exception.NotFound(_("The group at dn %s doesn't exist")
+ % group_dn)
if not self.__user_exists(uid):
- raise exception.NotFound("User %s can't be removed from the "
- "group because the user doesn't exist" %
- uid)
+ raise exception.NotFound(_("User %s can't be removed from the "
+ "group because the user doesn't exist")
+ % uid)
if not self.__is_in_group(uid, group_dn):
- raise exception.NotFound("User %s is not a member of the group" %
- uid)
+ raise exception.NotFound(_("User %s is not a member of the group")
+ % uid)
# NOTE(vish): remove user from group and any sub_groups
sub_dns = self.__find_group_dns_with_member(group_dn, uid)
for sub_dn in sub_dns:
@@ -509,8 +509,9 @@ class LdapDriver(object):
def __remove_from_all(self, uid):
"""Remove user from all roles and projects"""
if not self.__user_exists(uid):
- raise exception.NotFound("User %s can't be removed from all "
- "because the user doesn't exist" % uid)
+ raise exception.NotFound(_("User %s can't be removed from all "
+ "because the user doesn't exist")
+ % uid)
role_dns = self.__find_group_dns_with_member(
FLAGS.role_project_subtree, uid)
for role_dn in role_dns:
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 45a8f2ce8..1d8b9d79f 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -249,13 +249,16 @@ class API(base.Base):
# ..then we distill the security groups to which they belong..
security_groups = set()
for rule in security_group_rules:
- security_groups.add(rule['parent_group_id'])
+ security_group = self.db.security_group_get(
+ context,
+ rule['parent_group_id'])
+ security_groups.add(security_group)
# ..then we find the instances that are members of these groups..
instances = set()
for security_group in security_groups:
for instance in security_group['instances']:
- instances.add(instance['id'])
+ instances.add(instance)
# ...then we find the hosts where they live...
hosts = set()
diff --git a/nova/console/manager.py b/nova/console/manager.py
index c55ca8e8f..5697e7cb1 100644
--- a/nova/console/manager.py
+++ b/nova/console/manager.py
@@ -67,7 +67,7 @@ class ConsoleProxyManager(manager.Manager):
pool['id'],
instance_id)
except exception.NotFound:
- logging.debug("Adding console")
+ logging.debug(_("Adding console"))
if not password:
password = self.driver.generate_password()
if not port:
diff --git a/nova/console/xvp.py b/nova/console/xvp.py
index 2a76223da..ee66dac46 100644
--- a/nova/console/xvp.py
+++ b/nova/console/xvp.py
@@ -96,7 +96,7 @@ class XVPConsoleProxy(object):
return os.urandom(length * 2).encode('base64')[:length]
def _rebuild_xvp_conf(self, context):
- logging.debug("Rebuilding xvp conf")
+ logging.debug(_("Rebuilding xvp conf"))
pools = [pool for pool in
db.console_pool_get_all_by_host_type(context, self.host,
self.console_type)
@@ -113,12 +113,12 @@ class XVPConsoleProxy(object):
self._xvp_restart()
def _write_conf(self, config):
- logging.debug('Re-wrote %s' % FLAGS.console_xvp_conf)
+ logging.debug(_('Re-wrote %s') % FLAGS.console_xvp_conf)
with open(FLAGS.console_xvp_conf, 'w') as cfile:
cfile.write(config)
def _xvp_stop(self):
- logging.debug("Stopping xvp")
+ logging.debug(_("Stopping xvp"))
pid = self._xvp_pid()
if not pid:
return
@@ -131,19 +131,19 @@ class XVPConsoleProxy(object):
def _xvp_start(self):
if self._xvp_check_running():
return
- logging.debug("Starting xvp")
+ logging.debug(_("Starting xvp"))
try:
utils.execute('xvp -p %s -c %s -l %s' %
(FLAGS.console_xvp_pid,
FLAGS.console_xvp_conf,
FLAGS.console_xvp_log))
except exception.ProcessExecutionError, err:
- logging.error("Error starting xvp: %s" % err)
+ logging.error(_("Error starting xvp: %s") % err)
def _xvp_restart(self):
- logging.debug("Restarting xvp")
+ logging.debug(_("Restarting xvp"))
if not self._xvp_check_running():
- logging.debug("xvp not running...")
+ logging.debug(_("xvp not running..."))
self._xvp_start()
else:
pid = self._xvp_pid()
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index a53f847b1..370ca651a 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -778,7 +778,7 @@ def instance_get_by_id(context, instance_id):
result = session.query(models.Instance).\
options(joinedload_all('fixed_ip.floating_ips')).\
options(joinedload('security_groups')).\
- options(joinedload_all('fixed_ip.floating_ips')).\
+ options(joinedload_all('fixed_ip.network')).\
filter_by(id=instance_id).\
filter_by(deleted=can_read_deleted(context)).\
first()
@@ -786,6 +786,7 @@ def instance_get_by_id(context, instance_id):
result = session.query(models.Instance).\
options(joinedload('security_groups')).\
options(joinedload_all('fixed_ip.floating_ips')).\
+ options(joinedload_all('fixed_ip.network')).\
filter_by(project_id=context.project_id).\
filter_by(id=instance_id).\
filter_by(deleted=False).\
diff --git a/nova/log.py b/nova/log.py
index 4997d3f28..e1c9f46f4 100644
--- a/nova/log.py
+++ b/nova/log.py
@@ -40,15 +40,15 @@ from nova import version
FLAGS = flags.FLAGS
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 '
'%(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',
- '(%(name)s %(nova_version)s): %(levelname)s [N/A] '
+ '%(asctime)s %(levelname)s %(name)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',
'from %(processName)s (pid=%(process)d) %(funcName)s'
diff --git a/nova/network/manager.py b/nova/network/manager.py
index 37dd4f9e8..14a424a5b 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -212,7 +212,7 @@ class NetworkManager(manager.Manager):
def release_fixed_ip(self, context, mac, address):
"""Called by dhcp-bridge when ip is released."""
- LOG.debug("Releasing IP %s", address, context=context)
+ LOG.debug(_("Releasing IP %s"), address, context=context)
fixed_ip_ref = self.db.fixed_ip_get_by_address(context, address)
instance_ref = fixed_ip_ref['instance']
if not instance_ref:
diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py
index f49dd5a25..05ddace4b 100644
--- a/nova/objectstore/handler.py
+++ b/nova/objectstore/handler.py
@@ -391,8 +391,8 @@ class ImagesResource(resource.Resource):
image_location = get_argument(request, 'image_location', u'')
image_path = os.path.join(FLAGS.images_path, image_id)
- if not image_path.startswith(FLAGS.images_path) or \
- os.path.exists(image_path):
+ if ((not image_path.startswith(FLAGS.images_path)) or
+ os.path.exists(image_path)):
LOG.audit(_("Not authorized to upload image: invalid directory "
"%s"),
image_path, context=request.context)
diff --git a/nova/objectstore/image.py b/nova/objectstore/image.py
index abc28182e..41e0abd80 100644
--- a/nova/objectstore/image.py
+++ b/nova/objectstore/image.py
@@ -259,22 +259,25 @@ class Image(object):
process_input=encrypted_key,
check_exit_code=False)
if err:
- raise exception.Error("Failed to decrypt private key: %s" % err)
+ raise exception.Error(_("Failed to decrypt private key: %s")
+ % err)
iv, err = utils.execute(
'openssl rsautl -decrypt -inkey %s' % cloud_private_key,
process_input=encrypted_iv,
check_exit_code=False)
if err:
- raise exception.Error("Failed to decrypt initialization "
- "vector: %s" % err)
+ raise exception.Error(_("Failed to decrypt initialization "
+ "vector: %s") % err)
_out, err = utils.execute(
'openssl enc -d -aes-128-cbc -in %s -K %s -iv %s -out %s'
% (encrypted_filename, key, iv, decrypted_filename),
check_exit_code=False)
if err:
- raise exception.Error("Failed to decrypt image file %s : %s" %
- (encrypted_filename, err))
+ raise exception.Error(_("Failed to decrypt image file "
+ "%(image_file)s: %(err)s") %
+ {'image_file': encrypted_filename,
+ 'err': err})
@staticmethod
def untarzip_image(path, filename):
diff --git a/nova/rpc.py b/nova/rpc.py
index 68feac6d4..01fc6d44b 100644
--- a/nova/rpc.py
+++ b/nova/rpc.py
@@ -344,7 +344,7 @@ def call(context, topic, msg):
def cast(context, topic, msg):
"""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)
conn = Connection.instance()
publisher = TopicPublisher(connection=conn, topic=topic)
diff --git a/nova/scheduler/simple.py b/nova/scheduler/simple.py
index 47baf0d73..baf4966d4 100644
--- a/nova/scheduler/simple.py
+++ b/nova/scheduler/simple.py
@@ -48,7 +48,7 @@ class SimpleScheduler(chance.ChanceScheduler):
service = db.service_get_by_args(context.elevated(), host,
'nova-compute')
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
# can generalize this somehow
@@ -80,7 +80,7 @@ class SimpleScheduler(chance.ChanceScheduler):
service = db.service_get_by_args(context.elevated(), host,
'nova-volume')
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
# can generalize this somehow
diff --git a/nova/service.py b/nova/service.py
index 705bed7fc..2c30997f2 100644
--- a/nova/service.py
+++ b/nova/service.py
@@ -38,6 +38,7 @@ from nova import log as logging
from nova import flags
from nova import rpc
from nova import utils
+from nova import version
FLAGS = flags.FLAGS
@@ -156,7 +157,8 @@ class Service(object):
report_interval = FLAGS.report_interval
if not periodic_interval:
periodic_interval = FLAGS.periodic_interval
- logging.audit(_("Starting %s node"), topic)
+ logging.audit(_("Starting %s node (version %s)"), topic,
+ version.version_string_with_vcs())
service_obj = cls(host, binary, topic, manager,
report_interval, periodic_interval)
diff --git a/nova/twistd.py b/nova/twistd.py
index 556271999..6390a8144 100644
--- a/nova/twistd.py
+++ b/nova/twistd.py
@@ -156,7 +156,7 @@ def WrapTwistedOptions(wrapped):
try:
self.parseArgs(*argv)
except TypeError:
- raise usage.UsageError("Wrong number of arguments.")
+ raise usage.UsageError(_("Wrong number of arguments."))
self.postOptions()
return args
@@ -220,7 +220,7 @@ def stop(pidfile):
time.sleep(0.1)
except OSError, err:
err = str(err)
- if err.find("No such process") > 0:
+ if err.find(_("No such process")) > 0:
if os.path.exists(pidfile):
os.remove(pidfile)
else:
diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py
index 0af9bf42d..6477928e2 100644
--- a/nova/virt/libvirt_conn.py
+++ b/nova/virt/libvirt_conn.py
@@ -511,7 +511,6 @@ class LibvirtConnection(object):
base_dir = os.path.join(FLAGS.instances_path, '_base')
if not os.path.exists(base_dir):
os.mkdir(base_dir)
- os.chmod(base_dir, 0777)
base = os.path.join(base_dir, fname)
if not os.path.exists(base):
fn(target=base, *args, **kwargs)
@@ -542,7 +541,6 @@ class LibvirtConnection(object):
# ensure directories exist and are writable
utils.execute('mkdir -p %s' % basepath(suffix=''))
- utils.execute('chmod 0777 %s' % basepath(suffix=''))
LOG.info(_('instance %s: Creating image'), inst['name'])
f = open(basepath('libvirt.xml'), 'w')
@@ -734,7 +732,8 @@ class LibvirtConnection(object):
'cpu_time': cpu_time}
def get_diagnostics(self, instance_name):
- raise exception.APIError("diagnostics are not supported for libvirt")
+ raise exception.APIError(_("diagnostics are not supported "
+ "for libvirt"))
def get_disks(self, instance_name):
"""
diff --git a/nova/volume/driver.py b/nova/volume/driver.py
index 5fefa10cf..da7307733 100644
--- a/nova/volume/driver.py
+++ b/nova/volume/driver.py
@@ -100,6 +100,14 @@ class VolumeDriver(object):
def delete_volume(self, volume):
"""Deletes a logical volume."""
+ try:
+ self._try_execute("sudo lvdisplay %s/%s" %
+ (FLAGS.volume_group,
+ volume['name']))
+ except Exception as e:
+ # If the volume isn't present, then don't attempt to delete
+ return True
+
self._try_execute("sudo lvremove -f %s/%s" %
(FLAGS.volume_group,
volume['name']))
@@ -218,8 +226,14 @@ class ISCSIDriver(VolumeDriver):
def ensure_export(self, context, volume):
"""Synchronously recreates an export for a logical volume."""
- iscsi_target = self.db.volume_get_iscsi_target_num(context,
+ try:
+ iscsi_target = self.db.volume_get_iscsi_target_num(context,
volume['id'])
+ except exception.NotFound:
+ LOG.info(_("Skipping ensure_export. No iscsi_target " +
+ "provisioned for volume: %d"), volume['id'])
+ return
+
iscsi_name = "%s%s" % (FLAGS.iscsi_target_prefix, volume['name'])
volume_path = "/dev/%s/%s" % (FLAGS.volume_group, volume['name'])
self._sync_exec("sudo ietadm --op new "
@@ -258,8 +272,23 @@ class ISCSIDriver(VolumeDriver):
def remove_export(self, context, volume):
"""Removes an export for a logical volume."""
- iscsi_target = self.db.volume_get_iscsi_target_num(context,
+ try:
+ iscsi_target = self.db.volume_get_iscsi_target_num(context,
volume['id'])
+ except exception.NotFound:
+ LOG.info(_("Skipping remove_export. No iscsi_target " +
+ "provisioned for volume: %d"), volume['id'])
+ return
+
+ try:
+ # ietadm show will exit with an error
+ # this export has already been removed
+ self._execute("sudo ietadm --op show --tid=%s " % iscsi_target)
+ except Exception as e:
+ LOG.info(_("Skipping remove_export. No iscsi_target " +
+ "is presently exported for volume: %d"), volume['id'])
+ return
+
self._execute("sudo ietadm --op delete --tid=%s "
"--lun=0" % iscsi_target)
self._execute("sudo ietadm --op delete --tid=%s" %
diff --git a/nova/volume/manager.py b/nova/volume/manager.py
index ec003869d..6f8e25e19 100644
--- a/nova/volume/manager.py
+++ b/nova/volume/manager.py
@@ -84,7 +84,10 @@ class VolumeManager(manager.Manager):
volumes = self.db.volume_get_all_by_host(ctxt, self.host)
LOG.debug(_("Re-exporting %s volumes"), len(volumes))
for volume in volumes:
- self.driver.ensure_export(ctxt, volume)
+ if volume['status'] in ['available', 'in-use']:
+ self.driver.ensure_export(ctxt, volume)
+ else:
+ LOG.info(_("volume %s: skipping export"), volume_ref['name'])
def create_volume(self, context, volume_id):
"""Creates and exports the volume."""
@@ -99,14 +102,19 @@ class VolumeManager(manager.Manager):
# before passing it to the driver.
volume_ref['host'] = self.host
- vol_name = volume_ref['name']
- vol_size = volume_ref['size']
- LOG.debug(_("volume %(vol_name)s: creating lv of size %(vol_size)sG")
- % locals())
- self.driver.create_volume(volume_ref)
+ try:
+ vol_name = volume_ref['name']
+ vol_size = volume_ref['size']
+ LOG.debug(_("volume %(vol_name)s: creating lv of"
+ " size %(vol_size)sG") % locals())
+ self.driver.create_volume(volume_ref)
- LOG.debug(_("volume %s: creating export"), volume_ref['name'])
- self.driver.create_export(context, volume_ref)
+ LOG.debug(_("volume %s: creating export"), volume_ref['name'])
+ self.driver.create_export(context, volume_ref)
+ except Exception as e:
+ self.db.volume_update(context,
+ volume_ref['id'], {'status': 'error'})
+ raise e
now = datetime.datetime.utcnow()
self.db.volume_update(context,
@@ -123,10 +131,18 @@ class VolumeManager(manager.Manager):
raise exception.Error(_("Volume is still attached"))
if volume_ref['host'] != self.host:
raise exception.Error(_("Volume is not local to this node"))
- LOG.debug(_("volume %s: removing export"), volume_ref['name'])
- self.driver.remove_export(context, volume_ref)
- LOG.debug(_("volume %s: deleting"), volume_ref['name'])
- self.driver.delete_volume(volume_ref)
+
+ try:
+ LOG.debug(_("volume %s: removing export"), volume_ref['name'])
+ self.driver.remove_export(context, volume_ref)
+ LOG.debug(_("volume %s: deleting"), volume_ref['name'])
+ self.driver.delete_volume(volume_ref)
+ except Exception as e:
+ self.db.volume_update(context,
+ volume_ref['id'],
+ {'status': 'error_deleting'})
+ raise e
+
self.db.volume_destroy(context, volume_id)
LOG.debug(_("volume %s: deleted successfully"), volume_ref['name'])
return True
diff --git a/nova/wsgi.py b/nova/wsgi.py
index ea9f7acfb..e01cc1e1e 100644
--- a/nova/wsgi.py
+++ b/nova/wsgi.py
@@ -144,7 +144,7 @@ class Application(object):
See the end of http://pythonpaste.org/webob/modules/dec.html
for more info.
"""
- raise NotImplementedError("You must implement __call__")
+ raise NotImplementedError(_("You must implement __call__"))
class Middleware(Application):