merge from trunk

This commit is contained in:
William Wolf
2011年05月12日 09:18:25 -04:00

View File

@@ -51,6 +51,7 @@ Kevin Bringard <kbringard@attinteractive.com>
Kevin L. Mitchell <kevin.mitchell@rackspace.com>
Koji Iida <iida.koji@lab.ntt.co.jp>
Lorin Hochstein <lorin@isi.edu>
Lvov Maxim <usrleon@gmail.com>
Mark Washenberger <mark.washenberger@rackspace.com>
Masanori Itoh <itoumsn@nttdata.co.jp>
Matt Dietz <matt.dietz@rackspace.com>

View File

@@ -972,7 +972,7 @@ class ImageCommands(object):
try:
internal_id = ec2utils.ec2_id_to_id(old_image_id)
image = self.image_service.show(context, internal_id)
except exception.NotFound:
except (exception.InvalidEc2Id, exception.ImageNotFound):
image = self.image_service.show_by_name(context, old_image_id)
return image['id']

View File

@@ -46,7 +46,7 @@ policy = policy_match
# RHEL 6 and Fedora 14 (using openssl-1.0.0-4.el6.x86_64 or
# openssl-1.0.0d-1.fc14.x86_64)
[ policy_match ]
countryName = match
countryName = supplied
stateOrProvinceName = supplied
organizationName = optional
organizationalUnitName = optional

View File

@@ -906,7 +906,7 @@ class CloudController(object):
try:
internal_id = ec2utils.ec2_id_to_id(ec2_id)
return self.image_service.show(context, internal_id)
except ValueError:
except (exception.InvalidEc2Id, exception.ImageNotFound):
try:
return self.image_service.show_by_name(context, ec2_id)
except exception.NotFound:

View File

@@ -21,7 +21,10 @@ from nova import exception
def ec2_id_to_id(ec2_id):
"""Convert an ec2 ID (i-[base 16 number]) to an instance id (int)"""
return int(ec2_id.split('-')[-1], 16)
try:
return int(ec2_id.split('-')[-1], 16)
except ValueError:
raise exception.InvalidEc2Id(ec2_id=ec2_id)
def id_to_ec2_id(instance_id, template='i-%08x'):

View File

@@ -17,15 +17,13 @@
# under the License.
## Table code mostly autogenerated by genmodel.py
from sqlalchemy import *
from migrate import *
from sqlalchemy import Boolean, Column, DateTime, ForeignKey
from sqlalchemy import ForeignKeyConstraint, Integer, MetaData, String
from sqlalchemy import Table, Text
from nova import log as logging
meta = MetaData()
auth_tokens = Table('auth_tokens', meta,
Column('created_at', DateTime(timezone=False)),
Column('updated_at', DateTime(timezone=False)),

View File

@@ -16,15 +16,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from sqlalchemy import Boolean, Column, DateTime, ForeignKey
from sqlalchemy import Integer, MetaData, String, Table, Text
from nova import log as logging
meta = MetaData()
# Just for the ForeignKey and column creation to succeed, these are not the
# actual definitions of instances or services.
instances = Table('instances', meta,

View File

@@ -15,15 +15,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from nova import log as logging
from sqlalchemy import Column, Integer, MetaData, String, Table
meta = MetaData()
networks = Table('networks', meta,
Column('id', Integer(), primary_key=True, nullable=False),
)

View File

@@ -13,15 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from sqlalchemy import Boolean, Column, DateTime, Integer
from sqlalchemy import MetaData, String, Table
from nova import log as logging
meta = MetaData()
#
# New Tables
#

View File

@@ -15,15 +15,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer
from sqlalchemy import MetaData, String, Table
from nova import log as logging
meta = MetaData()
# Just for the ForeignKey and column creation to succeed, these are not the
# actual definitions of instances or services.
instances = Table('instances', meta,

View File

@@ -15,11 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from nova import log as logging
from sqlalchemy import Column, Integer, MetaData, String, Table
meta = MetaData()

View File

@@ -13,15 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from nova import log as logging
from sqlalchemy import Column, Integer, MetaData, String, Table
meta = MetaData()
# Table stub-definitions
# Just for the ForeignKey and column creation to succeed, these are not the
# actual definitions of instances or services.

View File

@@ -13,15 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from nova import api
from nova import db
from sqlalchemy import Boolean, Column, DateTime, Integer
from sqlalchemy import MetaData, String, Table
from nova import log as logging
import datetime
meta = MetaData()

View File

@@ -15,12 +15,10 @@
# License for the specific language governing permissions and limitations
# under the License.from sqlalchemy import *
from sqlalchemy import *
from migrate import *
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer
from sqlalchemy import MetaData, String, Table
from nova import log as logging
meta = MetaData()
# Just for the ForeignKey and column creation to succeed, these are not the

View File

@@ -14,12 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from sqlalchemy.sql import text
from migrate import *
from nova import log as logging
from sqlalchemy import Column, Integer, MetaData, String, Table
meta = MetaData()

View File

@@ -16,10 +16,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from migrate import *
from sqlalchemy import Boolean, Column, DateTime, Integer, MetaData
from sqlalchemy import Table, Text
from nova import log as logging
from sqlalchemy import *
meta = MetaData()

View File

@@ -13,15 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from migrate import *
from nova import log as logging
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer
from sqlalchemy import MetaData, String, Table
meta = MetaData()
# Table stub-definitions
# Just for the ForeignKey and column creation to succeed, these are not the
# actual definitions of instances or services.

View File

@@ -15,11 +15,7 @@
# License for the specific language governing permissions and limitations
# under the License.from sqlalchemy import *
from sqlalchemy import *
from migrate import *
from nova import log as logging
from sqlalchemy import Column, Integer, MetaData, Table
meta = MetaData()

View File

@@ -14,16 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from sqlalchemy.sql import text
from migrate import *
from sqlalchemy import Column, Integer, MetaData, String, Table
#from nova import log as logging
meta = MetaData()
c_instance_type = Column('instance_type',
String(length=255, convert_unicode=False,
assert_unicode=None, unicode_error=None,

View File

@@ -15,14 +15,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from sqlalchemy import *
from sqlalchemy.sql import text
from migrate import *
from sqlalchemy import Boolean, Column, MetaData, Table
meta = MetaData()
c_auto_assigned = Column('auto_assigned', Boolean, default=False)

View File

@@ -244,6 +244,10 @@ class InstanceUnacceptable(Invalid):
message = _("Instance %(instance_id)s is unacceptable") + ": %(reason)s"
class InvalidEc2Id(Invalid):
message = _("Ec2 id %(ec2_id)s is unacceptable.")
class NotFound(NovaException):
message = _("Resource could not be found.")

View File

@@ -28,10 +28,12 @@ import StringIO
import webob
from nova import context
from nova import exception
from nova import test
from nova.api import ec2
from nova.api.ec2 import cloud
from nova.api.ec2 import apirequest
from nova.api.ec2 import cloud
from nova.api.ec2 import ec2utils
from nova.auth import manager
@@ -101,6 +103,21 @@ class XmlConversionTestCase(test.TestCase):
self.assertEqual(conv('-0'), 0)
class Ec2utilsTestCase(test.TestCase):
def test_ec2_id_to_id(self):
self.assertEqual(ec2utils.ec2_id_to_id('i-0000001e'), 30)
self.assertEqual(ec2utils.ec2_id_to_id('ami-1d'), 29)
def test_bad_ec2_id(self):
self.assertRaises(exception.InvalidEc2Id,
ec2utils.ec2_id_to_id,
'badone')
def test_id_to_ec2_id(self):
self.assertEqual(ec2utils.id_to_ec2_id(30), 'i-0000001e')
self.assertEqual(ec2utils.id_to_ec2_id(29, 'ami-%08x'), 'ami-0000001d')
class ApiEc2TestCase(test.TestCase):
"""Unit test for the cloud controller on an EC2 API"""
def setUp(self):

View File

@@ -17,9 +17,9 @@
import os
import tempfile
from nova import exception
from nova import test
from nova import utils
from nova import exception
class ExecuteTestCase(test.TestCase):

View File

@@ -232,9 +232,12 @@ def default_flagfile(filename='nova.conf'):
# turn relative filename into an absolute path
script_dir = os.path.dirname(inspect.stack()[-1][1])
filename = os.path.abspath(os.path.join(script_dir, filename))
if os.path.exists(filename):
flagfile = ['--flagfile=%s' % filename]
sys.argv = sys.argv[:1] + flagfile + sys.argv[1:]
if not os.path.exists(filename):
filename = "./nova.conf"
if not os.path.exists(filename):
filename = '/etc/nova/nova.conf'
flagfile = ['--flagfile=%s' % filename]
sys.argv = sys.argv[:1] + flagfile + sys.argv[1:]
def debug(arg):
Reference in New Issue
openstack/nova
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.