![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package openstack-nova for openSUSE:Factory checked in at 2013-03-25 20:40:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openstack-nova (Old) and /work/SRC/openSUSE:Factory/.openstack-nova.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "openstack-nova", Maintainer is "radmanic@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/openstack-nova/openstack-nova.changes 2013-03-08 09:29:15.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.openstack-nova.new/openstack-nova.changes 2013-03-25 20:41:40.000000000 +0100 @@ -0,0 +1,14 @@ +-------------------------------------------------------------------- +Thu Mar 14 21:53:59 UTC 2013 - vuntz@suse.com + +- Update to version 2012.2.4+git.1363298039.9561484: + + Fix an error in affinity filters + + Add quotas for fixed ips. (CVE-2013-1838) +- This fixes bnc#808622. + +-------------------------------------------------------------------- +Mon Mar 11 13:05:55 UTC 2013 - cloud-devel@suse.de + +- Update to version 2012.2.4+git.1363007155.c06b205: + + Avoid vm instance shutdown when power state is NOSTATE + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openstack-nova-doc.spec ++++++ --- /var/tmp/diff_new_pack.hTVBn3/_old 2013-03-25 20:41:43.000000000 +0100 +++ /var/tmp/diff_new_pack.hTVBn3/_new 2013-03-25 20:41:43.000000000 +0100 @@ -20,7 +20,7 @@ %define majorversion 2012.2.3 Name: openstack-%{component}-doc -Version: 2012.2.4+git.1362583574.da38af5 +Version: 2012.2.4+git.1363298039.9561484 Release: 1 License: Apache-2.0 Summary: OpenStack Compute (Nova) - Documentation ++++++ openstack-nova.spec ++++++ --- /var/tmp/diff_new_pack.hTVBn3/_old 2013-03-25 20:41:43.000000000 +0100 +++ /var/tmp/diff_new_pack.hTVBn3/_new 2013-03-25 20:41:43.000000000 +0100 @@ -22,7 +22,7 @@ %define username openstack-%{component} Name: openstack-%{component} -Version: 2012.2.4+git.1362583574.da38af5 +Version: 2012.2.4+git.1363298039.9561484 Release: 1 License: Apache-2.0 Summary: OpenStack Compute (Nova) ++++++ nova-stable-folsom.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/ChangeLog new/nova-2012.2.4/ChangeLog --- old/nova-2012.2.4/ChangeLog 2013-03-06 02:08:02.000000000 +0100 +++ new/nova-2012.2.4/ChangeLog 2013-03-14 20:19:55.000000000 +0100 @@ -1,3 +1,42 @@ +commit 9561484166f245d0e4602a36351d6cac72dd9426 +Author: Michael Still <mikal@stillhq.com> +Date: Wed Mar 13 04:44:14 2013 +1100 + + Add quotas for fixed ips. + + DocImpact: there is now a default quota of 10 fixed ips per tenant. + This will need to be adjusted by deployers if that number does not + meet their needs. + + Resolves bug 1125468 for folsom. + + Change-Id: I970d540cfa6a61b7e903703f845a6453ff55f225 + + nova/db/api.py | 6 ++ + nova/db/sqlalchemy/api.py | 21 +++++ + nova/exception.py | 4 + + nova/network/manager.py | 89 +++++++++++++------- + nova/quota.py | 10 +++ + .../compute/contrib/test_quota_classes.py | 14 +-- + .../api/openstack/compute/contrib/test_quotas.py | 16 ++-- + nova/tests/network/test_manager.py | 15 ++++ + nova/tests/test_quota.py | 24 ++++++ + 9 files changed, 157 insertions(+), 42 deletions(-) + +commit f0143a3e97cae23f8b290b7f84da372dede073aa +Merge: c06b205 d6b9d33 +Author: Jenkins <jenkins@review.openstack.org> +Date: Thu Mar 14 08:33:48 2013 +0000 + + Merge "Fix an error in affinity filters" into stable/folsom + +commit c06b2056668757fe5441093df898984a925b67f2 +Merge: da38af5 cb843f7 +Author: Jenkins <jenkins@review.openstack.org> +Date: Fri Mar 8 13:57:46 2013 +0000 + + Merge "Avoid vm instance shutdown when power state is NOSTATE" into stable/folsom + commit da38af5b79e7e3f9584cb79154aa0740badd6efb Merge: 8c4df00 05a3374 Author: Jenkins <jenkins@review.openstack.org> @@ -141,6 +180,25 @@ nova/virt/libvirt/vif.py | 3 ++- 2 files changed, 28 insertions(+), 3 deletions(-) +commit cb843f7a948122c55fbe244458bb44b2f68eedb9 +Author: Pádraig Brady <pbrady@redhat.com> +Date: Thu Feb 21 16:17:13 2013 +0000 + + Avoid vm instance shutdown when power state is NOSTATE + + * nova/compute/manager.py (_sync_power_states): Log the condition + where we can retrieve the state from the hyperviser, rather than + stopping the VM. + + Related grizzly commits are 95e77703 and ad101ce5 + + Fixes bug: 1085771 + Change-Id: I5fb9fdc6bcde729c00c4931960ed0de3b8fa189d + + nova/compute/manager.py | 11 ++++++++--- + nova/tests/compute/test_compute.py | 2 +- + 2 files changed, 9 insertions(+), 4 deletions(-) + commit 7ac3fe143ca35493b7a0247dafe0693cf1d6a376 Merge: 15b2734 7ace55f Author: Jenkins <jenkins@review.openstack.org> @@ -287,6 +345,27 @@ nova/tests/compute/test_compute.py | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 11 deletions(-) +commit d6b9d33b231b987d9e826d25ad34c97097dc2af4 +Author: Hans Lindgren <hanlind@kth.se> +Date: Sun Jan 27 21:19:16 2013 +0100 + + Fix an error in affinity filters + + Fix a call to compute_api.get_all to properly exclude deleted instances. + Add tests to prohibit this error in the future. + + After some thought, this can be further optimized to let the instance + query do all the filtering/matching. + + Resolves bug 1107156. + + Change-Id: I6d6a6ba44d38d363489853d0407ad4cc94046656 + (cherry picked from commit 8bc80cab3c134d64953b4f6493cab80b5bdc1b69) + + nova/scheduler/filters/affinity_filter.py | 22 +++++++--------------- + nova/tests/scheduler/test_host_filters.py | 28 ++++++++++++++++++++++++++++ + 2 files changed, 35 insertions(+), 15 deletions(-) + commit f6081d01878f0021a499f304c511b6e1e9c8f138 Merge: 1709c8e 5a66812 Author: Jenkins <jenkins@review.openstack.org> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/compute/manager.py new/nova-2012.2.4/nova/compute/manager.py --- old/nova-2012.2.4/nova/compute/manager.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/compute/manager.py 2013-03-14 20:14:22.000000000 +0100 @@ -2749,9 +2749,8 @@ pass elif vm_state == vm_states.ACTIVE: # The only rational power state should be RUNNING - if vm_power_state in (power_state.NOSTATE, - power_state.SHUTDOWN, - power_state.CRASHED): + if vm_power_state in (power_state.SHUTDOWN, + power_state.CRASHED): LOG.warn(_("Instance shutdown by itself. Calling " "the stop API."), instance=db_instance) try: @@ -2786,6 +2785,12 @@ # instrumentation is done. See bug 1097806 for details. LOG.warn(_("Instance is paused unexpectedly. Ignore."), instance=db_instance) + elif vm_power_state == power_state.NOSTATE: + # Occasionally, depending on the status of the hypervisor, + # which could be restarting for example, an instance may + # not be found. Therefore just log the condidtion. + LOG.warn(_("Instance is unexpectedly not found. Ignore."), + instance=db_instance) elif vm_state == vm_states.STOPPED: if vm_power_state not in (power_state.NOSTATE, power_state.SHUTDOWN, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/db/api.py new/nova-2012.2.4/nova/db/api.py --- old/nova-2012.2.4/nova/db/api.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/db/api.py 2013-03-14 20:14:22.000000000 +0100 @@ -507,6 +507,12 @@ """Create a fixed ip from the values dictionary.""" return IMPL.fixed_ip_update(context, address, values) + +def fixed_ip_count_by_project(context, project_id, session=None): + """Count fixed ips used by project.""" + return IMPL.fixed_ip_count_by_project(context, project_id, + session=session) + #################### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/db/sqlalchemy/api.py new/nova-2012.2.4/nova/db/sqlalchemy/api.py --- old/nova-2012.2.4/nova/db/sqlalchemy/api.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/db/sqlalchemy/api.py 2013-03-14 20:14:22.000000000 +0100 @@ -1273,6 +1273,27 @@ fixed_ip_ref.save(session=session) +@require_context +def fixed_ip_count_by_project(context, project_id, session=None): + authorize_project_context(context, project_id) + + # NOTE(mikal): Yes I know this is horrible, but I couldn't + # get a query using a join working, mainly because of a failure + # to be able to express the where clause sensibly. Patches + # welcome. + session = get_session() + with session.begin(): + instance_uuid_query = model_query(context, models.Instance.uuid, + read_deleted="no", session=session).\ + filter(models.Instance.project_id == \ + project_id) + uuid_filter = models.FixedIp.instance_uuid.in_(instance_uuid_query) + return model_query(context, models.FixedIp, read_deleted="no", + session=session).\ + filter(uuid_filter).\ + count() + + ################### diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/exception.py new/nova-2012.2.4/nova/exception.py --- old/nova-2012.2.4/nova/exception.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/exception.py 2013-03-14 20:14:22.000000000 +0100 @@ -998,6 +998,10 @@ message = _("Maximum number of floating ips exceeded") +class FixedIpLimitExceeded(QuotaError): + message = _("Maximum number of fixed ips exceeded") + + class MetadataLimitExceeded(QuotaError): message = _("Maximum number of metadata items exceeds %(allowed)d") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/network/manager.py new/nova-2012.2.4/nova/network/manager.py --- old/nova-2012.2.4/nova/network/manager.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/network/manager.py 2013-03-14 20:14:22.000000000 +0100 @@ -1294,37 +1294,53 @@ address = None instance_ref = self.db.instance_get(context, instance_id) - if network['cidr']: - address = kwargs.get('address', None) - if address: - address = self.db.fixed_ip_associate(context, - address, - instance_ref['uuid'], - network['id']) - else: - address = self.db.fixed_ip_associate_pool(context.elevated(), - network['id'], - instance_ref['uuid']) - self._do_trigger_security_group_members_refresh_for_instance( - instance_id) - get_vif = self.db.virtual_interface_get_by_instance_and_network - vif = get_vif(context, instance_ref['uuid'], network['id']) - values = {'allocated': True, - 'virtual_interface_id': vif['id']} - self.db.fixed_ip_update(context, address, values) - - name = instance_ref['display_name'] - - if self._validate_instance_zone_for_dns_domain(context, instance_ref): - uuid = instance_ref['uuid'] - self.instance_dns_manager.create_entry(name, address, - "A", - self.instance_dns_domain) - self.instance_dns_manager.create_entry(uuid, address, - "A", - self.instance_dns_domain) - self._setup_network_on_host(context, network) - return address + # Check the quota; can't put this in the API because we get + # called into from other places + try: + reservations = QUOTAS.reserve(context, fixed_ips=1) + except exception.OverQuota: + pid = context.project_id + LOG.warn(_("Quota exceeded for %(pid)s, tried to allocate " + "fixed IP") % locals()) + raise exception.FixedIpLimitExceeded() + + try: + if network['cidr']: + address = kwargs.get('address', None) + if address: + address = self.db.fixed_ip_associate(context, + address, + instance_ref['uuid'], + network['id']) + else: + address = self.db.fixed_ip_associate_pool( + context.elevated(), network['id'], + instance_ref['uuid']) + self._do_trigger_security_group_members_refresh_for_instance( + instance_id) + get_vif = self.db.virtual_interface_get_by_instance_and_network + vif = get_vif(context, instance_ref['uuid'], network['id']) + values = {'allocated': True, + 'virtual_interface_id': vif['id']} + self.db.fixed_ip_update(context, address, values) + + name = instance_ref['display_name'] + + if self._validate_instance_zone_for_dns_domain(context, + instance_ref): + uuid = instance_ref['uuid'] + self.instance_dns_manager.create_entry( + name, address, "A", self.instance_dns_domain) + self.instance_dns_manager.create_entry( + uuid, address, "A", self.instance_dns_domain) + self._setup_network_on_host(context, network) + + QUOTAS.commit(context, reservations) + return address + + except Exception: + with excutils.save_and_reraise_exception(): + QUOTAS.rollback(context, reservations) def deallocate_fixed_ip(self, context, address, host=None, teardown=True): """Returns a fixed ip to the pool.""" @@ -1334,6 +1350,13 @@ context.elevated(read_deleted='yes'), fixed_ip_ref['instance_uuid']) + try: + reservations = QUOTAS.reserve(context, fixed_ips=-1) + except Exception: + reservations = None + LOG.exception(_("Failed to update usages deallocating " + "fixed IP")) + self._do_trigger_security_group_members_refresh_for_instance( instance['uuid']) @@ -1373,6 +1396,10 @@ # callback will get called by nova-dhcpbridge. self.driver.release_dhcp(dev, address, vif['address']) + # Commit the reservations + if reservations: + QUOTAS.commit(context, reservations) + def lease_fixed_ip(self, context, address): """Called by dhcp-bridge when ip is leased.""" LOG.debug(_('Leased IP |%(address)s|'), locals(), context=context) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/quota.py new/nova-2012.2.4/nova/quota.py --- old/nova-2012.2.4/nova/quota.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/quota.py 2013-03-14 20:14:22.000000000 +0100 @@ -50,6 +50,10 @@ cfg.IntOpt('quota_floating_ips', default=10, help='number of floating ips allowed per project'), + cfg.IntOpt('quota_fixed_ips', + default=10, + help=('number of fixed ips allowed per project (this should be ' + 'at least the number of instances allowed)')), cfg.IntOpt('quota_metadata_items', default=128, help='number of metadata items allowed per instance'), @@ -778,6 +782,11 @@ context, project_id, session=session)) +def _sync_fixed_ips(context, project_id, session): + return dict(fixed_ips=db.fixed_ip_count_by_project( + context, project_id, session=session)) + + def _sync_security_groups(context, project_id, session): return dict(security_groups=db.security_group_count_by_project( context, project_id, session=session)) @@ -794,6 +803,7 @@ ReservableResource('gigabytes', _sync_volumes, 'quota_gigabytes'), ReservableResource('floating_ips', _sync_floating_ips, 'quota_floating_ips'), + ReservableResource('fixed_ips', _sync_fixed_ips, 'quota_fixed_ips'), AbsoluteResource('metadata_items', 'quota_metadata_items'), AbsoluteResource('injected_files', 'quota_injected_files'), AbsoluteResource('injected_file_content_bytes', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/scheduler/filters/affinity_filter.py new/nova-2012.2.4/nova/scheduler/filters/affinity_filter.py --- old/nova-2012.2.4/nova/scheduler/filters/affinity_filter.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/scheduler/filters/affinity_filter.py 2013-03-14 20:14:22.000000000 +0100 @@ -25,12 +25,6 @@ def __init__(self): self.compute_api = compute.API() - def _all_hosts(self, context): - all_hosts = {} - for instance in self.compute_api.get_all(context): - all_hosts[instance['uuid']] = instance['host'] - return all_hosts - class DifferentHostFilter(AffinityFilter): '''Schedule the instance on a different host from a set of instances.''' @@ -38,15 +32,15 @@ def host_passes(self, host_state, filter_properties): context = filter_properties['context'] scheduler_hints = filter_properties.get('scheduler_hints') or {} - me = host_state.host affinity_uuids = scheduler_hints.get('different_host', []) if isinstance(affinity_uuids, basestring): affinity_uuids = [affinity_uuids] if affinity_uuids: - all_hosts = self._all_hosts(context) - return not any([i for i in affinity_uuids - if all_hosts.get(i) == me]) + return not self.compute_api.get_all(context, + {'host': host_state.host, + 'uuid': affinity_uuids, + 'deleted': False}) # With no different_host key return True @@ -59,16 +53,14 @@ def host_passes(self, host_state, filter_properties): context = filter_properties['context'] scheduler_hints = filter_properties.get('scheduler_hints') or {} - me = host_state.host affinity_uuids = scheduler_hints.get('same_host', []) if isinstance(affinity_uuids, basestring): affinity_uuids = [affinity_uuids] if affinity_uuids: - all_hosts = self._all_hosts(context) - return any([i for i - in affinity_uuids - if all_hosts.get(i) == me]) + return self.compute_api.get_all(context, {'host': host_state.host, + 'uuid': affinity_uuids, + 'deleted': False}) # With no same_host key return True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quota_classes.py new/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quota_classes.py --- old/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quota_classes.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quota_classes.py 2013-03-14 20:14:22.000000000 +0100 @@ -25,10 +25,11 @@ def quota_set(class_name): return {'quota_class_set': {'id': class_name, 'metadata_items': 128, 'volumes': 10, 'gigabytes': 1000, 'ram': 51200, - 'floating_ips': 10, 'instances': 10, 'injected_files': 5, - 'cores': 20, 'injected_file_content_bytes': 10240, - 'security_groups': 10, 'security_group_rules': 20, - 'key_pairs': 100, 'injected_file_path_bytes': 255}} + 'floating_ips': 10, 'fixed_ips': 10, 'instances': 10, + 'injected_files': 5, 'cores': 20, + 'injected_file_content_bytes': 10240, 'security_groups': 10, + 'security_group_rules': 20, 'key_pairs': 100, + 'injected_file_path_bytes': 255}} class QuotaClassSetsTest(test.TestCase): @@ -44,6 +45,7 @@ 'ram': 51200, 'volumes': 10, 'floating_ips': 10, + 'fixed_ips': 10, 'metadata_items': 128, 'gigabytes': 1000, 'injected_files': 5, @@ -91,7 +93,8 @@ body = {'quota_class_set': {'instances': 50, 'cores': 50, 'ram': 51200, 'volumes': 10, 'gigabytes': 1000, 'floating_ips': 10, - 'metadata_items': 128, 'injected_files': 5, + 'fixed_ips': 10, 'metadata_items': 128, + 'injected_files': 5, 'injected_file_content_bytes': 10240, 'injected_file_path_bytes': 255, 'security_groups': 10, @@ -139,6 +142,7 @@ gigabytes=40, ram=50, floating_ips=60, + fixed_ips=10, instances=70, injected_files=80, security_groups=10, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quotas.py new/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quotas.py --- old/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quotas.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/tests/api/openstack/compute/contrib/test_quotas.py 2013-03-14 20:14:22.000000000 +0100 @@ -26,11 +26,12 @@ def quota_set(id): return {'quota_set': {'id': id, 'metadata_items': 128, 'volumes': 10, - 'gigabytes': 1000, 'ram': 51200, 'floating_ips': 10, - 'instances': 10, 'injected_files': 5, 'cores': 20, - 'injected_file_content_bytes': 10240, - 'security_groups': 10, 'security_group_rules': 20, - 'key_pairs': 100, 'injected_file_path_bytes': 255}} + 'gigabytes': 1000, 'ram': 51200, 'floating_ips': 10, + 'fixed_ips': 10, 'instances': 10, + 'injected_files': 5, 'cores': 20, + 'injected_file_content_bytes': 10240, + 'security_groups': 10, 'security_group_rules': 20, + 'key_pairs': 100, 'injected_file_path_bytes': 255}} class QuotaSetsTest(test.TestCase): @@ -46,6 +47,7 @@ 'ram': 51200, 'volumes': 10, 'floating_ips': 10, + 'fixed_ips': 10, 'metadata_items': 128, 'gigabytes': 1000, 'injected_files': 5, @@ -88,6 +90,7 @@ 'volumes': 10, 'gigabytes': 1000, 'floating_ips': 10, + 'fixed_ips': 10, 'metadata_items': 128, 'injected_files': 5, 'injected_file_path_bytes': 255, @@ -120,7 +123,7 @@ 'injected_file_path_bytes': 255, 'security_groups': 10, 'security_group_rules': 20, - 'key_pairs': 100}} + 'key_pairs': 100, 'fixed_ips': 10}} req = fakes.HTTPRequest.blank('/v2/fake4/os-quota-sets/update_me', use_admin_context=True) @@ -171,6 +174,7 @@ gigabytes=40, ram=50, floating_ips=60, + fixed_ips=10, instances=70, injected_files=80, security_groups=10, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/tests/compute/test_compute.py new/nova-2012.2.4/nova/tests/compute/test_compute.py --- old/nova-2012.2.4/nova/tests/compute/test_compute.py 2013-03-06 02:03:10.000000000 +0100 +++ new/nova-2012.2.4/nova/tests/compute/test_compute.py 2013-03-14 20:14:22.000000000 +0100 @@ -2331,7 +2331,7 @@ instances = db.instance_get_all(ctxt) LOG.info(_("After force-killing instances: %s"), instances) self.assertEqual(len(instances), 1) - self.assertEqual(task_states.STOPPING, instances[0]['task_state']) + self.assertEqual(instances[0]['task_state'], None) def test_add_instance_fault(self): exc_info = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/tests/network/test_manager.py new/nova-2012.2.4/nova/tests/network/test_manager.py --- old/nova-2012.2.4/nova/tests/network/test_manager.py 2013-03-06 02:03:11.000000000 +0100 +++ new/nova-2012.2.4/nova/tests/network/test_manager.py 2013-03-14 20:14:22.000000000 +0100 @@ -30,6 +30,7 @@ from nova.openstack.common import log as logging from nova.openstack.common import rpc import nova.policy +from nova import quota from nova import test from nova.tests import fake_network from nova import utils @@ -278,6 +279,7 @@ self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance_and_network') self.mox.StubOutWithMock(db, 'fixed_ip_update') + self.mox.StubOutWithMock(quota.QUOTAS, 'reserve') db.fixed_ip_update(mox.IgnoreArg(), mox.IgnoreArg(), @@ -291,6 +293,10 @@ db.instance_get(mox.IgnoreArg(), mox.IgnoreArg()).AndReturn({'security_groups': [{'id': 0}]}) + + quota.QUOTAS.reserve(mox.IgnoreArg(), + fixed_ips=mox.IgnoreArg()).AndReturn(None) + db.fixed_ip_associate_pool(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg()).AndReturn('192.168.0.101') @@ -310,6 +316,7 @@ self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance_and_network') self.mox.StubOutWithMock(db, 'fixed_ip_update') + self.mox.StubOutWithMock(quota.QUOTAS, 'reserve') db.fixed_ip_update(mox.IgnoreArg(), mox.IgnoreArg(), @@ -323,6 +330,10 @@ db.instance_get(mox.IgnoreArg(), mox.IgnoreArg()).AndReturn({'security_groups': [{'id': 0}]}) + + quota.QUOTAS.reserve(mox.IgnoreArg(), + fixed_ips=mox.IgnoreArg()).AndReturn(None) + db.fixed_ip_associate_pool(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg()).AndReturn('192.168.0.101') @@ -376,6 +387,7 @@ self.mox.StubOutWithMock(db, 'virtual_interface_get_by_instance_and_network') self.mox.StubOutWithMock(db, 'fixed_ip_update') + self.mox.StubOutWithMock(quota.QUOTAS, 'reserve') db.fixed_ip_update(mox.IgnoreArg(), mox.IgnoreArg(), @@ -390,6 +402,9 @@ mox.IgnoreArg()).AndReturn({'security_groups': [{'id': 0}]}) + quota.QUOTAS.reserve(mox.IgnoreArg(), + fixed_ips=mox.IgnoreArg()).AndReturn(None) + db.fixed_ip_associate_pool(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(fixedip) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/tests/scheduler/test_host_filters.py new/nova-2012.2.4/nova/tests/scheduler/test_host_filters.py --- old/nova-2012.2.4/nova/tests/scheduler/test_host_filters.py 2013-03-06 02:03:11.000000000 +0100 +++ new/nova-2012.2.4/nova/tests/scheduler/test_host_filters.py 2013-03-14 20:14:22.000000000 +0100 @@ -350,6 +350,20 @@ self.assertTrue(filt_cls.host_passes(host, filter_properties)) + def test_affinity_different_filter_handles_deleted_instance(self): + filt_cls = self.class_map['DifferentHostFilter']() + host = fakes.FakeHostState('host1', 'node1', {}) + instance = fakes.FakeInstance(context=self.context, + params={'host': 'host1'}) + instance_uuid = instance.uuid + db.instance_destroy(self.context, instance_uuid) + + filter_properties = {'context': self.context.elevated(), + 'scheduler_hints': { + 'different_host': [instance_uuid], }} + + self.assertTrue(filt_cls.host_passes(host, filter_properties)) + def test_affinity_same_filter_no_list_passes(self): filt_cls = self.class_map['SameHostFilter']() host = fakes.FakeHostState('host1', 'compute', {}) @@ -401,6 +415,20 @@ self.assertTrue(filt_cls.host_passes(host, filter_properties)) + def test_affinity_same_filter_handles_deleted_instance(self): + filt_cls = self.class_map['SameHostFilter']() + host = fakes.FakeHostState('host1', 'node1', {}) + instance = fakes.FakeInstance(context=self.context, + params={'host': 'host1'}) + instance_uuid = instance.uuid + db.instance_destroy(self.context, instance_uuid) + + filter_properties = {'context': self.context.elevated(), + 'scheduler_hints': { + 'same_host': [instance_uuid], }} + + self.assertFalse(filt_cls.host_passes(host, filter_properties)) + def test_affinity_simple_cidr_filter_passes(self): filt_cls = self.class_map['SimpleCIDRAffinityFilter']() host = fakes.FakeHostState('host1', 'compute', {}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nova-2012.2.4/nova/tests/test_quota.py new/nova-2012.2.4/nova/tests/test_quota.py --- old/nova-2012.2.4/nova/tests/test_quota.py 2013-03-06 02:03:11.000000000 +0100 +++ new/nova-2012.2.4/nova/tests/test_quota.py 2013-03-14 20:14:22.000000000 +0100 @@ -723,6 +723,7 @@ quota_volumes=10, quota_gigabytes=1000, quota_floating_ips=10, + quota_fixed_ips=10, quota_metadata_items=128, quota_injected_files=5, quota_injected_file_content_bytes=10 * 1024, @@ -755,6 +756,7 @@ volumes=10, gigabytes=1000, floating_ips=10, + fixed_ips=10, metadata_items=128, injected_files=5, injected_file_content_bytes=10 * 1024, @@ -791,6 +793,7 @@ volumes=10, gigabytes=500, floating_ips=10, + fixed_ips=10, metadata_items=64, injected_files=5, injected_file_content_bytes=5 * 1024, @@ -847,6 +850,7 @@ self._stub_quota_class_get_all_by_name() def test_get_project_quotas(self): + self.maxDiff = None self._stub_get_by_project() result = self.driver.get_project_quotas( FakeContext('test_project', 'test_class'), @@ -888,6 +892,11 @@ in_use=2, reserved=0, ), + fixed_ips=dict( + limit=10, + in_use=0, + reserved=0, + ), metadata_items=dict( limit=64, in_use=0, @@ -926,6 +935,7 @@ )) def test_get_project_quotas_alt_context_no_class(self): + self.maxDiff = None self._stub_get_by_project() result = self.driver.get_project_quotas( FakeContext('other_project', 'other_class'), @@ -966,6 +976,11 @@ in_use=2, reserved=0, ), + fixed_ips=dict( + limit=10, + in_use=0, + reserved=0, + ), metadata_items=dict( limit=128, in_use=0, @@ -1004,6 +1019,7 @@ )) def test_get_project_quotas_alt_context_with_class(self): + self.maxDiff = None self._stub_get_by_project() result = self.driver.get_project_quotas( FakeContext('other_project', 'other_class'), @@ -1045,6 +1061,11 @@ in_use=2, reserved=0, ), + fixed_ips=dict( + limit=10, + in_use=0, + reserved=0, + ), metadata_items=dict( limit=64, in_use=0, @@ -1145,6 +1166,9 @@ floating_ips=dict( limit=10, ), + fixed_ips=dict( + limit=10, + ), metadata_items=dict( limit=64, ), -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org