merged with 1382

This commit is contained in:
vladimir.p
2011-08-05 09:59:28 -07:00
56 changed files with 709 additions and 1925 deletions

View File

@@ -64,9 +64,11 @@ Kirill Shileev <kshileev@gmail.com>
Koji Iida <iida.koji@lab.ntt.co.jp> Koji Iida <iida.koji@lab.ntt.co.jp>
Lorin Hochstein <lorin@isi.edu> Lorin Hochstein <lorin@isi.edu>
Lvov Maxim <usrleon@gmail.com> Lvov Maxim <usrleon@gmail.com>
Mandell Degerness <mdegerne@gmail.com>
Mark Washenberger <mark.washenberger@rackspace.com> Mark Washenberger <mark.washenberger@rackspace.com>
Masanori Itoh <itoumsn@nttdata.co.jp> Masanori Itoh <itoumsn@nttdata.co.jp>
Matt Dietz <matt.dietz@rackspace.com> Matt Dietz <matt.dietz@rackspace.com>
Matthew Hooker <matt@cloudscaling.com>
Michael Gundlach <michael.gundlach@rackspace.com> Michael Gundlach <michael.gundlach@rackspace.com>
Mike Scherbakov <mihgen@gmail.com> Mike Scherbakov <mihgen@gmail.com>
Mohammed Naser <mnaser@vexxhost.com> Mohammed Naser <mnaser@vexxhost.com>
@@ -106,3 +108,4 @@ Yoshiaki Tamura <yoshi@midokura.jp>
Youcef Laribi <Youcef.Laribi@eu.citrix.com> Youcef Laribi <Youcef.Laribi@eu.citrix.com>
Yuriy Taraday <yorik.sar@gmail.com> Yuriy Taraday <yorik.sar@gmail.com>
Zhixue Wu <Zhixue.Wu@citrix.com> Zhixue Wu <Zhixue.Wu@citrix.com>
Zed Shaw <zedshaw@zedshaw.com>

119
HACKING
View File

@@ -5,12 +5,23 @@ Step 1: Read http://www.python.org/dev/peps/pep-0008/
Step 2: Read http://www.python.org/dev/peps/pep-0008/ again Step 2: Read http://www.python.org/dev/peps/pep-0008/ again
Step 3: Read on Step 3: Read on
General
-------
- Put two newlines between top-level code (funcs, classes, etc)
- Put one newline between methods in classes and anywhere else
- Do not write "except:", use "except Exception:" at the very least
- Include your name with TODOs as in "#TODO(termie)"
- Do not name anything the same name as a built-in or reserved word
Imports Imports
------- -------
- thou shalt not import objects, only modules - Do not import objects, only modules
- thou shalt not import more than one module per line - Do not import more than one module per line
- thou shalt not make relative imports - Do not make relative imports
- thou shalt organize your imports according to the following template - Order your imports by the full module path
- Organize your imports according to the following template
:: ::
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
@@ -22,16 +33,6 @@ Imports
{{begin your code}} {{begin your code}}
General
-------
- thou shalt put two newlines twixt toplevel code (funcs, classes, etc)
- thou shalt put one newline twixt methods in classes and anywhere else
- thou shalt not write "except:", use "except Exception:" at the very least
- thou shalt include your name with TODOs as in "TODO(termie)"
- thou shalt not name anything the same name as a builtin or reserved word
- thou shalt not violate causality in our time cone, or else
Human Alphabetical Order Examples Human Alphabetical Order Examples
--------------------------------- ---------------------------------
:: ::
@@ -42,11 +43,13 @@ Human Alphabetical Order Examples
import time import time
import unittest import unittest
from nova import flags import nova.api.ec2
from nova import test from nova.api import openstack
from nova.auth import users from nova.auth import users
from nova.endpoint import api import nova.flags
from nova.endpoint import cloud from nova.endpoint import cloud
from nova import test
Docstrings Docstrings
---------- ----------
@@ -70,6 +73,88 @@ Docstrings
:param foo: the foo parameter :param foo: the foo parameter
:param bar: the bar parameter :param bar: the bar parameter
:returns: return_type -- description of the return value
:returns: description of the return value :returns: description of the return value
:raises: AttributeError, KeyError
""" """
Dictionaries/Lists
------------------
If a dictionary (dict) or list object is longer than 80 characters, its
items should be split with newlines. Embedded iterables should have their
items indented. Additionally, the last item in the dictionary should have
a trailing comma. This increases readability and simplifies future diffs.
Example:
my_dictionary = {
"image": {
"name": "Just a Snapshot",
"size": 2749573,
"properties": {
"user_id": 12,
"arch": "x86_64",
},
"things": [
"thing_one",
"thing_two",
],
"status": "ACTIVE",
},
}
Calling Methods
---------------
Calls to methods 80 characters or longer should format each argument with
newlines. This is not a requirement, but a guideline.
unnecessarily_long_function_name('string one',
'string two',
kwarg1=constants.ACTIVE,
kwarg2=['a', 'b', 'c'])
Rather than constructing parameters inline, it is better to break things up:
list_of_strings = [
'what_a_long_string',
'not as long',
]
dict_of_numbers = {
'one': 1,
'two': 2,
'twenty four': 24,
}
object_one.call_a_method('string three',
'string four',
kwarg1=list_of_strings,
kwarg2=dict_of_numbers)
Internationalization (i18n) Strings
-----------------------------------
In order to support multiple languages, we have a mechanism to support
automatic translations of exception and log strings.
Example:
msg = _("An error occurred")
raise HTTPBadRequest(explanation=msg)
If you have a variable to place within the string, first internationalize
the template string then do the replacement.
Example:
msg = _("Missing parameter: %s") % ("flavor",)
LOG.error(msg)
If you have multiple variables to place in the string, use keyword
parameters. This helps our translators reorder parameters when needed.
Example:
msg = _("The server with id %(s_id)s has no key %(m_key)s")
LOG.error(msg % {"s_id": "1234", "m_key": "imageId"})

View File

@@ -114,11 +114,11 @@ class AjaxConsoleProxy(object):
AjaxConsoleProxy.tokens[kwargs['token']] = \ AjaxConsoleProxy.tokens[kwargs['token']] = \
{'args': kwargs, 'last_activity': time.time()} {'args': kwargs, 'last_activity': time.time()}
conn = rpc.Connection.instance(new=True) conn = rpc.create_connection(new=True)
consumer = rpc.TopicAdapterConsumer( consumer = rpc.create_consumer(
connection=conn, conn,
proxy=TopicProxy, FLAGS.ajax_console_proxy_topic,
topic=FLAGS.ajax_console_proxy_topic) TopicProxy)
def delete_expired_tokens(): def delete_expired_tokens():
now = time.time() now = time.time()

View File

@@ -1,59 +0,0 @@
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Daemon for Nova RRD based instance resource monitoring.
"""
import gettext
import os
import sys
from twisted.application import service
# If ../nova/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir)
gettext.install('nova', unicode=1)
from nova import log as logging
from nova import utils
from nova import twistd
from nova.compute import monitor
LOG = logging.getLogger('nova.instancemonitor')
if __name__ == '__main__':
utils.default_flagfile()
twistd.serve(__file__)
if __name__ == '__builtin__':
LOG.warn(_('Starting instance monitor'))
# pylint: disable=C0103
monitor = monitor.InstanceMonitor()
# This is the parent service that twistd will be looking for when it
# parses this file, return it so that we can get it into globals below
application = service.Application('nova-instancemonitor')
monitor.setServiceParent(application)

View File

@@ -81,7 +81,6 @@ class LogReader(object):
if level == 'ERROR': if level == 'ERROR':
self.handle_logged_error(line) self.handle_logged_error(line)
elif level == '[-]' and self.last_error: elif level == '[-]' and self.last_error:
# twisted stack trace line
clean_line = " ".join(line.split(" ")[6:]) clean_line = " ".join(line.split(" ")[6:])
self.last_error.trace = self.last_error.trace + clean_line self.last_error.trace = self.last_error.trace + clean_line
else: else:

View File

@@ -56,6 +56,7 @@
import gettext import gettext
import glob import glob
import json import json
import math
import netaddr import netaddr
import os import os
import sys import sys
@@ -668,8 +669,9 @@ class NetworkCommands(object):
# check for certain required inputs # check for certain required inputs
if not label: if not label:
raise exception.NetworkNotCreated(req='--label') raise exception.NetworkNotCreated(req='--label')
if not fixed_range_v4: if not (fixed_range_v4 or fixed_range_v6):
raise exception.NetworkNotCreated(req='--fixed_range_v4') req = '--fixed_range_v4 or --fixed_range_v6'
raise exception.NetworkNotCreated(req=req)
bridge = bridge or FLAGS.flat_network_bridge bridge = bridge or FLAGS.flat_network_bridge
if not bridge: if not bridge:
@@ -695,21 +697,21 @@ class NetworkCommands(object):
if FLAGS.network_manager in interface_required: if FLAGS.network_manager in interface_required:
raise exception.NetworkNotCreated(req='--bridge_interface') raise exception.NetworkNotCreated(req='--bridge_interface')
if FLAGS.use_ipv6:
fixed_range_v6 = fixed_range_v6 or FLAGS.fixed_range_v6
if not fixed_range_v6:
raise exception.NetworkNotCreated(req='with use_ipv6, '
'--fixed_range_v6')
gateway_v6 = gateway_v6 or FLAGS.gateway_v6
if not gateway_v6:
raise exception.NetworkNotCreated(req='with use_ipv6, '
'--gateway_v6')
# sanitize other input using FLAGS if necessary # sanitize other input using FLAGS if necessary
if not num_networks: if not num_networks:
num_networks = FLAGS.num_networks num_networks = FLAGS.num_networks
if not network_size: if not network_size:
network_size = FLAGS.network_size fixnet = netaddr.IPNetwork(fixed_range_v4)
each_subnet_size = fixnet.size / int(num_networks)
if each_subnet_size > FLAGS.network_size:
network_size = FLAGS.network_size
subnet = 32 - int(math.log(network_size, 2))
oversize_msg = _('Subnet(s) too large, defaulting to /%s.'
' To override, specify network_size flag.'
) % subnet
print oversize_msg
else:
network_size = fixnet.size
if not multi_host: if not multi_host:
multi_host = FLAGS.multi_host multi_host = FLAGS.multi_host
else: else:
@@ -741,8 +743,8 @@ class NetworkCommands(object):
def list(self): def list(self):
"""List all created networks""" """List all created networks"""
print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % ( print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (
_('network'), _('IPv4'),
_('netmask'), _('IPv6'),
_('start address'), _('start address'),
_('DNS1'), _('DNS1'),
_('DNS2'), _('DNS2'),
@@ -751,7 +753,7 @@ class NetworkCommands(object):
for network in db.network_get_all(context.get_admin_context()): for network in db.network_get_all(context.get_admin_context()):
print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % ( print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (
network.cidr, network.cidr,
network.netmask, network.cidr_v6,
network.dhcp_start, network.dhcp_start,
network.dns1, network.dns1,
network.dns2, network.dns2,

View File

@@ -18,7 +18,7 @@
# under the License. # under the License.
""" """
Twisted daemon for nova objectstore. Supports S3 API. Daemon for nova objectstore. Supports S3 API.
""" """
import gettext import gettext

View File

@@ -127,7 +127,7 @@ class DbDriver(object):
try: try:
project = db.project_create(context.get_admin_context(), values) project = db.project_create(context.get_admin_context(), values)
except exception.Duplicate: except exception.DBError:
raise exception.ProjectExists(project=name) raise exception.ProjectExists(project=name)
for member in members: for member in members:

View File

@@ -518,6 +518,14 @@ class AuthManager(object):
return drv.get_user_roles(User.safe_id(user), return drv.get_user_roles(User.safe_id(user),
Project.safe_id(project)) Project.safe_id(project))
def get_active_roles(self, user, project=None):
"""Get all active roles for context"""
if project:
roles = FLAGS.allowed_roles + ['projectmanager']
else:
roles = FLAGS.global_roles
return [role for role in roles if self.has_role(user, role, project)]
def get_project(self, pid): def get_project(self, pid):
"""Get project object by id""" """Get project object by id"""
with self.driver() as drv: with self.driver() as drv:
@@ -730,10 +738,6 @@ class AuthManager(object):
with self.driver() as drv: with self.driver() as drv:
drv.modify_user(uid, access_key, secret_key, admin) drv.modify_user(uid, access_key, secret_key, admin)
@staticmethod
def get_key_pairs(context):
return db.key_pair_get_all_by_user(context.elevated(), context.user_id)
def get_credentials(self, user, project=None, use_dmz=True): def get_credentials(self, user, project=None, use_dmz=True):
"""Get credential zip for user in project""" """Get credential zip for user in project"""
if not isinstance(user, User): if not isinstance(user, User):
@@ -785,7 +789,7 @@ class AuthManager(object):
return read_buffer return read_buffer
def get_environment_rc(self, user, project=None, use_dmz=True): def get_environment_rc(self, user, project=None, use_dmz=True):
"""Get credential zip for user in project""" """Get environment rc for user in project"""
if not isinstance(user, User): if not isinstance(user, User):
user = self.get_user(user) user = self.get_user(user)
if project is None: if project is None:

View File

@@ -344,7 +344,7 @@ DEFINE_string('lock_path', os.path.join(os.path.dirname(__file__), '../'),
'Directory for lock files') 'Directory for lock files')
DEFINE_string('logdir', None, 'output to a per-service log file in named ' DEFINE_string('logdir', None, 'output to a per-service log file in named '
'directory') 'directory')
DEFINE_integer('logfile_mode', 0644, 'Default file mode of the logs.')
DEFINE_string('sqlite_db', 'nova.sqlite', 'file name for sqlite') DEFINE_string('sqlite_db', 'nova.sqlite', 'file name for sqlite')
DEFINE_string('sql_connection', DEFINE_string('sql_connection',
'sqlite:///$state_path/$sqlite_db', 'sqlite:///$state_path/$sqlite_db',
@@ -399,3 +399,8 @@ DEFINE_list('zone_capabilities',
'Key/Multi-value list representng capabilities of this zone') 'Key/Multi-value list representng capabilities of this zone')
DEFINE_string('build_plan_encryption_key', None, DEFINE_string('build_plan_encryption_key', None,
'128bit (hex) encryption key for scheduler build plans.') '128bit (hex) encryption key for scheduler build plans.')
DEFINE_bool('start_guests_on_host_boot', False,
'Whether to restart guests when the host reboots')
DEFINE_bool('resume_guests_state_on_host_boot', False,
'Whether to start guests, that was running before the host reboot')

View File

@@ -43,8 +43,8 @@ from nova import version
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
flags.DEFINE_string('logging_context_format_string', flags.DEFINE_string('logging_context_format_string',
'%(asctime)s %(levelname)s %(name)s ' '%(asctime)s %(levelname)s %(name)s '
'[%(request_id)s %(user)s ' '[%(request_id)s %(user_id)s '
'%(project)s] %(message)s', '%(project_id)s] %(message)s',
'format string to use for log messages with context') 'format string to use for log messages with context')
flags.DEFINE_string('logging_default_format_string', flags.DEFINE_string('logging_default_format_string',
'%(asctime)s %(levelname)s %(name)s [-] ' '%(asctime)s %(levelname)s %(name)s [-] '
@@ -257,6 +257,7 @@ class NovaRootLogger(NovaLogger):
self.filelog = WatchedFileHandler(logpath) self.filelog = WatchedFileHandler(logpath)
self.addHandler(self.filelog) self.addHandler(self.filelog)
self.logpath = logpath self.logpath = logpath
os.chmod(self.logpath, FLAGS.logfile_mode)
else: else:
self.removeHandler(self.filelog) self.removeHandler(self.filelog)
self.addHandler(self.streamlog) self.addHandler(self.streamlog)

View File

@@ -80,6 +80,10 @@ def notify(publisher_id, event_type, priority, payload):
if priority not in log_levels: if priority not in log_levels:
raise BadPriorityException( raise BadPriorityException(
_('%s not in valid priorities' % priority)) _('%s not in valid priorities' % priority))
# Ensure everything is JSON serializable.
payload = utils.to_primitive(payload, convert_instances=True)
driver = utils.import_object(FLAGS.notification_driver) driver = utils.import_object(FLAGS.notification_driver)
msg = dict(message_id=str(uuid.uuid4()), msg = dict(message_id=str(uuid.uuid4()),
publisher_id=publisher_id, publisher_id=publisher_id,

66
nova/rpc/__init__.py Normal file
View File

@@ -0,0 +1,66 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from nova.utils import import_object
from nova.rpc.common import RemoteError, LOG
from nova import flags
FLAGS = flags.FLAGS
flags.DEFINE_string('rpc_backend',
'nova.rpc.amqp',
"The messaging module to use, defaults to AMQP.")
RPCIMPL = import_object(FLAGS.rpc_backend)
def create_connection(new=True):
return RPCIMPL.Connection.instance(new=True)
def create_consumer(conn, topic, proxy, fanout=False):
if fanout:
return RPCIMPL.FanoutAdapterConsumer(
connection=conn,
topic=topic,
proxy=proxy)
else:
return RPCIMPL.TopicAdapterConsumer(
connection=conn,
topic=topic,
proxy=proxy)
def create_consumer_set(conn, consumers):
return RPCIMPL.ConsumerSet(connection=conn, consumer_list=consumers)
def call(context, topic, msg):
return RPCIMPL.call(context, topic, msg)
def cast(context, topic, msg):
return RPCIMPL.cast(context, topic, msg)
def fanout_cast(context, topic, msg):
return RPCIMPL.fanout_cast(context, topic, msg)
def multicall(context, topic, msg):
return RPCIMPL.multicall(context, topic, msg)

View File

@@ -44,9 +44,7 @@ from nova import fakerabbit
from nova import flags from nova import flags
from nova import log as logging from nova import log as logging
from nova import utils from nova import utils
from nova.rpc.common import RemoteError, LOG
LOG = logging.getLogger('nova.rpc')
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
@@ -418,25 +416,6 @@ def msg_reply(msg_id, reply=None, failure=None):
publisher.close() publisher.close()
class RemoteError(exception.Error):
"""Signifies that a remote class has raised an exception.
Containes a string representation of the type of the original exception,
the value of the original exception, and the traceback. These are
sent to the parent as a joined string so printing the exception
contains all of the relevent info.
"""
def __init__(self, exc_type, value, traceback):
self.exc_type = exc_type
self.value = value
self.traceback = traceback
super(RemoteError, self).__init__('%s %s\n%s' % (exc_type,
value,
traceback))
def _unpack_context(msg): def _unpack_context(msg):
"""Unpack context from msg.""" """Unpack context from msg."""
context_dict = {} context_dict = {}

23
nova/rpc/common.py Normal file
View File

@@ -0,0 +1,23 @@
from nova import exception
from nova import log as logging
LOG = logging.getLogger('nova.rpc')
class RemoteError(exception.Error):
"""Signifies that a remote class has raised an exception.
Containes a string representation of the type of the original exception,
the value of the original exception, and the traceback. These are
sent to the parent as a joined string so printing the exception
contains all of the relevent info.
"""
def __init__(self, exc_type, value, traceback):
self.exc_type = exc_type
self.value = value
self.traceback = traceback
super(RemoteError, self).__init__('%s %s\n%s' % (exc_type,
value,
traceback))

View File

@@ -28,6 +28,7 @@ from nova import flags
from nova import log as logging from nova import log as logging
from nova.scheduler import zone_aware_scheduler from nova.scheduler import zone_aware_scheduler
from nova import utils from nova import utils
from nova import exception
LOG = logging.getLogger('nova.scheduler.least_cost') LOG = logging.getLogger('nova.scheduler.least_cost')

View File

@@ -81,7 +81,7 @@ class ZoneAwareScheduler(driver.Scheduler):
decryptor = crypto.decryptor(FLAGS.build_plan_encryption_key) decryptor = crypto.decryptor(FLAGS.build_plan_encryption_key)
try: try:
json_entry = decryptor(blob) json_entry = decryptor(blob)
return json.dumps(entry) return json.dumps(json_entry)
except M2Crypto.EVP.EVPError: except M2Crypto.EVP.EVPError:
pass pass
return None return None

View File

@@ -21,24 +21,18 @@ import random
from nova import context from nova import context
from nova import db from nova import db
from nova import flags
from nova import test from nova import test
from nova.auth import manager
from nova.virt import hyperv from nova.virt import hyperv
FLAGS = flags.FLAGS
FLAGS.connection_type = 'hyperv'
class HyperVTestCase(test.TestCase): class HyperVTestCase(test.TestCase):
"""Test cases for the Hyper-V driver""" """Test cases for the Hyper-V driver"""
def setUp(self): def setUp(self):
super(HyperVTestCase, self).setUp() super(HyperVTestCase, self).setUp()
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('fake', 'fake', 'fake', self.project_id = 'fake'
admin=True) self.context = context.RequestContext(self.user_id, self.project_id)
self.project = self.manager.create_project('fake', 'fake', 'fake') self.flags(connection_type='hyperv')
self.context = context.RequestContext(self.user, self.project)
def test_create_destroy(self): def test_create_destroy(self):
"""Create a VM and destroy it""" """Create a VM and destroy it"""

View File

@@ -19,12 +19,9 @@ Tests For Scheduler Host Filters.
import json import json
from nova import exception from nova import exception
from nova import flags
from nova import test from nova import test
from nova.scheduler import host_filter from nova.scheduler import host_filter
FLAGS = flags.FLAGS
class FakeZoneManager: class FakeZoneManager:
pass pass
@@ -57,9 +54,9 @@ class HostFilterTestCase(test.TestCase):
'host_name-label': 'xs-%s' % multiplier} 'host_name-label': 'xs-%s' % multiplier}
def setUp(self): def setUp(self):
self.old_flag = FLAGS.default_host_filter super(HostFilterTestCase, self).setUp()
FLAGS.default_host_filter = \ default_host_filter = 'nova.scheduler.host_filter.AllHostsFilter'
'nova.scheduler.host_filter.AllHostsFilter' self.flags(default_host_filter=default_host_filter)
self.instance_type = dict(name='tiny', self.instance_type = dict(name='tiny',
memory_mb=50, memory_mb=50,
vcpus=10, vcpus=10,
@@ -98,9 +95,6 @@ class HostFilterTestCase(test.TestCase):
host09['xpu_arch'] = 'fermi' host09['xpu_arch'] = 'fermi'
host09['xpu_info'] = 'Tesla 2150' host09['xpu_info'] = 'Tesla 2150'
def tearDown(self):
FLAGS.default_host_filter = self.old_flag
def test_choose_filter(self): def test_choose_filter(self):
# Test default filter ... # Test default filter ...
hf = host_filter.choose_host_filter() hf = host_filter.choose_host_filter()

View File

@@ -16,13 +16,11 @@
Tests For Least Cost Scheduler Tests For Least Cost Scheduler
""" """
from nova import flags
from nova import test from nova import test
from nova.scheduler import least_cost from nova.scheduler import least_cost
from nova.tests.scheduler import test_zone_aware_scheduler from nova.tests.scheduler import test_zone_aware_scheduler
MB = 1024 * 1024 MB = 1024 * 1024
FLAGS = flags.FLAGS
class FakeHost(object): class FakeHost(object):
@@ -95,10 +93,9 @@ class LeastCostSchedulerTestCase(test.TestCase):
self.assertWeights(expected, num, request_spec, hosts) self.assertWeights(expected, num, request_spec, hosts)
def test_noop_cost_fn(self): def test_noop_cost_fn(self):
FLAGS.least_cost_scheduler_cost_functions = [ self.flags(least_cost_scheduler_cost_functions=[
'nova.scheduler.least_cost.noop_cost_fn', 'nova.scheduler.least_cost.noop_cost_fn'],
] noop_cost_fn_weight=1)
FLAGS.noop_cost_fn_weight = 1
num = 1 num = 1
request_spec = {} request_spec = {}
@@ -109,10 +106,9 @@ class LeastCostSchedulerTestCase(test.TestCase):
self.assertWeights(expected, num, request_spec, hosts) self.assertWeights(expected, num, request_spec, hosts)
def test_cost_fn_weights(self): def test_cost_fn_weights(self):
FLAGS.least_cost_scheduler_cost_functions = [ self.flags(least_cost_scheduler_cost_functions=[
'nova.scheduler.least_cost.noop_cost_fn', 'nova.scheduler.least_cost.noop_cost_fn'],
] noop_cost_fn_weight=2)
FLAGS.noop_cost_fn_weight = 2
num = 1 num = 1
request_spec = {} request_spec = {}
@@ -123,10 +119,9 @@ class LeastCostSchedulerTestCase(test.TestCase):
self.assertWeights(expected, num, request_spec, hosts) self.assertWeights(expected, num, request_spec, hosts)
def test_compute_fill_first_cost_fn(self): def test_compute_fill_first_cost_fn(self):
FLAGS.least_cost_scheduler_cost_functions = [ self.flags(least_cost_scheduler_cost_functions=[
'nova.scheduler.least_cost.compute_fill_first_cost_fn', 'nova.scheduler.least_cost.compute_fill_first_cost_fn'],
] compute_fill_first_cost_fn_weight=1)
FLAGS.compute_fill_first_cost_fn_weight = 1
num = 1 num = 1
instance_type = {'memory_mb': 1024} instance_type = {'memory_mb': 1024}

View File

@@ -16,6 +16,8 @@
Tests For Zone Aware Scheduler. Tests For Zone Aware Scheduler.
""" """
import json
import nova.db import nova.db
from nova import exception from nova import exception
@@ -327,3 +329,19 @@ class ZoneAwareSchedulerTestCase(test.TestCase):
sched._provision_resource_from_blob(None, request_spec, 1, sched._provision_resource_from_blob(None, request_spec, 1,
request_spec, {}) request_spec, {})
self.assertTrue(was_called) self.assertTrue(was_called)
def test_decrypt_blob(self):
"""Test that the decrypt method works."""
fixture = FakeZoneAwareScheduler()
test_data = {"foo": "bar"}
class StubDecryptor(object):
def decryptor(self, key):
return lambda blob: blob
self.stubs.Set(zone_aware_scheduler, 'crypto',
StubDecryptor())
self.assertEqual(fixture._decrypt_blob(test_data),
json.dumps(test_data))

View File

@@ -16,7 +16,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import unittest
import webob import webob
from nova import context from nova import context
@@ -41,7 +40,7 @@ class FakeApiRequest(object):
class AccessTestCase(test.TestCase): class AccessTestCase(test.TestCase):
def _env_for(self, ctxt, action): def _env_for(self, ctxt, action):
env = {} env = {}
env['ec2.context'] = ctxt env['nova.context'] = ctxt
env['ec2.request'] = FakeApiRequest(action) env['ec2.request'] = FakeApiRequest(action)
return env return env
@@ -93,7 +92,11 @@ class AccessTestCase(test.TestCase):
super(AccessTestCase, self).tearDown() super(AccessTestCase, self).tearDown()
def response_status(self, user, methodName): def response_status(self, user, methodName):
ctxt = context.RequestContext(user, self.project) roles = manager.AuthManager().get_active_roles(user, self.project)
ctxt = context.RequestContext(user.id,
self.project.id,
is_admin=user.is_admin(),
roles=roles)
environ = self._env_for(ctxt, methodName) environ = self._env_for(ctxt, methodName)
req = webob.Request.blank('/', environ) req = webob.Request.blank('/', environ)
resp = req.get_response(self.mw) resp = req.get_response(self.mw)
@@ -105,30 +108,26 @@ class AccessTestCase(test.TestCase):
def shouldDeny(self, user, methodName): def shouldDeny(self, user, methodName):
self.assertEqual(401, self.response_status(user, methodName)) self.assertEqual(401, self.response_status(user, methodName))
def test_001_allow_all(self): def test_allow_all(self):
users = [self.testadmin, self.testpmsys, self.testnet, self.testsys] users = [self.testadmin, self.testpmsys, self.testnet, self.testsys]
for user in users: for user in users:
self.shouldAllow(user, '_allow_all') self.shouldAllow(user, '_allow_all')
def test_002_allow_none(self): def test_allow_none(self):
self.shouldAllow(self.testadmin, '_allow_none') self.shouldAllow(self.testadmin, '_allow_none')
users = [self.testpmsys, self.testnet, self.testsys] users = [self.testpmsys, self.testnet, self.testsys]
for user in users: for user in users:
self.shouldDeny(user, '_allow_none') self.shouldDeny(user, '_allow_none')
def test_003_allow_project_manager(self): def test_allow_project_manager(self):
for user in [self.testadmin, self.testpmsys]: for user in [self.testadmin, self.testpmsys]:
self.shouldAllow(user, '_allow_project_manager') self.shouldAllow(user, '_allow_project_manager')
for user in [self.testnet, self.testsys]: for user in [self.testnet, self.testsys]:
self.shouldDeny(user, '_allow_project_manager') self.shouldDeny(user, '_allow_project_manager')
def test_004_allow_sys_and_net(self): def test_allow_sys_and_net(self):
for user in [self.testadmin, self.testnet, self.testsys]: for user in [self.testadmin, self.testnet, self.testsys]:
self.shouldAllow(user, '_allow_sys_and_net') self.shouldAllow(user, '_allow_sys_and_net')
# denied because it doesn't have the per project sysadmin # denied because it doesn't have the per project sysadmin
for user in [self.testpmsys]: for user in [self.testpmsys]:
self.shouldDeny(user, '_allow_sys_and_net') self.shouldDeny(user, '_allow_sys_and_net')
if __name__ == "__main__":
# TODO: Implement use_fake as an option
unittest.main()

View File

@@ -25,7 +25,6 @@ from nova import log as logging
from nova import rpc from nova import rpc
from nova import test from nova import test
from nova import utils from nova import utils
from nova.auth import manager
from nova.api.ec2 import admin from nova.api.ec2 import admin
from nova.image import fake from nova.image import fake
@@ -39,7 +38,7 @@ class AdminApiTestCase(test.TestCase):
super(AdminApiTestCase, self).setUp() super(AdminApiTestCase, self).setUp()
self.flags(connection_type='fake') self.flags(connection_type='fake')
self.conn = rpc.Connection.instance() self.conn = rpc.create_connection()
# set up our cloud # set up our cloud
self.api = admin.AdminController() self.api = admin.AdminController()
@@ -51,11 +50,11 @@ class AdminApiTestCase(test.TestCase):
self.volume = self.start_service('volume') self.volume = self.start_service('volume')
self.image_service = utils.import_object(FLAGS.image_service) self.image_service = utils.import_object(FLAGS.image_service)
self.manager = manager.AuthManager() self.user_id = 'admin'
self.user = self.manager.create_user('admin', 'admin', 'admin', True) self.project_id = 'admin'
self.project = self.manager.create_project('proj', 'admin', 'proj') self.context = context.RequestContext(self.user_id,
self.context = context.RequestContext(user=self.user, self.project_id,
project=self.project) True)
def fake_show(meh, context, id): def fake_show(meh, context, id):
return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1, return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1,
@@ -73,11 +72,6 @@ class AdminApiTestCase(test.TestCase):
self.stubs.Set(rpc, 'cast', finish_cast) self.stubs.Set(rpc, 'cast', finish_cast)
def tearDown(self):
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
super(AdminApiTestCase, self).tearDown()
def test_block_external_ips(self): def test_block_external_ips(self):
"""Make sure provider firewall rules are created.""" """Make sure provider firewall rules are created."""
result = self.api.block_external_addresses(self.context, '1.1.1.1/32') result = self.api.block_external_addresses(self.context, '1.1.1.1/32')

View File

@@ -30,11 +30,11 @@ import webob
from nova import context from nova import context
from nova import exception from nova import exception
from nova import test from nova import test
from nova import wsgi
from nova.api import ec2 from nova.api import ec2
from nova.api.ec2 import apirequest from nova.api.ec2 import apirequest
from nova.api.ec2 import cloud from nova.api.ec2 import cloud
from nova.api.ec2 import ec2utils from nova.api.ec2 import ec2utils
from nova.auth import manager
class FakeHttplibSocket(object): class FakeHttplibSocket(object):
@@ -192,10 +192,13 @@ class ApiEc2TestCase(test.TestCase):
"""Unit test for the cloud controller on an EC2 API""" """Unit test for the cloud controller on an EC2 API"""
def setUp(self): def setUp(self):
super(ApiEc2TestCase, self).setUp() super(ApiEc2TestCase, self).setUp()
self.manager = manager.AuthManager()
self.host = '127.0.0.1' self.host = '127.0.0.1'
self.app = ec2.Authenticate(ec2.Requestify(ec2.Executor(), # NOTE(vish): skipping the Authorizer
'nova.api.ec2.cloud.CloudController')) roles = ['sysadmin', 'netadmin']
ctxt = context.RequestContext('fake', 'fake', roles=roles)
self.app = wsgi.InjectContext(ctxt,
ec2.Requestify(ec2.Authorizer(ec2.Executor()),
'nova.api.ec2.cloud.CloudController'))
def expect_http(self, host=None, is_secure=False, api_version=None): def expect_http(self, host=None, is_secure=False, api_version=None):
"""Returns a new EC2 connection""" """Returns a new EC2 connection"""
@@ -246,39 +249,25 @@ class ApiEc2TestCase(test.TestCase):
self.expect_http(api_version='2010-10-30') self.expect_http(api_version='2010-10-30')
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake')
project = self.manager.create_project('fake', 'fake', 'fake')
# Any request should be fine # Any request should be fine
self.ec2.get_all_instances() self.ec2.get_all_instances()
self.assertTrue(self.ec2.APIVersion in self.http.getresponsebody(), self.assertTrue(self.ec2.APIVersion in self.http.getresponsebody(),
'The version in the xmlns of the response does ' 'The version in the xmlns of the response does '
'not match the API version given in the request.') 'not match the API version given in the request.')
self.manager.delete_project(project)
self.manager.delete_user(user)
def test_describe_instances(self): def test_describe_instances(self):
"""Test that, after creating a user and a project, the describe """Test that, after creating a user and a project, the describe
instances call to the API works properly""" instances call to the API works properly"""
self.expect_http() self.expect_http()
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake')
project = self.manager.create_project('fake', 'fake', 'fake')
self.assertEqual(self.ec2.get_all_instances(), []) self.assertEqual(self.ec2.get_all_instances(), [])
self.manager.delete_project(project)
self.manager.delete_user(user)
def test_terminate_invalid_instance(self): def test_terminate_invalid_instance(self):
"""Attempt to terminate an invalid instance""" """Attempt to terminate an invalid instance"""
self.expect_http() self.expect_http()
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake')
project = self.manager.create_project('fake', 'fake', 'fake')
self.assertRaises(EC2ResponseError, self.ec2.terminate_instances, self.assertRaises(EC2ResponseError, self.ec2.terminate_instances,
"i-00000005") "i-00000005")
self.manager.delete_project(project)
self.manager.delete_user(user)
def test_get_all_key_pairs(self): def test_get_all_key_pairs(self):
"""Test that, after creating a user and project and generating """Test that, after creating a user and project and generating
@@ -287,16 +276,12 @@ class ApiEc2TestCase(test.TestCase):
self.mox.ReplayAll() self.mox.ReplayAll()
keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd") \ keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd") \
for x in range(random.randint(4, 8))) for x in range(random.randint(4, 8)))
user = self.manager.create_user('fake', 'fake', 'fake')
project = self.manager.create_project('fake', 'fake', 'fake')
# NOTE(vish): create depends on pool, so call helper directly # NOTE(vish): create depends on pool, so call helper directly
cloud._gen_key(context.get_admin_context(), user.id, keyname) cloud._gen_key(context.get_admin_context(), 'fake', keyname)
rv = self.ec2.get_all_key_pairs() rv = self.ec2.get_all_key_pairs()
results = [k for k in rv if k.name == keyname] results = [k for k in rv if k.name == keyname]
self.assertEquals(len(results), 1) self.assertEquals(len(results), 1)
self.manager.delete_project(project)
self.manager.delete_user(user)
def test_create_duplicate_key_pair(self): def test_create_duplicate_key_pair(self):
"""Test that, after successfully generating a keypair, """Test that, after successfully generating a keypair,
@@ -305,8 +290,6 @@ class ApiEc2TestCase(test.TestCase):
self.mox.ReplayAll() self.mox.ReplayAll()
keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd") \ keyname = "".join(random.choice("sdiuisudfsdcnpaqwertasd") \
for x in range(random.randint(4, 8))) for x in range(random.randint(4, 8)))
user = self.manager.create_user('fake', 'fake', 'fake')
project = self.manager.create_project('fake', 'fake', 'fake')
# NOTE(vish): create depends on pool, so call helper directly # NOTE(vish): create depends on pool, so call helper directly
self.ec2.create_key_pair('test') self.ec2.create_key_pair('test')
@@ -325,27 +308,16 @@ class ApiEc2TestCase(test.TestCase):
"""Test that we can retrieve security groups""" """Test that we can retrieve security groups"""
self.expect_http() self.expect_http()
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake', admin=True)
project = self.manager.create_project('fake', 'fake', 'fake')
rv = self.ec2.get_all_security_groups() rv = self.ec2.get_all_security_groups()
self.assertEquals(len(rv), 1) self.assertEquals(len(rv), 1)
self.assertEquals(rv[0].name, 'default') self.assertEquals(rv[0].name, 'default')
self.manager.delete_project(project)
self.manager.delete_user(user)
def test_create_delete_security_group(self): def test_create_delete_security_group(self):
"""Test that we can create a security group""" """Test that we can create a security group"""
self.expect_http() self.expect_http()
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake', admin=True)
project = self.manager.create_project('fake', 'fake', 'fake')
# At the moment, you need both of these to actually be netadmin
self.manager.add_role('fake', 'netadmin')
project.add_role('fake', 'netadmin')
security_group_name = "".join(random.choice("sdiuisudfsdcnpaqwertasd") security_group_name = "".join(random.choice("sdiuisudfsdcnpaqwertasd")
for x in range(random.randint(4, 8))) for x in range(random.randint(4, 8)))
@@ -364,9 +336,6 @@ class ApiEc2TestCase(test.TestCase):
self.ec2.delete_security_group(security_group_name) self.ec2.delete_security_group(security_group_name)
self.manager.delete_project(project)
self.manager.delete_user(user)
def test_authorize_revoke_security_group_cidr(self): def test_authorize_revoke_security_group_cidr(self):
""" """
Test that we can add and remove CIDR based rules Test that we can add and remove CIDR based rules
@@ -374,12 +343,6 @@ class ApiEc2TestCase(test.TestCase):
""" """
self.expect_http() self.expect_http()
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake')
project = self.manager.create_project('fake', 'fake', 'fake')
# At the moment, you need both of these to actually be netadmin
self.manager.add_role('fake', 'netadmin')
project.add_role('fake', 'netadmin')
security_group_name = "".join(random.choice("sdiuisudfsdcnpaqwertasd") security_group_name = "".join(random.choice("sdiuisudfsdcnpaqwertasd")
for x in range(random.randint(4, 8))) for x in range(random.randint(4, 8)))
@@ -426,9 +389,6 @@ class ApiEc2TestCase(test.TestCase):
self.assertEqual(len(rv), 1) self.assertEqual(len(rv), 1)
self.assertEqual(rv[0].name, 'default') self.assertEqual(rv[0].name, 'default')
self.manager.delete_project(project)
self.manager.delete_user(user)
return return
def test_authorize_revoke_security_group_cidr_v6(self): def test_authorize_revoke_security_group_cidr_v6(self):
@@ -438,12 +398,6 @@ class ApiEc2TestCase(test.TestCase):
""" """
self.expect_http() self.expect_http()
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake')
project = self.manager.create_project('fake', 'fake', 'fake')
# At the moment, you need both of these to actually be netadmin
self.manager.add_role('fake', 'netadmin')
project.add_role('fake', 'netadmin')
security_group_name = "".join(random.choice("sdiuisudfsdcnpaqwertasd") security_group_name = "".join(random.choice("sdiuisudfsdcnpaqwertasd")
for x in range(random.randint(4, 8))) for x in range(random.randint(4, 8)))
@@ -489,9 +443,6 @@ class ApiEc2TestCase(test.TestCase):
self.assertEqual(len(rv), 1) self.assertEqual(len(rv), 1)
self.assertEqual(rv[0].name, 'default') self.assertEqual(rv[0].name, 'default')
self.manager.delete_project(project)
self.manager.delete_user(user)
return return
def test_authorize_revoke_security_group_foreign_group(self): def test_authorize_revoke_security_group_foreign_group(self):
@@ -501,12 +452,6 @@ class ApiEc2TestCase(test.TestCase):
""" """
self.expect_http() self.expect_http()
self.mox.ReplayAll() self.mox.ReplayAll()
user = self.manager.create_user('fake', 'fake', 'fake', admin=True)
project = self.manager.create_project('fake', 'fake', 'fake')
# At the moment, you need both of these to actually be netadmin
self.manager.add_role('fake', 'netadmin')
project.add_role('fake', 'netadmin')
rand_string = 'sdiuisudfsdcnpaqwertasd' rand_string = 'sdiuisudfsdcnpaqwertasd'
security_group_name = "".join(random.choice(rand_string) security_group_name = "".join(random.choice(rand_string)
@@ -560,8 +505,3 @@ class ApiEc2TestCase(test.TestCase):
self.mox.ReplayAll() self.mox.ReplayAll()
self.ec2.delete_security_group(security_group_name) self.ec2.delete_security_group(security_group_name)
self.manager.delete_project(project)
self.manager.delete_user(user)
return

View File

@@ -83,9 +83,9 @@ class user_and_project_generator(object):
class _AuthManagerBaseTestCase(test.TestCase): class _AuthManagerBaseTestCase(test.TestCase):
def setUp(self): def setUp(self):
FLAGS.auth_driver = self.auth_driver
super(_AuthManagerBaseTestCase, self).setUp() super(_AuthManagerBaseTestCase, self).setUp()
self.flags(connection_type='fake') self.flags(auth_driver=self.auth_driver,
connection_type='fake')
self.manager = manager.AuthManager(new=True) self.manager = manager.AuthManager(new=True)
self.manager.mc.cache = {} self.manager.mc.cache = {}
@@ -102,7 +102,7 @@ class _AuthManagerBaseTestCase(test.TestCase):
self.assertEqual('classified', u.secret) self.assertEqual('classified', u.secret)
self.assertEqual('private-party', u.access) self.assertEqual('private-party', u.access)
def test_004_signature_is_valid(self): def test_signature_is_valid(self):
with user_generator(self.manager, name='admin', secret='admin', with user_generator(self.manager, name='admin', secret='admin',
access='admin'): access='admin'):
with project_generator(self.manager, name="admin", with project_generator(self.manager, name="admin",
@@ -141,15 +141,14 @@ class _AuthManagerBaseTestCase(test.TestCase):
'127.0.0.1', '127.0.0.1',
'/services/Cloud')) '/services/Cloud'))
def test_005_can_get_credentials(self): def test_can_get_credentials(self):
return st = {'access': 'access', 'secret': 'secret'}
credentials = self.manager.get_user('test1').get_credentials() with user_and_project_generator(self.manager, user_state=st) as (u, p):
self.assertEqual(credentials, credentials = self.manager.get_environment_rc(u, p)
'export EC2_ACCESS_KEY="access"\n' + LOG.debug(credentials)
'export EC2_SECRET_KEY="secret"\n' + self.assertTrue('export EC2_ACCESS_KEY="access:testproj"\n'
'export EC2_URL="http://127.0.0.1:8773/services/Cloud"\n' + in credentials)
'export S3_URL="http://127.0.0.1:3333/"\n' + self.assertTrue('export EC2_SECRET_KEY="secret"\n' in credentials)
'export EC2_USER_ID="test1"\n')
def test_can_list_users(self): def test_can_list_users(self):
with user_generator(self.manager): with user_generator(self.manager):

View File

@@ -34,7 +34,6 @@ from nova import network
from nova import rpc from nova import rpc
from nova import test from nova import test
from nova import utils from nova import utils
from nova.auth import manager
from nova.api.ec2 import cloud from nova.api.ec2 import cloud
from nova.api.ec2 import ec2utils from nova.api.ec2 import ec2utils
from nova.image import fake from nova.image import fake
@@ -50,7 +49,7 @@ class CloudTestCase(test.TestCase):
self.flags(connection_type='fake', self.flags(connection_type='fake',
stub_network=True) stub_network=True)
self.conn = rpc.Connection.instance() self.conn = rpc.create_connection()
# set up our cloud # set up our cloud
self.cloud = cloud.CloudController() self.cloud = cloud.CloudController()
@@ -62,12 +61,11 @@ class CloudTestCase(test.TestCase):
self.volume = self.start_service('volume') self.volume = self.start_service('volume')
self.image_service = utils.import_object(FLAGS.image_service) self.image_service = utils.import_object(FLAGS.image_service)
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('admin', 'admin', 'admin', True) self.project_id = 'fake'
self.project = self.manager.create_project('proj', 'admin', 'proj') self.context = context.RequestContext(self.user_id,
self.context = context.RequestContext(user=self.user, self.project_id,
project=self.project) True)
host = self.network.host
def fake_show(meh, context, id): def fake_show(meh, context, id):
return {'id': 1, 'container_format': 'ami', return {'id': 1, 'container_format': 'ami',
@@ -87,27 +85,23 @@ class CloudTestCase(test.TestCase):
self.stubs.Set(rpc, 'cast', finish_cast) self.stubs.Set(rpc, 'cast', finish_cast)
def tearDown(self): def tearDown(self):
networks = db.project_get_networks(self.context, self.project.id, networks = db.project_get_networks(self.context, self.project_id,
associate=False) associate=False)
for network in networks: for network in networks:
db.network_disassociate(self.context, network['id']) db.network_disassociate(self.context, network['id'])
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
super(CloudTestCase, self).tearDown() super(CloudTestCase, self).tearDown()
def _create_key(self, name): def _create_key(self, name):
# NOTE(vish): create depends on pool, so just call helper directly # NOTE(vish): create depends on pool, so just call helper directly
return cloud._gen_key(self.context, self.context.user.id, name) return cloud._gen_key(self.context, self.context.user_id, name)
def test_describe_regions(self): def test_describe_regions(self):
"""Makes sure describe regions runs without raising an exception""" """Makes sure describe regions runs without raising an exception"""
result = self.cloud.describe_regions(self.context) result = self.cloud.describe_regions(self.context)
self.assertEqual(len(result['regionInfo']), 1) self.assertEqual(len(result['regionInfo']), 1)
regions = FLAGS.region_list self.flags(region_list=["one=test_host1", "two=test_host2"])
FLAGS.region_list = ["one=test_host1", "two=test_host2"]
result = self.cloud.describe_regions(self.context) result = self.cloud.describe_regions(self.context)
self.assertEqual(len(result['regionInfo']), 2) self.assertEqual(len(result['regionInfo']), 2)
FLAGS.region_list = regions
def test_describe_addresses(self): def test_describe_addresses(self):
"""Makes sure describe addresses runs without raising an exception""" """Makes sure describe addresses runs without raising an exception"""
@@ -326,22 +320,15 @@ class CloudTestCase(test.TestCase):
revoke = self.cloud.revoke_security_group_ingress revoke = self.cloud.revoke_security_group_ingress
self.assertTrue(revoke(self.context, group_name=sec['name'], **kwargs)) self.assertTrue(revoke(self.context, group_name=sec['name'], **kwargs))
def test_revoke_security_group_ingress_by_id(self): def test_authorize_revoke_security_group_ingress_by_id(self):
kwargs = {'project_id': self.context.project_id, 'name': 'test'}
sec = db.security_group_create(self.context, kwargs)
authz = self.cloud.authorize_security_group_ingress
kwargs = {'to_port': '999', 'from_port': '999', 'ip_protocol': 'tcp'}
authz(self.context, group_id=sec['id'], **kwargs)
revoke = self.cloud.revoke_security_group_ingress
self.assertTrue(revoke(self.context, group_id=sec['id'], **kwargs))
def test_authorize_security_group_ingress_by_id(self):
sec = db.security_group_create(self.context, sec = db.security_group_create(self.context,
{'project_id': self.context.project_id, {'project_id': self.context.project_id,
'name': 'test'}) 'name': 'test'})
authz = self.cloud.authorize_security_group_ingress authz = self.cloud.authorize_security_group_ingress
kwargs = {'to_port': '999', 'from_port': '999', 'ip_protocol': 'tcp'} kwargs = {'to_port': '999', 'from_port': '999', 'ip_protocol': 'tcp'}
self.assertTrue(authz(self.context, group_id=sec['id'], **kwargs)) authz(self.context, group_id=sec['id'], **kwargs)
revoke = self.cloud.revoke_security_group_ingress
self.assertTrue(revoke(self.context, group_id=sec['id'], **kwargs))
def test_authorize_security_group_ingress_missing_protocol_params(self): def test_authorize_security_group_ingress_missing_protocol_params(self):
sec = db.security_group_create(self.context, sec = db.security_group_create(self.context,
@@ -961,21 +948,6 @@ class CloudTestCase(test.TestCase):
self._wait_for_running(ec2_instance_id) self._wait_for_running(ec2_instance_id)
return ec2_instance_id return ec2_instance_id
def test_rescue_unrescue_instance(self):
instance_id = self._run_instance(
image_id='ami-1',
instance_type=FLAGS.default_instance_type,
max_count=1)
self.cloud.rescue_instance(context=self.context,
instance_id=instance_id)
# NOTE(vish): This currently does no validation, it simply makes sure
# that the code path doesn't throw an exception.
self.cloud.unrescue_instance(context=self.context,
instance_id=instance_id)
# TODO(soren): We need this until we can stop polling in the rpc code
# for unit tests.
self.cloud.terminate_instances(self.context, [instance_id])
def test_console_output(self): def test_console_output(self):
instance_id = self._run_instance( instance_id = self._run_instance(
image_id='ami-1', image_id='ami-1',
@@ -1004,7 +976,7 @@ class CloudTestCase(test.TestCase):
key = RSA.load_key_string(private_key, callback=lambda: None) key = RSA.load_key_string(private_key, callback=lambda: None)
bio = BIO.MemoryBuffer() bio = BIO.MemoryBuffer()
public_key = db.key_pair_get(self.context, public_key = db.key_pair_get(self.context,
self.context.user.id, self.context.user_id,
'test')['public_key'] 'test')['public_key']
key.save_pub_key_bio(bio) key.save_pub_key_bio(bio)
converted = crypto.ssl_pub_to_ssh_pub(bio.read()) converted = crypto.ssl_pub_to_ssh_pub(bio.read())
@@ -1028,7 +1000,7 @@ class CloudTestCase(test.TestCase):
'mytestfprint') 'mytestfprint')
self.assertTrue(result1) self.assertTrue(result1)
keydata = db.key_pair_get(self.context, keydata = db.key_pair_get(self.context,
self.context.user.id, self.context.user_id,
'testimportkey1') 'testimportkey1')
self.assertEqual('mytestpubkey', keydata['public_key']) self.assertEqual('mytestpubkey', keydata['public_key'])
self.assertEqual('mytestfprint', keydata['fingerprint']) self.assertEqual('mytestfprint', keydata['fingerprint'])
@@ -1045,7 +1017,7 @@ class CloudTestCase(test.TestCase):
dummypub) dummypub)
self.assertTrue(result2) self.assertTrue(result2)
keydata = db.key_pair_get(self.context, keydata = db.key_pair_get(self.context,
self.context.user.id, self.context.user_id,
'testimportkey2') 'testimportkey2')
self.assertEqual(dummypub, keydata['public_key']) self.assertEqual(dummypub, keydata['public_key'])
self.assertEqual(dummyfprint, keydata['fingerprint']) self.assertEqual(dummyfprint, keydata['fingerprint'])

View File

@@ -19,10 +19,6 @@
Tests For Compute Tests For Compute
""" """
import mox
import stubout
from nova.auth import manager
from nova import compute from nova import compute
from nova.compute import instance_types from nova.compute import instance_types
from nova.compute import manager as compute_manager from nova.compute import manager as compute_manager
@@ -67,10 +63,9 @@ class ComputeTestCase(test.TestCase):
network_manager='nova.network.manager.FlatManager') network_manager='nova.network.manager.FlatManager')
self.compute = utils.import_object(FLAGS.compute_manager) self.compute = utils.import_object(FLAGS.compute_manager)
self.compute_api = compute.API() self.compute_api = compute.API()
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('fake', 'fake', 'fake') self.project_id = 'fake'
self.project = self.manager.create_project('fake', 'fake', 'fake') self.context = context.RequestContext(self.user_id, self.project_id)
self.context = context.RequestContext('fake', 'fake', False)
test_notifier.NOTIFICATIONS = [] test_notifier.NOTIFICATIONS = []
def fake_show(meh, context, id): def fake_show(meh, context, id):
@@ -78,19 +73,14 @@ class ComputeTestCase(test.TestCase):
self.stubs.Set(nova.image.fake._FakeImageService, 'show', fake_show) self.stubs.Set(nova.image.fake._FakeImageService, 'show', fake_show)
def tearDown(self):
self.manager.delete_user(self.user)
self.manager.delete_project(self.project)
super(ComputeTestCase, self).tearDown()
def _create_instance(self, params={}): def _create_instance(self, params={}):
"""Create a test instance""" """Create a test instance"""
inst = {} inst = {}
inst['image_ref'] = 1 inst['image_ref'] = 1
inst['reservation_id'] = 'r-fakeres' inst['reservation_id'] = 'r-fakeres'
inst['launch_time'] = '10' inst['launch_time'] = '10'
inst['user_id'] = self.user.id inst['user_id'] = self.user_id
inst['project_id'] = self.project.id inst['project_id'] = self.project_id
type_id = instance_types.get_instance_type_by_name('m1.tiny')['id'] type_id = instance_types.get_instance_type_by_name('m1.tiny')['id']
inst['instance_type_id'] = type_id inst['instance_type_id'] = type_id
inst['ami_launch_index'] = 0 inst['ami_launch_index'] = 0
@@ -115,8 +105,8 @@ class ComputeTestCase(test.TestCase):
def _create_group(self): def _create_group(self):
values = {'name': 'testgroup', values = {'name': 'testgroup',
'description': 'testgroup', 'description': 'testgroup',
'user_id': self.user.id, 'user_id': self.user_id,
'project_id': self.project.id} 'project_id': self.project_id}
return db.security_group_create(self.context, values) return db.security_group_create(self.context, values)
def _get_dummy_instance(self): def _get_dummy_instance(self):
@@ -350,8 +340,8 @@ class ComputeTestCase(test.TestCase):
self.assertEquals(msg['priority'], 'INFO') self.assertEquals(msg['priority'], 'INFO')
self.assertEquals(msg['event_type'], 'compute.instance.create') self.assertEquals(msg['event_type'], 'compute.instance.create')
payload = msg['payload'] payload = msg['payload']
self.assertEquals(payload['tenant_id'], self.project.id) self.assertEquals(payload['tenant_id'], self.project_id)
self.assertEquals(payload['user_id'], self.user.id) self.assertEquals(payload['user_id'], self.user_id)
self.assertEquals(payload['instance_id'], instance_id) self.assertEquals(payload['instance_id'], instance_id)
self.assertEquals(payload['instance_type'], 'm1.tiny') self.assertEquals(payload['instance_type'], 'm1.tiny')
type_id = instance_types.get_instance_type_by_name('m1.tiny')['id'] type_id = instance_types.get_instance_type_by_name('m1.tiny')['id']
@@ -374,8 +364,8 @@ class ComputeTestCase(test.TestCase):
self.assertEquals(msg['priority'], 'INFO') self.assertEquals(msg['priority'], 'INFO')
self.assertEquals(msg['event_type'], 'compute.instance.delete') self.assertEquals(msg['event_type'], 'compute.instance.delete')
payload = msg['payload'] payload = msg['payload']
self.assertEquals(payload['tenant_id'], self.project.id) self.assertEquals(payload['tenant_id'], self.project_id)
self.assertEquals(payload['user_id'], self.user.id) self.assertEquals(payload['user_id'], self.user_id)
self.assertEquals(payload['instance_id'], instance_id) self.assertEquals(payload['instance_id'], instance_id)
self.assertEquals(payload['instance_type'], 'm1.tiny') self.assertEquals(payload['instance_type'], 'm1.tiny')
type_id = instance_types.get_instance_type_by_name('m1.tiny')['id'] type_id = instance_types.get_instance_type_by_name('m1.tiny')['id']
@@ -420,7 +410,7 @@ class ComputeTestCase(test.TestCase):
def fake(*args, **kwargs): def fake(*args, **kwargs):
pass pass
self.stubs.Set(self.compute.driver, 'finish_resize', fake) self.stubs.Set(self.compute.driver, 'finish_migration', fake)
self.stubs.Set(self.compute.network_api, 'get_instance_nw_info', fake) self.stubs.Set(self.compute.network_api, 'get_instance_nw_info', fake)
context = self.context.elevated() context = self.context.elevated()
instance_id = self._create_instance() instance_id = self._create_instance()
@@ -457,8 +447,8 @@ class ComputeTestCase(test.TestCase):
self.assertEquals(msg['priority'], 'INFO') self.assertEquals(msg['priority'], 'INFO')
self.assertEquals(msg['event_type'], 'compute.instance.resize.prep') self.assertEquals(msg['event_type'], 'compute.instance.resize.prep')
payload = msg['payload'] payload = msg['payload']
self.assertEquals(payload['tenant_id'], self.project.id) self.assertEquals(payload['tenant_id'], self.project_id)
self.assertEquals(payload['user_id'], self.user.id) self.assertEquals(payload['user_id'], self.user_id)
self.assertEquals(payload['instance_id'], instance_id) self.assertEquals(payload['instance_id'], instance_id)
self.assertEquals(payload['instance_type'], 'm1.tiny') self.assertEquals(payload['instance_type'], 'm1.tiny')
type_id = instance_types.get_instance_type_by_name('m1.tiny')['id'] type_id = instance_types.get_instance_type_by_name('m1.tiny')['id']
@@ -506,8 +496,8 @@ class ComputeTestCase(test.TestCase):
db.instance_update(self.context, instance_id, db.instance_update(self.context, instance_id,
{'instance_type_id': inst_type['id']}) {'instance_type_id': inst_type['id']})
self.assertRaises(exception.ApiError, self.compute_api.resize, self.assertRaises(exception.CannotResizeToSmallerSize,
context, instance_id, 1) self.compute_api.resize, context, instance_id, 1)
self.compute.terminate_instance(context, instance_id) self.compute.terminate_instance(context, instance_id)
@@ -518,8 +508,8 @@ class ComputeTestCase(test.TestCase):
self.compute.run_instance(self.context, instance_id) self.compute.run_instance(self.context, instance_id)
self.assertRaises(exception.ApiError, self.compute_api.resize, self.assertRaises(exception.CannotResizeToSameSize,
context, instance_id, 1) self.compute_api.resize, context, instance_id, 1)
self.compute.terminate_instance(context, instance_id) self.compute.terminate_instance(context, instance_id)
@@ -531,8 +521,8 @@ class ComputeTestCase(test.TestCase):
def fake(*args, **kwargs): def fake(*args, **kwargs):
pass pass
self.stubs.Set(self.compute.driver, 'finish_resize', fake) self.stubs.Set(self.compute.driver, 'finish_migration', fake)
self.stubs.Set(self.compute.driver, 'revert_resize', fake) self.stubs.Set(self.compute.driver, 'revert_migration', fake)
self.stubs.Set(self.compute.network_api, 'get_instance_nw_info', fake) self.stubs.Set(self.compute.network_api, 'get_instance_nw_info', fake)
self.compute.run_instance(self.context, instance_id) self.compute.run_instance(self.context, instance_id)
@@ -545,7 +535,9 @@ class ComputeTestCase(test.TestCase):
db.instance_update(self.context, instance_id, {'host': 'foo'}) db.instance_update(self.context, instance_id, {'host': 'foo'})
self.compute.prep_resize(context, inst_ref['uuid'], 3) new_instance_type_ref = db.instance_type_get_by_flavor_id(context, 3)
self.compute.prep_resize(context, inst_ref['uuid'],
new_instance_type_ref['id'])
migration_ref = db.migration_get_by_instance_and_status(context, migration_ref = db.migration_get_by_instance_and_status(context,
inst_ref['uuid'], 'pre-migrating') inst_ref['uuid'], 'pre-migrating')
@@ -849,7 +841,6 @@ class ComputeTestCase(test.TestCase):
def test_run_kill_vm(self): def test_run_kill_vm(self):
"""Detect when a vm is terminated behind the scenes""" """Detect when a vm is terminated behind the scenes"""
self.stubs = stubout.StubOutForTesting()
self.stubs.Set(compute_manager.ComputeManager, self.stubs.Set(compute_manager.ComputeManager,
'_report_driver_status', nop_report_driver_status) '_report_driver_status', nop_report_driver_status)

View File

@@ -26,10 +26,9 @@ from nova import exception
from nova import flags from nova import flags
from nova import test from nova import test
from nova import utils from nova import utils
from nova.auth import manager
from nova.console import manager as console_manager
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
flags.DECLARE('console_driver', 'nova.console.manager')
class ConsoleTestCase(test.TestCase): class ConsoleTestCase(test.TestCase):
@@ -39,17 +38,11 @@ class ConsoleTestCase(test.TestCase):
self.flags(console_driver='nova.console.fake.FakeConsoleProxy', self.flags(console_driver='nova.console.fake.FakeConsoleProxy',
stub_compute=True) stub_compute=True)
self.console = utils.import_object(FLAGS.console_manager) self.console = utils.import_object(FLAGS.console_manager)
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('fake', 'fake', 'fake') self.project_id = 'fake'
self.project = self.manager.create_project('fake', 'fake', 'fake') self.context = context.RequestContext(self.user_id, self.project_id)
self.context = context.get_admin_context()
self.host = 'test_compute_host' self.host = 'test_compute_host'
def tearDown(self):
self.manager.delete_user(self.user)
self.manager.delete_project(self.project)
super(ConsoleTestCase, self).tearDown()
def _create_instance(self): def _create_instance(self):
"""Create a test instance""" """Create a test instance"""
inst = {} inst = {}
@@ -58,8 +51,8 @@ class ConsoleTestCase(test.TestCase):
inst['image_id'] = 1 inst['image_id'] = 1
inst['reservation_id'] = 'r-fakeres' inst['reservation_id'] = 'r-fakeres'
inst['launch_time'] = '10' inst['launch_time'] = '10'
inst['user_id'] = self.user.id inst['user_id'] = self.user_id
inst['project_id'] = self.project.id inst['project_id'] = self.project_id
inst['instance_type_id'] = 1 inst['instance_type_id'] = 1
inst['ami_launch_index'] = 0 inst['ami_launch_index'] = 0
return db.instance_create(self.context, inst)['id'] return db.instance_create(self.context, inst)['id']

View File

@@ -22,7 +22,6 @@ from nova import test
from nova import context from nova import context
from nova import db from nova import db
from nova import flags from nova import flags
from nova.auth import manager
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
@@ -45,42 +44,35 @@ def _setup_networking(instance_id, ip='1.2.3.4', flo_addr='1.2.1.2'):
db.fixed_ip_create(ctxt, fixed_ip) db.fixed_ip_create(ctxt, fixed_ip)
fix_ref = db.fixed_ip_get_by_address(ctxt, ip) fix_ref = db.fixed_ip_get_by_address(ctxt, ip)
db.floating_ip_create(ctxt, {'address': flo_addr, db.floating_ip_create(ctxt, {'address': flo_addr,
'fixed_ip_id': fix_ref.id}) 'fixed_ip_id': fix_ref['id']})
class DbApiTestCase(test.TestCase): class DbApiTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(DbApiTestCase, self).setUp() super(DbApiTestCase, self).setUp()
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('admin', 'admin', 'admin', True) self.project_id = 'fake'
self.project = self.manager.create_project('proj', 'admin', 'proj') self.context = context.RequestContext(self.user_id, self.project_id)
self.context = context.RequestContext(user=self.user,
project=self.project)
def tearDown(self):
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
super(DbApiTestCase, self).tearDown()
def test_instance_get_project_vpn(self): def test_instance_get_project_vpn(self):
result = db.fixed_ip_get_all(self.context)
values = {'instance_type_id': FLAGS.default_instance_type, values = {'instance_type_id': FLAGS.default_instance_type,
'image_ref': FLAGS.vpn_image_id, 'image_ref': FLAGS.vpn_image_id,
'project_id': self.project.id 'project_id': self.project_id,
} }
instance = db.instance_create(self.context, values) instance = db.instance_create(self.context, values)
result = db.instance_get_project_vpn(self.context, self.project.id) result = db.instance_get_project_vpn(self.context.elevated(),
self.assertEqual(instance.id, result.id) self.project_id)
self.assertEqual(instance['id'], result['id'])
def test_instance_get_project_vpn_joins(self): def test_instance_get_project_vpn_joins(self):
result = db.fixed_ip_get_all(self.context)
values = {'instance_type_id': FLAGS.default_instance_type, values = {'instance_type_id': FLAGS.default_instance_type,
'image_ref': FLAGS.vpn_image_id, 'image_ref': FLAGS.vpn_image_id,
'project_id': self.project.id 'project_id': self.project_id,
} }
instance = db.instance_create(self.context, values) instance = db.instance_create(self.context, values)
_setup_networking(instance.id) _setup_networking(instance['id'])
result = db.instance_get_project_vpn(self.context, self.project.id) result = db.instance_get_project_vpn(self.context.elevated(),
self.assertEqual(instance.id, result.id) self.project_id)
self.assertEqual(instance['id'], result['id'])
self.assertEqual(result['fixed_ips'][0]['floating_ips'][0].address, self.assertEqual(result['fixed_ips'][0]['floating_ips'][0].address,
'1.2.1.2') '1.2.1.2')

View File

@@ -19,12 +19,9 @@ Tests For Scheduler Host Filters.
import json import json
from nova import exception from nova import exception
from nova import flags
from nova import test from nova import test
from nova.scheduler import host_filter from nova.scheduler import host_filter
FLAGS = flags.FLAGS
class FakeZoneManager: class FakeZoneManager:
pass pass
@@ -57,9 +54,9 @@ class HostFilterTestCase(test.TestCase):
'host_name-label': 'xs-%s' % multiplier} 'host_name-label': 'xs-%s' % multiplier}
def setUp(self): def setUp(self):
self.old_flag = FLAGS.default_host_filter super(HostFilterTestCase, self).setUp()
FLAGS.default_host_filter = \ default_host_filter = 'nova.scheduler.host_filter.AllHostsFilter'
'nova.scheduler.host_filter.AllHostsFilter' self.flags(default_host_filter=default_host_filter)
self.instance_type = dict(name='tiny', self.instance_type = dict(name='tiny',
memory_mb=50, memory_mb=50,
vcpus=10, vcpus=10,
@@ -76,9 +73,6 @@ class HostFilterTestCase(test.TestCase):
states['host%02d' % (x + 1)] = {'compute': self._host_caps(x)} states['host%02d' % (x + 1)] = {'compute': self._host_caps(x)}
self.zone_manager.service_states = states self.zone_manager.service_states = states
def tearDown(self):
FLAGS.default_host_filter = self.old_flag
def test_choose_filter(self): def test_choose_filter(self):
# Test default filter ... # Test default filter ...
hf = host_filter.choose_host_filter() hf = host_filter.choose_host_filter()

View File

@@ -32,14 +32,12 @@ from nova import flags
from nova import test from nova import test
from nova import utils from nova import utils
from nova.api.ec2 import cloud from nova.api.ec2 import cloud
from nova.auth import manager
from nova.compute import power_state from nova.compute import power_state
from nova.virt.libvirt import connection from nova.virt.libvirt import connection
from nova.virt.libvirt import firewall from nova.virt.libvirt import firewall
libvirt = None libvirt = None
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
flags.DECLARE('instances_path', 'nova.compute.manager')
def _concurrency(wait, done, target): def _concurrency(wait, done, target):
@@ -94,6 +92,7 @@ def _setup_networking(instance_id, ip='1.2.3.4'):
class CacheConcurrencyTestCase(test.TestCase): class CacheConcurrencyTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(CacheConcurrencyTestCase, self).setUp() super(CacheConcurrencyTestCase, self).setUp()
self.flags(instances_path='nova.compute.manager')
def fake_exists(fname): def fake_exists(fname):
basedir = os.path.join(FLAGS.instances_path, '_base') basedir = os.path.join(FLAGS.instances_path, '_base')
@@ -154,36 +153,15 @@ class LibvirtConnTestCase(test.TestCase):
super(LibvirtConnTestCase, self).setUp() super(LibvirtConnTestCase, self).setUp()
connection._late_load_cheetah() connection._late_load_cheetah()
self.flags(fake_call=True) self.flags(fake_call=True)
self.manager = manager.AuthManager() self.user_id = 'fake'
self.project_id = 'fake'
try: self.context = context.RequestContext(self.user_id, self.project_id)
pjs = self.manager.get_projects()
pjs = [p for p in pjs if p.name == 'fake']
if 0 != len(pjs):
self.manager.delete_project(pjs[0])
users = self.manager.get_users()
users = [u for u in users if u.name == 'fake']
if 0 != len(users):
self.manager.delete_user(users[0])
except Exception, e:
pass
users = self.manager.get_users()
self.user = self.manager.create_user('fake', 'fake', 'fake',
admin=True)
self.project = self.manager.create_project('fake', 'fake', 'fake')
self.network = utils.import_object(FLAGS.network_manager) self.network = utils.import_object(FLAGS.network_manager)
self.context = context.get_admin_context() self.context = context.get_admin_context()
FLAGS.instances_path = '' self.flags(instances_path='')
self.call_libvirt_dependant_setup = False self.call_libvirt_dependant_setup = False
self.test_ip = '10.11.12.13' self.test_ip = '10.11.12.13'
def tearDown(self):
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
super(LibvirtConnTestCase, self).tearDown()
test_instance = {'memory_kb': '1024000', test_instance = {'memory_kb': '1024000',
'basepath': '/some/path', 'basepath': '/some/path',
'bridge_name': 'br100', 'bridge_name': 'br100',
@@ -239,7 +217,7 @@ class LibvirtConnTestCase(test.TestCase):
'mac_address': 'fake', 'mac_address': 'fake',
'ip_address': 'fake', 'ip_address': 'fake',
'dhcp_server': 'fake', 'dhcp_server': 'fake',
'extra_params': 'fake' 'extra_params': 'fake',
} }
# Creating mocks # Creating mocks
@@ -344,7 +322,7 @@ class LibvirtConnTestCase(test.TestCase):
if not self.lazy_load_library_exists(): if not self.lazy_load_library_exists():
return return
FLAGS.image_service = 'nova.image.fake.FakeImageService' self.flags(image_service='nova.image.fake.FakeImageService')
# Start test # Start test
image_service = utils.import_object(FLAGS.image_service) image_service = utils.import_object(FLAGS.image_service)
@@ -368,7 +346,7 @@ class LibvirtConnTestCase(test.TestCase):
self.mox.ReplayAll() self.mox.ReplayAll()
conn = connection.LibvirtConnection(False) conn = connection.LibvirtConnection(False)
conn.snapshot(instance_ref, recv_meta['id']) conn.snapshot(self.context, instance_ref, recv_meta['id'])
snapshot = image_service.show(context, recv_meta['id']) snapshot = image_service.show(context, recv_meta['id'])
self.assertEquals(snapshot['properties']['image_state'], 'available') self.assertEquals(snapshot['properties']['image_state'], 'available')
@@ -379,7 +357,7 @@ class LibvirtConnTestCase(test.TestCase):
if not self.lazy_load_library_exists(): if not self.lazy_load_library_exists():
return return
FLAGS.image_service = 'nova.image.fake.FakeImageService' self.flags(image_service='nova.image.fake.FakeImageService')
# Start test # Start test
image_service = utils.import_object(FLAGS.image_service) image_service = utils.import_object(FLAGS.image_service)
@@ -408,7 +386,7 @@ class LibvirtConnTestCase(test.TestCase):
self.mox.ReplayAll() self.mox.ReplayAll()
conn = connection.LibvirtConnection(False) conn = connection.LibvirtConnection(False)
conn.snapshot(instance_ref, recv_meta['id']) conn.snapshot(self.context, instance_ref, recv_meta['id'])
snapshot = image_service.show(context, recv_meta['id']) snapshot = image_service.show(context, recv_meta['id'])
self.assertEquals(snapshot['properties']['image_state'], 'available') self.assertEquals(snapshot['properties']['image_state'], 'available')
@@ -441,8 +419,8 @@ class LibvirtConnTestCase(test.TestCase):
self.assertEquals(parameters[1].get('value'), 'fake') self.assertEquals(parameters[1].get('value'), 'fake')
def _check_xml_and_container(self, instance): def _check_xml_and_container(self, instance):
user_context = context.RequestContext(project=self.project, user_context = context.RequestContext(self.user_id,
user=self.user) self.project_id)
instance_ref = db.instance_create(user_context, instance) instance_ref = db.instance_create(user_context, instance)
_setup_networking(instance_ref['id'], self.test_ip) _setup_networking(instance_ref['id'], self.test_ip)
@@ -470,11 +448,10 @@ class LibvirtConnTestCase(test.TestCase):
def _check_xml_and_uri(self, instance, expect_ramdisk, expect_kernel, def _check_xml_and_uri(self, instance, expect_ramdisk, expect_kernel,
rescue=False): rescue=False):
user_context = context.RequestContext(project=self.project, user_context = context.RequestContext(self.user_id, self.project_id)
user=self.user)
instance_ref = db.instance_create(user_context, instance) instance_ref = db.instance_create(user_context, instance)
network_ref = db.project_get_networks(context.get_admin_context(), network_ref = db.project_get_networks(context.get_admin_context(),
self.project.id)[0] self.project_id)[0]
_setup_networking(instance_ref['id'], self.test_ip) _setup_networking(instance_ref['id'], self.test_ip)
@@ -544,7 +521,7 @@ class LibvirtConnTestCase(test.TestCase):
'disk.local')] 'disk.local')]
for (libvirt_type, (expected_uri, checks)) in type_uri_map.iteritems(): for (libvirt_type, (expected_uri, checks)) in type_uri_map.iteritems():
FLAGS.libvirt_type = libvirt_type self.flags(libvirt_type=libvirt_type)
conn = connection.LibvirtConnection(True) conn = connection.LibvirtConnection(True)
uri = conn.get_uri() uri = conn.get_uri()
@@ -569,9 +546,9 @@ class LibvirtConnTestCase(test.TestCase):
# checking against that later on. This way we make sure the # checking against that later on. This way we make sure the
# implementation doesn't fiddle around with the FLAGS. # implementation doesn't fiddle around with the FLAGS.
testuri = 'something completely different' testuri = 'something completely different'
FLAGS.libvirt_uri = testuri self.flags(libvirt_uri=testuri)
for (libvirt_type, (expected_uri, checks)) in type_uri_map.iteritems(): for (libvirt_type, (expected_uri, checks)) in type_uri_map.iteritems():
FLAGS.libvirt_type = libvirt_type self.flags(libvirt_type=libvirt_type)
conn = connection.LibvirtConnection(True) conn = connection.LibvirtConnection(True)
uri = conn.get_uri() uri = conn.get_uri()
self.assertEquals(uri, testuri) self.assertEquals(uri, testuri)
@@ -579,8 +556,7 @@ class LibvirtConnTestCase(test.TestCase):
def test_update_available_resource_works_correctly(self): def test_update_available_resource_works_correctly(self):
"""Confirm compute_node table is updated successfully.""" """Confirm compute_node table is updated successfully."""
org_path = FLAGS.instances_path = '' self.flags(instances_path='.')
FLAGS.instances_path = '.'
# Prepare mocks # Prepare mocks
def getVersion(): def getVersion():
@@ -627,12 +603,10 @@ class LibvirtConnTestCase(test.TestCase):
self.assertTrue(compute_node['hypervisor_version'] > 0) self.assertTrue(compute_node['hypervisor_version'] > 0)
db.service_destroy(self.context, service_ref['id']) db.service_destroy(self.context, service_ref['id'])
FLAGS.instances_path = org_path
def test_update_resource_info_no_compute_record_found(self): def test_update_resource_info_no_compute_record_found(self):
"""Raise exception if no recorde found on services table.""" """Raise exception if no recorde found on services table."""
org_path = FLAGS.instances_path = '' self.flags(instances_path='.')
FLAGS.instances_path = '.'
self.create_fake_libvirt_mock() self.create_fake_libvirt_mock()
self.mox.ReplayAll() self.mox.ReplayAll()
@@ -641,8 +615,6 @@ class LibvirtConnTestCase(test.TestCase):
conn.update_available_resource, conn.update_available_resource,
self.context, 'dummy') self.context, 'dummy')
FLAGS.instances_path = org_path
def test_ensure_filtering_rules_for_instance_timeout(self): def test_ensure_filtering_rules_for_instance_timeout(self):
"""ensure_filtering_fules_for_instance() finishes with timeout.""" """ensure_filtering_fules_for_instance() finishes with timeout."""
# Skip if non-libvirt environment # Skip if non-libvirt environment
@@ -759,7 +731,7 @@ class LibvirtConnTestCase(test.TestCase):
network_info = _create_network_info() network_info = _create_network_info()
try: try:
conn.spawn(instance, network_info) conn.spawn(self.context, instance, network_info)
except Exception, e: except Exception, e:
count = (0 <= str(e.message).find('Unexpected method call')) count = (0 <= str(e.message).find('Unexpected method call'))
@@ -802,11 +774,9 @@ class IptablesFirewallTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(IptablesFirewallTestCase, self).setUp() super(IptablesFirewallTestCase, self).setUp()
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('fake', 'fake', 'fake', self.project_id = 'fake'
admin=True) self.context = context.RequestContext(self.user_id, self.project_id)
self.project = self.manager.create_project('fake', 'fake', 'fake')
self.context = context.RequestContext('fake', 'fake')
self.network = utils.import_object(FLAGS.network_manager) self.network = utils.import_object(FLAGS.network_manager)
class FakeLibvirtConnection(object): class FakeLibvirtConnection(object):
@@ -832,11 +802,6 @@ class IptablesFirewallTestCase(test.TestCase):
connection.libxml2 = __import__('libxml2') connection.libxml2 = __import__('libxml2')
return True return True
def tearDown(self):
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
super(IptablesFirewallTestCase, self).tearDown()
in_nat_rules = [ in_nat_rules = [
'# Generated by iptables-save v1.4.10 on Sat Feb 19 00:03:19 2011', '# Generated by iptables-save v1.4.10 on Sat Feb 19 00:03:19 2011',
'*nat', '*nat',
@@ -1119,11 +1084,9 @@ class NWFilterTestCase(test.TestCase):
class Mock(object): class Mock(object):
pass pass
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('fake', 'fake', 'fake', self.project_id = 'fake'
admin=True) self.context = context.RequestContext(self.user_id, self.project_id)
self.project = self.manager.create_project('fake', 'fake', 'fake')
self.context = context.RequestContext(self.user, self.project)
self.fake_libvirt_connection = Mock() self.fake_libvirt_connection = Mock()
@@ -1131,11 +1094,6 @@ class NWFilterTestCase(test.TestCase):
self.fw = firewall.NWFilterFirewall( self.fw = firewall.NWFilterFirewall(
lambda: self.fake_libvirt_connection) lambda: self.fake_libvirt_connection)
def tearDown(self):
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
super(NWFilterTestCase, self).tearDown()
def test_cidr_rule_nwfilter_xml(self): def test_cidr_rule_nwfilter_xml(self):
cloud_controller = cloud.CloudController() cloud_controller = cloud.CloudController()
cloud_controller.create_security_group(self.context, cloud_controller.create_security_group(self.context,

View File

@@ -17,7 +17,6 @@
from nova import db from nova import db
from nova import exception from nova import exception
from nova import flags
from nova import log as logging from nova import log as logging
from nova import test from nova import test
from nova.network import manager as network_manager from nova.network import manager as network_manager
@@ -26,7 +25,6 @@ from nova.network import manager as network_manager
import mox import mox
FLAGS = flags.FLAGS
LOG = logging.getLogger('nova.tests.network') LOG = logging.getLogger('nova.tests.network')

View File

@@ -20,24 +20,23 @@ Unit Tests for remote procedure calls using queue
""" """
from nova import context from nova import context
from nova import flags
from nova import log as logging from nova import log as logging
from nova import rpc from nova import rpc
from nova import test from nova import test
FLAGS = flags.FLAGS
LOG = logging.getLogger('nova.tests.rpc') LOG = logging.getLogger('nova.tests.rpc')
class RpcTestCase(test.TestCase): class RpcTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(RpcTestCase, self).setUp() super(RpcTestCase, self).setUp()
self.conn = rpc.Connection.instance(True) self.conn = rpc.create_connection(True)
self.receiver = TestReceiver() self.receiver = TestReceiver()
self.consumer = rpc.TopicAdapterConsumer(connection=self.conn, self.consumer = rpc.create_consumer(self.conn,
topic='test', 'test',
proxy=self.receiver) self.receiver,
False)
self.consumer.attach_to_eventlet() self.consumer.attach_to_eventlet()
self.context = context.get_admin_context() self.context = context.get_admin_context()
@@ -129,6 +128,8 @@ class RpcTestCase(test.TestCase):
"""Calls echo in the passed queue""" """Calls echo in the passed queue"""
LOG.debug(_("Nested received %(queue)s, %(value)s") LOG.debug(_("Nested received %(queue)s, %(value)s")
% locals()) % locals())
# TODO: so, it will replay the context and use the same REQID?
# that's bizarre.
ret = rpc.call(context, ret = rpc.call(context,
queue, queue,
{"method": "echo", {"method": "echo",
@@ -137,10 +138,11 @@ class RpcTestCase(test.TestCase):
return value return value
nested = Nested() nested = Nested()
conn = rpc.Connection.instance(True) conn = rpc.create_connection(True)
consumer = rpc.TopicAdapterConsumer(connection=conn, consumer = rpc.create_consumer(conn,
topic='nested', 'nested',
proxy=nested) nested,
False)
consumer.attach_to_eventlet() consumer.attach_to_eventlet()
value = 42 value = 42
result = rpc.call(self.context, result = rpc.call(self.context,
@@ -149,47 +151,6 @@ class RpcTestCase(test.TestCase):
"value": value}}) "value": value}})
self.assertEqual(value, result) self.assertEqual(value, result)
def test_connectionpool_single(self):
"""Test that ConnectionPool recycles a single connection."""
conn1 = rpc.ConnectionPool.get()
rpc.ConnectionPool.put(conn1)
conn2 = rpc.ConnectionPool.get()
rpc.ConnectionPool.put(conn2)
self.assertEqual(conn1, conn2)
def test_connectionpool_double(self):
"""Test that ConnectionPool returns and reuses separate connections.
When called consecutively we should get separate connections and upon
returning them those connections should be reused for future calls
before generating a new connection.
"""
conn1 = rpc.ConnectionPool.get()
conn2 = rpc.ConnectionPool.get()
self.assertNotEqual(conn1, conn2)
rpc.ConnectionPool.put(conn1)
rpc.ConnectionPool.put(conn2)
conn3 = rpc.ConnectionPool.get()
conn4 = rpc.ConnectionPool.get()
self.assertEqual(conn1, conn3)
self.assertEqual(conn2, conn4)
def test_connectionpool_limit(self):
"""Test connection pool limit and connection uniqueness."""
max_size = FLAGS.rpc_conn_pool_size
conns = []
for i in xrange(max_size):
conns.append(rpc.ConnectionPool.get())
self.assertFalse(rpc.ConnectionPool.free_items)
self.assertEqual(rpc.ConnectionPool.current_size,
rpc.ConnectionPool.max_size)
self.assertEqual(len(set(conns)), max_size)
class TestReceiver(object): class TestReceiver(object):
"""Simple Proxy class so the consumer has methods to call. """Simple Proxy class so the consumer has methods to call.

View File

@@ -0,0 +1,88 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Tests For RPC AMQP.
"""
from nova import context
from nova import log as logging
from nova import rpc
from nova.rpc import amqp
from nova import test
LOG = logging.getLogger('nova.tests.rpc')
class RpcAMQPTestCase(test.TestCase):
def setUp(self):
super(RpcAMQPTestCase, self).setUp()
self.conn = rpc.create_connection(True)
self.receiver = TestReceiver()
self.consumer = rpc.create_consumer(self.conn,
'test',
self.receiver,
False)
self.consumer.attach_to_eventlet()
self.context = context.get_admin_context()
def test_connectionpool_single(self):
"""Test that ConnectionPool recycles a single connection."""
conn1 = amqp.ConnectionPool.get()
amqp.ConnectionPool.put(conn1)
conn2 = amqp.ConnectionPool.get()
amqp.ConnectionPool.put(conn2)
self.assertEqual(conn1, conn2)
class TestReceiver(object):
"""Simple Proxy class so the consumer has methods to call.
Uses static methods because we aren't actually storing any state.
"""
@staticmethod
def echo(context, value):
"""Simply returns whatever value is sent in."""
LOG.debug(_("Received %s"), value)
return value
@staticmethod
def context(context, value):
"""Returns dictionary version of context."""
LOG.debug(_("Received %s"), context)
return context.to_dict()
@staticmethod
def echo_three_times(context, value):
context.reply(value)
context.reply(value + 1)
context.reply(value + 2)
@staticmethod
def echo_three_times_yield(context, value):
yield value
yield value + 1
yield value + 2
@staticmethod
def fail(context, value):
"""Raises an exception with the value sent in."""
raise Exception(value)

View File

@@ -1,53 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import StringIO
import sys
from nova import twistd
from nova import exception
from nova import flags
from nova import test
FLAGS = flags.FLAGS
class TwistdTestCase(test.TestCase):
def setUp(self):
super(TwistdTestCase, self).setUp()
self.Options = twistd.WrapTwistedOptions(twistd.TwistdServerOptions)
sys.stdout = StringIO.StringIO()
def tearDown(self):
super(TwistdTestCase, self).tearDown()
sys.stdout = sys.__stdout__
def test_basic(self):
options = self.Options()
argv = options.parseOptions()
def test_logfile(self):
options = self.Options()
argv = options.parseOptions(['--logfile=foo'])
self.assertEqual(FLAGS.logfile, 'foo')
def test_help(self):
options = self.Options()
self.assertRaises(SystemExit, options.parseOptions, ['--help'])
self.assert_('pidfile' in sys.stdout.getvalue())

View File

@@ -19,11 +19,11 @@
Test suite for VMWareAPI. Test suite for VMWareAPI.
""" """
from nova import context
from nova import db from nova import db
from nova import flags from nova import flags
from nova import test from nova import test
from nova import utils from nova import utils
from nova.auth import manager
from nova.compute import power_state from nova.compute import power_state
from nova.tests.glance import stubs as glance_stubs from nova.tests.glance import stubs as glance_stubs
from nova.tests.vmwareapi import db_fakes from nova.tests.vmwareapi import db_fakes
@@ -40,13 +40,13 @@ class VMWareAPIVMTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(VMWareAPIVMTestCase, self).setUp() super(VMWareAPIVMTestCase, self).setUp()
self.context = context.RequestContext('fake', 'fake', False)
self.flags(vmwareapi_host_ip='test_url', self.flags(vmwareapi_host_ip='test_url',
vmwareapi_host_username='test_username', vmwareapi_host_username='test_username',
vmwareapi_host_password='test_pass') vmwareapi_host_password='test_pass')
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('fake', 'fake', 'fake', self.project_id = 'fake'
admin=True) self.context = context.RequestContext(self.user_id, self.project_id)
self.project = self.manager.create_project('fake', 'fake', 'fake')
self.network = utils.import_object(FLAGS.network_manager) self.network = utils.import_object(FLAGS.network_manager)
vmwareapi_fake.reset() vmwareapi_fake.reset()
db_fakes.stub_out_db_instance_api(self.stubs) db_fakes.stub_out_db_instance_api(self.stubs)
@@ -77,14 +77,12 @@ class VMWareAPIVMTestCase(test.TestCase):
def tearDown(self): def tearDown(self):
super(VMWareAPIVMTestCase, self).tearDown() super(VMWareAPIVMTestCase, self).tearDown()
vmwareapi_fake.cleanup() vmwareapi_fake.cleanup()
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
def _create_instance_in_the_db(self): def _create_instance_in_the_db(self):
values = {'name': 1, values = {'name': 1,
'id': 1, 'id': 1,
'project_id': self.project.id, 'project_id': self.project_id,
'user_id': self.user.id, 'user_id': self.user_id,
'image_ref': "1", 'image_ref': "1",
'kernel_id': "1", 'kernel_id': "1",
'ramdisk_id': "1", 'ramdisk_id': "1",
@@ -97,7 +95,7 @@ class VMWareAPIVMTestCase(test.TestCase):
"""Create and spawn the VM.""" """Create and spawn the VM."""
self._create_instance_in_the_db() self._create_instance_in_the_db()
self.type_data = db.instance_type_get_by_name(None, 'm1.large') self.type_data = db.instance_type_get_by_name(None, 'm1.large')
self.conn.spawn(self.instance, self.network_info) self.conn.spawn(self.context, self.instance, self.network_info)
self._check_vm_record() self._check_vm_record()
def _check_vm_record(self): def _check_vm_record(self):
@@ -159,14 +157,14 @@ class VMWareAPIVMTestCase(test.TestCase):
self._create_vm() self._create_vm()
info = self.conn.get_info(1) info = self.conn.get_info(1)
self._check_vm_info(info, power_state.RUNNING) self._check_vm_info(info, power_state.RUNNING)
self.conn.snapshot(self.instance, "Test-Snapshot") self.conn.snapshot(self.context, self.instance, "Test-Snapshot")
info = self.conn.get_info(1) info = self.conn.get_info(1)
self._check_vm_info(info, power_state.RUNNING) self._check_vm_info(info, power_state.RUNNING)
def test_snapshot_non_existent(self): def test_snapshot_non_existent(self):
self._create_instance_in_the_db() self._create_instance_in_the_db()
self.assertRaises(Exception, self.conn.snapshot, self.instance, self.assertRaises(Exception, self.conn.snapshot, self.context,
"Test-Snapshot") self.instance, "Test-Snapshot")
def test_reboot(self): def test_reboot(self):
self._create_vm() self._create_vm()

View File

@@ -30,7 +30,6 @@ from nova import flags
from nova import log as logging from nova import log as logging
from nova import test from nova import test
from nova import utils from nova import utils
from nova.auth import manager
from nova.compute import instance_types from nova.compute import instance_types
from nova.compute import power_state from nova.compute import power_state
from nova import exception from nova import exception
@@ -69,15 +68,17 @@ class XenAPIVolumeTestCase(test.TestCase):
def setUp(self): def setUp(self):
super(XenAPIVolumeTestCase, self).setUp() super(XenAPIVolumeTestCase, self).setUp()
self.stubs = stubout.StubOutForTesting() self.stubs = stubout.StubOutForTesting()
self.context = context.RequestContext('fake', 'fake', False) self.user_id = 'fake'
FLAGS.target_host = '127.0.0.1' self.project_id = 'fake'
FLAGS.xenapi_connection_url = 'test_url' self.context = context.RequestContext(self.user_id, self.project_id)
FLAGS.xenapi_connection_password = 'test_pass' self.flags(target_host='127.0.0.1',
xenapi_connection_url='test_url',
xenapi_connection_password='test_pass')
db_fakes.stub_out_db_instance_api(self.stubs) db_fakes.stub_out_db_instance_api(self.stubs)
stubs.stub_out_get_target(self.stubs) stubs.stub_out_get_target(self.stubs)
xenapi_fake.reset() xenapi_fake.reset()
self.values = {'id': 1, self.values = {'id': 1,
'project_id': 'fake', 'project_id': self.user_id,
'user_id': 'fake', 'user_id': 'fake',
'image_ref': 1, 'image_ref': 1,
'kernel_id': 2, 'kernel_id': 2,
@@ -169,14 +170,14 @@ def reset_network(*args):
pass pass
def _find_rescue_vbd_ref(*args):
pass
class XenAPIVMTestCase(test.TestCase): class XenAPIVMTestCase(test.TestCase):
"""Unit tests for VM operations.""" """Unit tests for VM operations."""
def setUp(self): def setUp(self):
super(XenAPIVMTestCase, self).setUp() super(XenAPIVMTestCase, self).setUp()
self.manager = manager.AuthManager()
self.user = self.manager.create_user('fake', 'fake', 'fake',
admin=True)
self.project = self.manager.create_project('fake', 'fake', 'fake')
self.network = utils.import_object(FLAGS.network_manager) self.network = utils.import_object(FLAGS.network_manager)
self.stubs = stubout.StubOutForTesting() self.stubs = stubout.StubOutForTesting()
self.flags(xenapi_connection_url='test_url', self.flags(xenapi_connection_url='test_url',
@@ -192,10 +193,14 @@ class XenAPIVMTestCase(test.TestCase):
stubs.stubout_stream_disk(self.stubs) stubs.stubout_stream_disk(self.stubs)
stubs.stubout_is_vdi_pv(self.stubs) stubs.stubout_is_vdi_pv(self.stubs)
self.stubs.Set(vmops.VMOps, 'reset_network', reset_network) self.stubs.Set(vmops.VMOps, 'reset_network', reset_network)
self.stubs.Set(vmops.VMOps, '_find_rescue_vbd_ref',
_find_rescue_vbd_ref)
stubs.stub_out_vm_methods(self.stubs) stubs.stub_out_vm_methods(self.stubs)
glance_stubs.stubout_glance_client(self.stubs) glance_stubs.stubout_glance_client(self.stubs)
fake_utils.stub_out_utils_execute(self.stubs) fake_utils.stub_out_utils_execute(self.stubs)
self.context = context.RequestContext('fake', 'fake', False) self.user_id = 'fake'
self.project_id = 'fake'
self.context = context.RequestContext(self.user_id, self.project_id)
self.conn = xenapi_conn.get_connection(False) self.conn = xenapi_conn.get_connection(False)
def test_parallel_builds(self): def test_parallel_builds(self):
@@ -227,10 +232,10 @@ class XenAPIVMTestCase(test.TestCase):
'mac': 'DE:AD:BE:EF:00:00', 'mac': 'DE:AD:BE:EF:00:00',
'rxtx_cap': 3})] 'rxtx_cap': 3})]
instance = db.instance_create(self.context, values) instance = db.instance_create(self.context, values)
self.conn.spawn(instance, network_info) self.conn.spawn(self.context, instance, network_info)
gt1 = eventlet.spawn(_do_build, 1, self.project.id, self.user.id) gt1 = eventlet.spawn(_do_build, 1, self.project_id, self.user_id)
gt2 = eventlet.spawn(_do_build, 2, self.project.id, self.user.id) gt2 = eventlet.spawn(_do_build, 2, self.project_id, self.user_id)
gt1.wait() gt1.wait()
gt2.wait() gt2.wait()
@@ -257,14 +262,15 @@ class XenAPIVMTestCase(test.TestCase):
instance = self._create_instance() instance = self._create_instance()
name = "MySnapshot" name = "MySnapshot"
self.assertRaises(exception.Error, self.conn.snapshot, instance, name) self.assertRaises(exception.Error, self.conn.snapshot,
self.context, instance, name)
def test_instance_snapshot(self): def test_instance_snapshot(self):
stubs.stubout_instance_snapshot(self.stubs) stubs.stubout_instance_snapshot(self.stubs)
instance = self._create_instance() instance = self._create_instance()
name = "MySnapshot" name = "MySnapshot"
template_vm_ref = self.conn.snapshot(instance, name) template_vm_ref = self.conn.snapshot(self.context, instance, name)
def ensure_vm_was_torn_down(): def ensure_vm_was_torn_down():
vm_labels = [] vm_labels = []
@@ -397,12 +403,12 @@ class XenAPIVMTestCase(test.TestCase):
instance_type_id="3", os_type="linux", instance_type_id="3", os_type="linux",
architecture="x86-64", instance_id=1, architecture="x86-64", instance_id=1,
check_injection=False, check_injection=False,
create_record=True): create_record=True, empty_dns=False):
stubs.stubout_loopingcall_start(self.stubs) stubs.stubout_loopingcall_start(self.stubs)
if create_record: if create_record:
values = {'id': instance_id, values = {'id': instance_id,
'project_id': self.project.id, 'project_id': self.project_id,
'user_id': self.user.id, 'user_id': self.user_id,
'image_ref': image_ref, 'image_ref': image_ref,
'kernel_id': kernel_id, 'kernel_id': kernel_id,
'ramdisk_id': ramdisk_id, 'ramdisk_id': ramdisk_id,
@@ -426,14 +432,23 @@ class XenAPIVMTestCase(test.TestCase):
'label': 'fake', 'label': 'fake',
'mac': 'DE:AD:BE:EF:00:00', 'mac': 'DE:AD:BE:EF:00:00',
'rxtx_cap': 3})] 'rxtx_cap': 3})]
self.conn.spawn(instance, network_info) if empty_dns:
network_info[0][1]['dns'] = []
self.conn.spawn(self.context, instance, network_info)
self.create_vm_record(self.conn, os_type, instance_id) self.create_vm_record(self.conn, os_type, instance_id)
self.check_vm_record(self.conn, check_injection) self.check_vm_record(self.conn, check_injection)
self.assertTrue(instance.os_type) self.assertTrue(instance.os_type)
self.assertTrue(instance.architecture) self.assertTrue(instance.architecture)
def test_spawn_empty_dns(self):
""""Test spawning with an empty dns list"""
self._test_spawn(glance_stubs.FakeGlance.IMAGE_VHD, None, None,
os_type="linux", architecture="x86-64",
empty_dns=True)
self.check_vm_params_for_linux()
def test_spawn_not_enough_memory(self): def test_spawn_not_enough_memory(self):
FLAGS.xenapi_image_service = 'glance'
self.assertRaises(Exception, self.assertRaises(Exception,
self._test_spawn, self._test_spawn,
1, 2, 3, "4") # m1.xlarge 1, 2, 3, "4") # m1.xlarge
@@ -445,7 +460,6 @@ class XenAPIVMTestCase(test.TestCase):
""" """
vdi_recs_start = self._list_vdis() vdi_recs_start = self._list_vdis()
FLAGS.xenapi_image_service = 'glance'
stubs.stubout_fetch_image_glance_disk(self.stubs) stubs.stubout_fetch_image_glance_disk(self.stubs)
self.assertRaises(xenapi_fake.Failure, self.assertRaises(xenapi_fake.Failure,
self._test_spawn, 1, 2, 3) self._test_spawn, 1, 2, 3)
@@ -460,7 +474,6 @@ class XenAPIVMTestCase(test.TestCase):
""" """
vdi_recs_start = self._list_vdis() vdi_recs_start = self._list_vdis()
FLAGS.xenapi_image_service = 'glance'
stubs.stubout_create_vm(self.stubs) stubs.stubout_create_vm(self.stubs)
self.assertRaises(xenapi_fake.Failure, self.assertRaises(xenapi_fake.Failure,
self._test_spawn, 1, 2, 3) self._test_spawn, 1, 2, 3)
@@ -468,22 +481,12 @@ class XenAPIVMTestCase(test.TestCase):
vdi_recs_end = self._list_vdis() vdi_recs_end = self._list_vdis()
self._check_vdis(vdi_recs_start, vdi_recs_end) self._check_vdis(vdi_recs_start, vdi_recs_end)
def test_spawn_raw_objectstore(self):
FLAGS.xenapi_image_service = 'objectstore'
self._test_spawn(1, None, None)
def test_spawn_objectstore(self):
FLAGS.xenapi_image_service = 'objectstore'
self._test_spawn(1, 2, 3)
@stub_vm_utils_with_vdi_attached_here @stub_vm_utils_with_vdi_attached_here
def test_spawn_raw_glance(self): def test_spawn_raw_glance(self):
FLAGS.xenapi_image_service = 'glance'
self._test_spawn(glance_stubs.FakeGlance.IMAGE_RAW, None, None) self._test_spawn(glance_stubs.FakeGlance.IMAGE_RAW, None, None)
self.check_vm_params_for_linux() self.check_vm_params_for_linux()
def test_spawn_vhd_glance_linux(self): def test_spawn_vhd_glance_linux(self):
FLAGS.xenapi_image_service = 'glance'
self._test_spawn(glance_stubs.FakeGlance.IMAGE_VHD, None, None, self._test_spawn(glance_stubs.FakeGlance.IMAGE_VHD, None, None,
os_type="linux", architecture="x86-64") os_type="linux", architecture="x86-64")
self.check_vm_params_for_linux() self.check_vm_params_for_linux()
@@ -512,20 +515,17 @@ class XenAPIVMTestCase(test.TestCase):
self.assertEqual(len(self.vm['VBDs']), 1) self.assertEqual(len(self.vm['VBDs']), 1)
def test_spawn_vhd_glance_windows(self): def test_spawn_vhd_glance_windows(self):
FLAGS.xenapi_image_service = 'glance'
self._test_spawn(glance_stubs.FakeGlance.IMAGE_VHD, None, None, self._test_spawn(glance_stubs.FakeGlance.IMAGE_VHD, None, None,
os_type="windows", architecture="i386") os_type="windows", architecture="i386")
self.check_vm_params_for_windows() self.check_vm_params_for_windows()
def test_spawn_glance(self): def test_spawn_glance(self):
FLAGS.xenapi_image_service = 'glance'
self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE, self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE,
glance_stubs.FakeGlance.IMAGE_KERNEL, glance_stubs.FakeGlance.IMAGE_KERNEL,
glance_stubs.FakeGlance.IMAGE_RAMDISK) glance_stubs.FakeGlance.IMAGE_RAMDISK)
self.check_vm_params_for_linux_with_external_kernel() self.check_vm_params_for_linux_with_external_kernel()
def test_spawn_netinject_file(self): def test_spawn_netinject_file(self):
FLAGS.xenapi_image_service = 'glance'
db_fakes.stub_out_db_instance_api(self.stubs, injected=True) db_fakes.stub_out_db_instance_api(self.stubs, injected=True)
self._tee_executed = False self._tee_executed = False
@@ -551,7 +551,6 @@ class XenAPIVMTestCase(test.TestCase):
# Capture the sudo tee .../etc/network/interfaces command # Capture the sudo tee .../etc/network/interfaces command
(r'(sudo\s+)?tee.*interfaces', _tee_handler), (r'(sudo\s+)?tee.*interfaces', _tee_handler),
]) ])
FLAGS.xenapi_image_service = 'glance'
self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE, self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE,
glance_stubs.FakeGlance.IMAGE_KERNEL, glance_stubs.FakeGlance.IMAGE_KERNEL,
glance_stubs.FakeGlance.IMAGE_RAMDISK, glance_stubs.FakeGlance.IMAGE_RAMDISK,
@@ -559,7 +558,6 @@ class XenAPIVMTestCase(test.TestCase):
self.assertTrue(self._tee_executed) self.assertTrue(self._tee_executed)
def test_spawn_netinject_xenstore(self): def test_spawn_netinject_xenstore(self):
FLAGS.xenapi_image_service = 'glance'
db_fakes.stub_out_db_instance_api(self.stubs, injected=True) db_fakes.stub_out_db_instance_api(self.stubs, injected=True)
self._tee_executed = False self._tee_executed = False
@@ -604,7 +602,7 @@ class XenAPIVMTestCase(test.TestCase):
self.assertFalse(self._tee_executed) self.assertFalse(self._tee_executed)
def test_spawn_vlanmanager(self): def test_spawn_vlanmanager(self):
self.flags(xenapi_image_service='glance', self.flags(image_service='nova.image.glance.GlanceImageService',
network_manager='nova.network.manager.VlanManager', network_manager='nova.network.manager.VlanManager',
vlan_interface='fake0') vlan_interface='fake0')
@@ -626,7 +624,7 @@ class XenAPIVMTestCase(test.TestCase):
host=FLAGS.host, host=FLAGS.host,
vpn=None, vpn=None,
instance_type_id=1, instance_type_id=1,
project_id=self.project.id) project_id=self.project_id)
self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE, self._test_spawn(glance_stubs.FakeGlance.IMAGE_MACHINE,
glance_stubs.FakeGlance.IMAGE_KERNEL, glance_stubs.FakeGlance.IMAGE_KERNEL,
glance_stubs.FakeGlance.IMAGE_RAMDISK, glance_stubs.FakeGlance.IMAGE_RAMDISK,
@@ -648,7 +646,7 @@ class XenAPIVMTestCase(test.TestCase):
self.flags(flat_injected=False) self.flags(flat_injected=False)
instance = self._create_instance() instance = self._create_instance()
conn = xenapi_conn.get_connection(False) conn = xenapi_conn.get_connection(False)
conn.rescue(instance, None, []) conn.rescue(self.context, instance, None, [])
def test_unrescue(self): def test_unrescue(self):
instance = self._create_instance() instance = self._create_instance()
@@ -656,21 +654,13 @@ class XenAPIVMTestCase(test.TestCase):
# Ensure that it will not unrescue a non-rescued instance. # Ensure that it will not unrescue a non-rescued instance.
self.assertRaises(Exception, conn.unrescue, instance, None) self.assertRaises(Exception, conn.unrescue, instance, None)
def tearDown(self):
super(XenAPIVMTestCase, self).tearDown()
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
self.vm_info = None
self.vm = None
self.stubs.UnsetAll()
def _create_instance(self, instance_id=1, spawn=True): def _create_instance(self, instance_id=1, spawn=True):
"""Creates and spawns a test instance.""" """Creates and spawns a test instance."""
stubs.stubout_loopingcall_start(self.stubs) stubs.stubout_loopingcall_start(self.stubs)
values = { values = {
'id': instance_id, 'id': instance_id,
'project_id': self.project.id, 'project_id': self.project_id,
'user_id': self.user.id, 'user_id': self.user_id,
'image_ref': 1, 'image_ref': 1,
'kernel_id': 2, 'kernel_id': 2,
'ramdisk_id': 3, 'ramdisk_id': 3,
@@ -693,7 +683,7 @@ class XenAPIVMTestCase(test.TestCase):
'mac': 'DE:AD:BE:EF:00:00', 'mac': 'DE:AD:BE:EF:00:00',
'rxtx_cap': 3})] 'rxtx_cap': 3})]
if spawn: if spawn:
self.conn.spawn(instance, network_info) self.conn.spawn(self.context, instance, network_info)
return instance return instance
@@ -745,21 +735,19 @@ class XenAPIMigrateInstance(test.TestCase):
def setUp(self): def setUp(self):
super(XenAPIMigrateInstance, self).setUp() super(XenAPIMigrateInstance, self).setUp()
self.stubs = stubout.StubOutForTesting() self.stubs = stubout.StubOutForTesting()
FLAGS.target_host = '127.0.0.1' self.flags(target_host='127.0.0.1',
FLAGS.xenapi_connection_url = 'test_url' xenapi_connection_url='test_url',
FLAGS.xenapi_connection_password = 'test_pass' xenapi_connection_password='test_pass')
db_fakes.stub_out_db_instance_api(self.stubs) db_fakes.stub_out_db_instance_api(self.stubs)
stubs.stub_out_get_target(self.stubs) stubs.stub_out_get_target(self.stubs)
xenapi_fake.reset() xenapi_fake.reset()
xenapi_fake.create_network('fake', FLAGS.flat_network_bridge) xenapi_fake.create_network('fake', FLAGS.flat_network_bridge)
self.manager = manager.AuthManager() self.user_id = 'fake'
self.user = self.manager.create_user('fake', 'fake', 'fake', self.project_id = 'fake'
admin=True) self.context = context.RequestContext(self.user_id, self.project_id)
self.project = self.manager.create_project('fake', 'fake', 'fake')
self.context = context.RequestContext('fake', 'fake', False)
self.values = {'id': 1, self.values = {'id': 1,
'project_id': self.project.id, 'project_id': self.project_id,
'user_id': self.user.id, 'user_id': self.user_id,
'image_ref': 1, 'image_ref': 1,
'kernel_id': None, 'kernel_id': None,
'ramdisk_id': None, 'ramdisk_id': None,
@@ -773,20 +761,33 @@ class XenAPIMigrateInstance(test.TestCase):
stubs.stubout_get_this_vm_uuid(self.stubs) stubs.stubout_get_this_vm_uuid(self.stubs)
glance_stubs.stubout_glance_client(self.stubs) glance_stubs.stubout_glance_client(self.stubs)
def tearDown(self):
super(XenAPIMigrateInstance, self).tearDown()
self.manager.delete_project(self.project)
self.manager.delete_user(self.user)
self.stubs.UnsetAll()
def test_migrate_disk_and_power_off(self): def test_migrate_disk_and_power_off(self):
instance = db.instance_create(self.context, self.values) instance = db.instance_create(self.context, self.values)
stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests) stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests)
conn = xenapi_conn.get_connection(False) conn = xenapi_conn.get_connection(False)
conn.migrate_disk_and_power_off(instance, '127.0.0.1') conn.migrate_disk_and_power_off(instance, '127.0.0.1')
def test_finish_resize(self):
def test_revert_migrate(self):
instance = db.instance_create(self.context, self.values) instance = db.instance_create(self.context, self.values)
self.called = False
self.fake_vm_start_called = False
self.fake_revert_migration_called = False
def fake_vm_start(*args, **kwargs):
self.fake_vm_start_called = True
def fake_vdi_resize(*args, **kwargs):
self.called = True
def fake_revert_migration(*args, **kwargs):
self.fake_revert_migration_called = True
self.stubs.Set(stubs.FakeSessionForMigrationTests,
"VDI_resize_online", fake_vdi_resize)
self.stubs.Set(vmops.VMOps, '_start', fake_vm_start)
self.stubs.Set(vmops.VMOps, 'revert_migration', fake_revert_migration)
stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests) stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests)
stubs.stubout_loopingcall_start(self.stubs) stubs.stubout_loopingcall_start(self.stubs)
conn = xenapi_conn.get_connection(False) conn = xenapi_conn.get_connection(False)
@@ -804,8 +805,131 @@ class XenAPIMigrateInstance(test.TestCase):
'label': 'fake', 'label': 'fake',
'mac': 'DE:AD:BE:EF:00:00', 'mac': 'DE:AD:BE:EF:00:00',
'rxtx_cap': 3})] 'rxtx_cap': 3})]
conn.finish_resize(instance, dict(base_copy='hurr', cow='durr'), conn.finish_migration(self.context, instance,
network_info) dict(base_copy='hurr', cow='durr'),
network_info, resize_instance=True)
self.assertEqual(self.called, True)
self.assertEqual(self.fake_vm_start_called, True)
conn.revert_migration(instance)
self.assertEqual(self.fake_revert_migration_called, True)
def test_finish_migrate(self):
instance = db.instance_create(self.context, self.values)
self.called = False
self.fake_vm_start_called = False
def fake_vm_start(*args, **kwargs):
self.fake_vm_start_called = True
def fake_vdi_resize(*args, **kwargs):
self.called = True
self.stubs.Set(stubs.FakeSessionForMigrationTests,
"VDI_resize_online", fake_vdi_resize)
self.stubs.Set(vmops.VMOps, '_start', fake_vm_start)
stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests)
stubs.stubout_loopingcall_start(self.stubs)
conn = xenapi_conn.get_connection(False)
network_info = [({'bridge': 'fa0', 'id': 0, 'injected': False},
{'broadcast': '192.168.0.255',
'dns': ['192.168.0.1'],
'gateway': '192.168.0.1',
'gateway6': 'dead:beef::1',
'ip6s': [{'enabled': '1',
'ip': 'dead:beef::dcad:beff:feef:0',
'netmask': '64'}],
'ips': [{'enabled': '1',
'ip': '192.168.0.100',
'netmask': '255.255.255.0'}],
'label': 'fake',
'mac': 'DE:AD:BE:EF:00:00',
'rxtx_cap': 3})]
conn.finish_migration(self.context, instance,
dict(base_copy='hurr', cow='durr'),
network_info, resize_instance=True)
self.assertEqual(self.called, True)
self.assertEqual(self.fake_vm_start_called, True)
def test_finish_migrate_no_local_storage(self):
tiny_type_id = \
instance_types.get_instance_type_by_name('m1.tiny')['id']
self.values.update({'instance_type_id': tiny_type_id, 'local_gb': 0})
instance = db.instance_create(self.context, self.values)
def fake_vdi_resize(*args, **kwargs):
raise Exception("This shouldn't be called")
self.stubs.Set(stubs.FakeSessionForMigrationTests,
"VDI_resize_online", fake_vdi_resize)
stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests)
stubs.stubout_loopingcall_start(self.stubs)
conn = xenapi_conn.get_connection(False)
network_info = [({'bridge': 'fa0', 'id': 0, 'injected': False},
{'broadcast': '192.168.0.255',
'dns': ['192.168.0.1'],
'gateway': '192.168.0.1',
'gateway6': 'dead:beef::1',
'ip6s': [{'enabled': '1',
'ip': 'dead:beef::dcad:beff:feef:0',
'netmask': '64'}],
'ips': [{'enabled': '1',
'ip': '192.168.0.100',
'netmask': '255.255.255.0'}],
'label': 'fake',
'mac': 'DE:AD:BE:EF:00:00',
'rxtx_cap': 3})]
conn.finish_migration(self.context, instance,
dict(base_copy='hurr', cow='durr'),
network_info, resize_instance=True)
def test_finish_migrate_no_resize_vdi(self):
instance = db.instance_create(self.context, self.values)
def fake_vdi_resize(*args, **kwargs):
raise Exception("This shouldn't be called")
self.stubs.Set(stubs.FakeSessionForMigrationTests,
"VDI_resize_online", fake_vdi_resize)
stubs.stubout_session(self.stubs, stubs.FakeSessionForMigrationTests)
stubs.stubout_loopingcall_start(self.stubs)
conn = xenapi_conn.get_connection(False)
network_info = [({'bridge': 'fa0', 'id': 0, 'injected': False},
{'broadcast': '192.168.0.255',
'dns': ['192.168.0.1'],
'gateway': '192.168.0.1',
'gateway6': 'dead:beef::1',
'ip6s': [{'enabled': '1',
'ip': 'dead:beef::dcad:beff:feef:0',
'netmask': '64'}],
'ips': [{'enabled': '1',
'ip': '192.168.0.100',
'netmask': '255.255.255.0'}],
'label': 'fake',
'mac': 'DE:AD:BE:EF:00:00',
'rxtx_cap': 3})]
# Resize instance would be determined by the compute call
conn.finish_migration(self.context, instance,
dict(base_copy='hurr', cow='durr'),
network_info, resize_instance=False)
class XenAPIImageTypeTestCase(test.TestCase):
"""Test ImageType class."""
def test_to_string(self):
"""Can convert from type id to type string."""
self.assertEquals(
vm_utils.ImageType.to_string(vm_utils.ImageType.KERNEL),
vm_utils.ImageType.KERNEL_STR)
def test_from_string(self):
"""Can convert from string to type id."""
self.assertEquals(
vm_utils.ImageType.from_string(vm_utils.ImageType.KERNEL_STR),
vm_utils.ImageType.KERNEL)
class XenAPIDetermineDiskImageTestCase(test.TestCase): class XenAPIDetermineDiskImageTestCase(test.TestCase):
@@ -829,7 +953,6 @@ class XenAPIDetermineDiskImageTestCase(test.TestCase):
def test_instance_disk(self): def test_instance_disk(self):
"""If a kernel is specified, the image type is DISK (aka machine).""" """If a kernel is specified, the image type is DISK (aka machine)."""
FLAGS.xenapi_image_service = 'objectstore'
self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_MACHINE self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_MACHINE
self.fake_instance.kernel_id = glance_stubs.FakeGlance.IMAGE_KERNEL self.fake_instance.kernel_id = glance_stubs.FakeGlance.IMAGE_KERNEL
self.assert_disk_type(vm_utils.ImageType.DISK) self.assert_disk_type(vm_utils.ImageType.DISK)
@@ -839,7 +962,6 @@ class XenAPIDetermineDiskImageTestCase(test.TestCase):
If the kernel isn't specified, and we're not using Glance, then If the kernel isn't specified, and we're not using Glance, then
DISK_RAW is assumed. DISK_RAW is assumed.
""" """
FLAGS.xenapi_image_service = 'objectstore'
self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_RAW self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_RAW
self.fake_instance.kernel_id = None self.fake_instance.kernel_id = None
self.assert_disk_type(vm_utils.ImageType.DISK_RAW) self.assert_disk_type(vm_utils.ImageType.DISK_RAW)
@@ -849,7 +971,6 @@ class XenAPIDetermineDiskImageTestCase(test.TestCase):
If we're using Glance, then defer to the image_type field, which in If we're using Glance, then defer to the image_type field, which in
this case will be 'raw'. this case will be 'raw'.
""" """
FLAGS.xenapi_image_service = 'glance'
self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_RAW self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_RAW
self.fake_instance.kernel_id = None self.fake_instance.kernel_id = None
self.assert_disk_type(vm_utils.ImageType.DISK_RAW) self.assert_disk_type(vm_utils.ImageType.DISK_RAW)
@@ -859,7 +980,6 @@ class XenAPIDetermineDiskImageTestCase(test.TestCase):
If we're using Glance, then defer to the image_type field, which in If we're using Glance, then defer to the image_type field, which in
this case will be 'vhd'. this case will be 'vhd'.
""" """
FLAGS.xenapi_image_service = 'glance'
self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_VHD self.fake_instance.image_ref = glance_stubs.FakeGlance.IMAGE_VHD
self.fake_instance.kernel_id = None self.fake_instance.kernel_id = None
self.assert_disk_type(vm_utils.ImageType.DISK_VHD) self.assert_disk_type(vm_utils.ImageType.DISK_VHD)

View File

@@ -28,8 +28,8 @@ from nova import utils
def stubout_instance_snapshot(stubs): def stubout_instance_snapshot(stubs):
@classmethod @classmethod
def fake_fetch_image(cls, session, instance_id, image, user, project, def fake_fetch_image(cls, context, session, instance_id, image, user,
type): project, type):
from nova.virt.xenapi.fake import create_vdi from nova.virt.xenapi.fake import create_vdi
name_label = "instance-%s" % instance_id name_label = "instance-%s" % instance_id
#TODO: create fake SR record #TODO: create fake SR record
@@ -227,7 +227,7 @@ def stub_out_vm_methods(stubs):
def fake_release_bootlock(self, vm): def fake_release_bootlock(self, vm):
pass pass
def fake_spawn_rescue(self, inst): def fake_spawn_rescue(self, context, inst, network_info):
inst._rescue = False inst._rescue = False
stubs.Set(vmops.VMOps, "_shutdown", fake_shutdown) stubs.Set(vmops.VMOps, "_shutdown", fake_shutdown)

View File

@@ -1,267 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Twisted daemon helpers, specifically to parse out gFlags from twisted flags,
manage pid files and support syslogging.
"""
import gflags
import os
import signal
import sys
import time
from twisted.scripts import twistd
from twisted.python import log
from twisted.python import reflect
from twisted.python import runtime
from twisted.python import usage
from nova import flags
from nova import log as logging
if runtime.platformType == "win32":
from twisted.scripts._twistw import ServerOptions
else:
from twisted.scripts._twistd_unix import ServerOptions
FLAGS = flags.FLAGS
class TwistdServerOptions(ServerOptions):
def parseArgs(self, *args):
return
class FlagParser(object):
# this is a required attribute for gflags
syntactic_help = ''
def __init__(self, parser):
self.parser = parser
def Parse(self, s):
return self.parser(s)
def WrapTwistedOptions(wrapped):
class TwistedOptionsToFlags(wrapped):
subCommands = None
def __init__(self):
# NOTE(termie): _data exists because Twisted stuff expects
# to be able to set arbitrary things that are
# not actual flags
self._data = {}
self._flagHandlers = {}
self._paramHandlers = {}
# Absorb the twistd flags into our FLAGS
self._absorbFlags()
self._absorbParameters()
self._absorbHandlers()
wrapped.__init__(self)
def _absorbFlags(self):
twistd_flags = []
reflect.accumulateClassList(self.__class__, 'optFlags',
twistd_flags)
for flag in twistd_flags:
key = flag[0].replace('-', '_')
if hasattr(FLAGS, key):
continue
flags.DEFINE_boolean(key, None, str(flag[-1]))
def _absorbParameters(self):
twistd_params = []
reflect.accumulateClassList(self.__class__, 'optParameters',
twistd_params)
for param in twistd_params:
key = param[0].replace('-', '_')
if hasattr(FLAGS, key):
continue
if len(param) > 4:
flags.DEFINE(FlagParser(param[4]),
key, param[2], str(param[3]),
serializer=gflags.ArgumentSerializer())
else:
flags.DEFINE_string(key, param[2], str(param[3]))
def _absorbHandlers(self):
twistd_handlers = {}
reflect.addMethodNamesToDict(self.__class__, twistd_handlers,
"opt_")
# NOTE(termie): Much of the following is derived/copied from
# twisted.python.usage with the express purpose of
# providing compatibility
for name in twistd_handlers.keys():
method = getattr(self, 'opt_' + name)
takesArg = not usage.flagFunction(method, name)
doc = getattr(method, '__doc__', None)
if not doc:
doc = 'undocumented'
if not takesArg:
if name not in FLAGS:
flags.DEFINE_boolean(name, None, doc)
self._flagHandlers[name] = method
else:
if name not in FLAGS:
flags.DEFINE_string(name, None, doc)
self._paramHandlers[name] = method
def _doHandlers(self):
for flag, handler in self._flagHandlers.iteritems():
if self[flag]:
handler()
for param, handler in self._paramHandlers.iteritems():
if self[param] is not None:
handler(self[param])
def __str__(self):
return str(FLAGS)
def parseOptions(self, options=None):
if options is None:
options = sys.argv
else:
options.insert(0, '')
args = FLAGS(options)
logging.setup()
argv = args[1:]
# ignore subcommands
try:
self.parseArgs(*argv)
except TypeError:
raise usage.UsageError(_("Wrong number of arguments."))
self.postOptions()
return args
def parseArgs(self, *args):
# TODO(termie): figure out a decent way of dealing with args
#return
wrapped.parseArgs(self, *args)
def postOptions(self):
self._doHandlers()
wrapped.postOptions(self)
def __getitem__(self, key):
key = key.replace('-', '_')
try:
return getattr(FLAGS, key)
except (AttributeError, KeyError):
return self._data[key]
def __setitem__(self, key, value):
key = key.replace('-', '_')
try:
return setattr(FLAGS, key, value)
except (AttributeError, KeyError):
self._data[key] = value
def get(self, key, default):
key = key.replace('-', '_')
try:
return getattr(FLAGS, key)
except (AttributeError, KeyError):
self._data.get(key, default)
return TwistedOptionsToFlags
def stop(pidfile):
"""
Stop the daemon
"""
# Get the pid from the pidfile
try:
pf = file(pidfile, 'r')
pid = int(pf.read().strip())
pf.close()
except IOError:
pid = None
if not pid:
message = _("pidfile %s does not exist. Daemon not running?\n")
sys.stderr.write(message % pidfile)
# Not an error in a restart
return
# Try killing the daemon process
try:
while 1:
os.kill(pid, signal.SIGKILL)
time.sleep(0.1)
except OSError, err:
err = str(err)
if err.find(_("No such process")) > 0:
if os.path.exists(pidfile):
os.remove(pidfile)
else:
print str(err)
sys.exit(1)
def serve(filename):
logging.debug(_("Serving %s") % filename)
name = os.path.basename(filename)
OptionsClass = WrapTwistedOptions(TwistdServerOptions)
options = OptionsClass()
argv = options.parseOptions()
FLAGS.python = filename
FLAGS.no_save = True
if not FLAGS.pidfile:
FLAGS.pidfile = '%s.pid' % name
elif FLAGS.pidfile.endswith('twistd.pid'):
FLAGS.pidfile = FLAGS.pidfile.replace('twistd.pid', '%s.pid' % name)
if not FLAGS.prefix:
FLAGS.prefix = name
elif FLAGS.prefix.endswith('twisted'):
FLAGS.prefix = FLAGS.prefix.replace('twisted', name)
action = 'start'
if len(argv) > 1:
action = argv.pop()
if action == 'stop':
stop(FLAGS.pidfile)
sys.exit()
elif action == 'restart':
stop(FLAGS.pidfile)
elif action == 'start':
pass
else:
print 'usage: %s [options] [start|stop|restart]' % argv[0]
sys.exit(1)
logging.debug(_("Full set of FLAGS:"))
for flag in FLAGS:
logging.debug("%s : %s" % (flag, FLAGS.get(flag, None)))
logging.audit(_("Starting %s"), name)
twistd.runApp(options)

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr ""
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2263,10 +2208,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr ""
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2265,10 +2210,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr ""
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2263,10 +2208,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -131,33 +131,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr "PID-Datei %s existiert nicht. Läuft der Daemon nicht?\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "Kein passender Prozess gefunden"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "Bedient %s"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "Alle vorhandenen FLAGS:"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "%s wird gestartet"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1785,34 +1758,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2270,10 +2215,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr ""
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2263,10 +2208,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -130,33 +130,6 @@ msgstr "compute.api::suspend %s"
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "compute.api::resume %s" msgstr "compute.api::resume %s"
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "Wrong number of arguments."
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr "pidfile %s does not exist. Daemon not running?\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "No such process"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "Serving %s"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "Full set of FLAGS:"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "Starting %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1803,34 +1776,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2288,10 +2233,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -130,33 +130,6 @@ msgstr "compute.api::suspend %s"
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "compute.api::resume %s" msgstr "compute.api::resume %s"
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "Cantidad de argumentos incorrecta"
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr "El \"pidfile\" %s no existe. Quizás el servicio no este corriendo.\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "No existe el proceso"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "Sirviendo %s"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "Conjunto completo de opciones (FLAGS):"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "Iniciando %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1819,34 +1792,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "Obtenida excepción %s" msgstr "Obtenida excepción %s"
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr "actualizando %s..."
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr "error inesperado durante la actualización"
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr "excepción inexperada al obtener la conexión"
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr "Encontrada interfaz: %s"
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2309,10 +2254,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -133,35 +133,6 @@ msgstr "compute.api::suspend %s"
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "compute.api::resume %s" msgstr "compute.api::resume %s"
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "Nombre d'arguments incorrect."
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
"Le fichier pid %s n'existe pas. Est-ce que le processus est en cours "
"d'exécution ?\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "Aucun processus de ce type"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "En train de servir %s"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "Ensemble de propriétés complet :"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "Démarrage de %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1865,34 +1836,6 @@ msgstr "Tâche [%(name)s] %(task)s état : %(status)s %(error_info)s"
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "Reçu exception : %s" msgstr "Reçu exception : %s"
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr "mise à jour %s..."
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr "erreur inopinée pendant la ise à jour"
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr "Ne peut pas récupérer blockstats pour \"%(disk)s\" sur \"%(iid)s\""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr "Ne peut pas récupérer ifstats pour \"%(interface)s\" sur \"%(iid)s\""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr "erreur inopinée pendant la connexion"
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr "Instance trouvée : %s"
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2373,10 +2316,6 @@ msgstr "Démarrage %(arg0)s sur %(host)s:%(port)s"
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "Vous devez implémenter __call__" msgstr "Vous devez implémenter __call__"
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr "Démarrage du superviseur d'instance"
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "Allocation IP" msgstr "Allocation IP"

View File

@@ -134,34 +134,6 @@ msgstr "compute.api::suspend %s"
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "compute.api::resume %s" msgstr "compute.api::resume %s"
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "Numero errato di argomenti"
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
"Il pidfile %s non esiste. Assicurarsi che il demone é in esecuzione.\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "Nessun processo trovato"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "Servire %s"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "Insieme di FLAGS:"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "Avvio di %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1791,34 +1763,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2278,10 +2222,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -130,33 +130,6 @@ msgstr "例外: compute.api::suspend %s"
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "例外: compute.api::resume %s" msgstr "例外: compute.api::resume %s"
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "引数の数が異なります。"
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr "pidfile %s が存在しません。デーモンは実行中ですか?\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "そのようなプロセスはありません"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "%s サービスの開始"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "FLAGSの一覧:"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "%s を起動中"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1808,34 +1781,6 @@ msgstr "タスク [%(name)s] %(task)s 状態: %(status)s %(error_info)s"
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "例外 %s が発生しました。" msgstr "例外 %s が発生しました。"
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr "%s の情報の更新…"
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr "更新の最中に予期しないエラーが発生しました。"
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr "\"%(iid)s\" 上の \"%(disk)s\" 用のブロック統計(blockstats)が取得できません"
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr "\"%(iid)s\" 上の %(interface)s\" 用インターフェース統計(ifstats)が取得できません"
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr "接続に際し予期しないエラーが発生しました。"
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr "インスタンス %s が見つかりました。"
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2311,10 +2256,6 @@ msgstr "%(host)s:%(port)s 上で %(arg0)s を開始しています"
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "__call__ を実装しなければなりません" msgstr "__call__ を実装しなければなりません"
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr "インスタンスモニタを開始しています"
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "IP アドレスをリースしました" msgstr "IP アドレスをリースしました"

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr ""
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2263,10 +2208,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -126,34 +126,6 @@ msgstr "compute.api::suspend %s"
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "compute.api::resume %s" msgstr "compute.api::resume %s"
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "Número errado de argumentos."
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
"Arquivo do id do processo (pidfile) %s não existe. O Daemon está parado?\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "Processo inexistente"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "Servindo %s"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "Conjunto completo de FLAGS:"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "Iniciando %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1804,34 +1776,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2290,10 +2234,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "Неверное число аргументов."
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr "pidfile %s не обнаружен. Демон не запущен?\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "Запускается %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1779,34 +1752,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr "обновление %s..."
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr "неожиданная ошибка во время обновления"
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2264,10 +2209,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr ""
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2265,10 +2210,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr ""
#: ../nova/twistd.py:221
msgid "No such process"
msgstr ""
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "Обслуговування %s"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "Запускається %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2263,10 +2208,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -17,11 +17,6 @@ msgstr ""
"X-Launchpad-Export-Date: 2011-07-23 05:12+0000\n" "X-Launchpad-Export-Date: 2011-07-23 05:12+0000\n"
"X-Generator: Launchpad (build 13405)\n" "X-Generator: Launchpad (build 13405)\n"
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "启动 %s 中"
#: ../nova/scheduler/chance.py:37 ../nova/scheduler/zone.py:55 #: ../nova/scheduler/chance.py:37 ../nova/scheduler/zone.py:55
#: ../nova/scheduler/simple.py:75 ../nova/scheduler/simple.py:110 #: ../nova/scheduler/simple.py:75 ../nova/scheduler/simple.py:110
#: ../nova/scheduler/simple.py:122 #: ../nova/scheduler/simple.py:122
@@ -135,28 +130,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr "错误参数个数。"
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr "pidfile %s 不存在守护进程是否运行\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "没有该进程"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr "正在为 %s 服务"
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr "FLAGS全集"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1785,34 +1758,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2270,10 +2215,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""

View File

@@ -125,33 +125,6 @@ msgstr ""
msgid "compute.api::resume %s" msgid "compute.api::resume %s"
msgstr "" msgstr ""
#: ../nova/twistd.py:157
msgid "Wrong number of arguments."
msgstr ""
#: ../nova/twistd.py:209
#, python-format
msgid "pidfile %s does not exist. Daemon not running?\n"
msgstr "pidfile %s 不存在. Daemon未啟動?\n"
#: ../nova/twistd.py:221
msgid "No such process"
msgstr "沒有此一程序"
#: ../nova/twistd.py:230 ../nova/service.py:224
#, python-format
msgid "Serving %s"
msgstr ""
#: ../nova/twistd.py:262 ../nova/service.py:225
msgid "Full set of FLAGS:"
msgstr ""
#: ../nova/twistd.py:266
#, python-format
msgid "Starting %s"
msgstr "正在啟動 %s"
#: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101 #: ../nova/virt/xenapi/volumeops.py:48 ../nova/virt/xenapi/volumeops.py:101
#: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741 #: ../nova/db/sqlalchemy/api.py:731 ../nova/virt/libvirt_conn.py:741
#: ../nova/api/ec2/__init__.py:317 #: ../nova/api/ec2/__init__.py:317
@@ -1778,34 +1751,6 @@ msgstr ""
msgid "Got exception: %s" msgid "Got exception: %s"
msgstr "" msgstr ""
#: ../nova/compute/monitor.py:259
#, python-format
msgid "updating %s..."
msgstr ""
#: ../nova/compute/monitor.py:289
msgid "unexpected error during update"
msgstr ""
#: ../nova/compute/monitor.py:356
#, python-format
msgid "Cannot get blockstats for \"%(disk)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:379
#, python-format
msgid "Cannot get ifstats for \"%(interface)s\" on \"%(iid)s\""
msgstr ""
#: ../nova/compute/monitor.py:414
msgid "unexpected exception getting connection"
msgstr ""
#: ../nova/compute/monitor.py:429
#, python-format
msgid "Found instance: %s"
msgstr ""
#: ../nova/volume/san.py:67 #: ../nova/volume/san.py:67
#, python-format #, python-format
msgid "Could not find iSCSI export for volume %s" msgid "Could not find iSCSI export for volume %s"
@@ -2263,10 +2208,6 @@ msgstr ""
msgid "You must implement __call__" msgid "You must implement __call__"
msgstr "" msgstr ""
#: ../bin/nova-instancemonitor.py:55
msgid "Starting instance monitor"
msgstr ""
#: ../bin/nova-dhcpbridge.py:58 #: ../bin/nova-dhcpbridge.py:58
msgid "leasing ip" msgid "leasing ip"
msgstr "" msgstr ""