Merge lp:~nttdata/nova/lp746821 into lp:~hudson-openstack/nova/trunk

Proposed by Kei Masumoto
Status: Merged
Approved by: Vish Ishaya
Approved revision: 944
Merged at revision: 956
Proposed branch: lp:~nttdata/nova/lp746821
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 92 lines (+31/-12)
2 files modified
nova/tests/test_virt.py (+2/-1)
nova/virt/libvirt_conn.py (+29/-11)
To merge this branch: bzr merge lp:~nttdata/nova/lp746821
Reviewer Review Type Date Requested Status
Brian Lamar (community) Approve
Vish Ishaya (community) Approve
Cory Wright (community) Approve
Brian Waldon (community) Approve
Review via email: mp+56322@code.launchpad.net

Description of the change

This branch is a patch for fixing below issue.
> Bug #746821: live_migration failing due to network filter not found Link a bug report

To post a comment you must log in.
Revision history for this message
Brian Lamar (blamar) wrote :

Good stuff Kei! Just a few really minor nitpicks:

Line 67 -- might be considered unnecessary spacing.

Line 74 -- I'd suggest a LOG.debug in there for the libvirt error, just in case someone needs to know exactly what is failing. I've been bitten by that in the past.

review: Needs Fixing
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Looks good!

review: Approve
Revision history for this message
Cory Wright (corywright) wrote :

I believe your docstrings are incorrectly referencing nova-instance-instance-xxx instead of nova-instance-xxx:

   """Check nova-instance-instance-xxx exists"""

Otherwise, lgtm.

review: Approve
Revision history for this message
Vish Ishaya (vishvananda) wrote :

lgtm.

IIRC, the filters actually do have two instances. nova-instance is the prefix, and the name of each instance is instance-xxx

review: Approve
Revision history for this message
Brian Lamar (blamar) :
review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (46.1 KiB)

The attempt to merge lp:~nttdata/nova/lp746821 into lp:nova failed. Below is the output from the failed tests.

AccountsTest
    test_account_create OK
    test_account_delete OK
    test_account_update OK
    test_get_account OK
AdminAPITest
    test_admin_disabled OK
    test_admin_enabled OK
APITest
    test_exceptions_are_converted_to_faults OK
Test
    test_authorize_token OK
    test_authorize_user OK
    test_bad_token OK
    test_bad_user_bad_key OK
    test_bad_user_good_key OK
    test_no_user OK
    test_token_expiry OK
TestFunctional
    test_token_doesnotexist OK
    test_token_expiry OK
TestLimiter
    test_authorize_token OK
LimiterTest
    test_limiter_custom_max_limit OK
    test_limiter_limit_and_offset OK
    test_limiter_limit_medium OK
    test_limiter_limit_over_max OK
    test_limiter_limit_zero OK
    test_limiter_negative_limit OK
    test_limiter_negative_offset OK
    test_limiter_nothing OK
    test_limiter_offset_bad OK
    test_limiter_offset_blank OK
    test_limiter_offset_medium OK
    test_limiter_offset_over_max OK
    test_limiter_offset_zero OK
ActionExtensionTest
    test_extended_action OK
    test_invalid_action OK
    test_invalid_action_body OK
ExtensionControllerTest
    test_get_by_alias OK
    test_index OK
ExtensionManagerTest
    test_get_resources OK
ResourceExtensionTest
    test_get_resources OK
    test_get_resources_with_controller OK
    test_no_extension_present OK
ResponseExtensionTest
    test_get_resources_with_mgr OK
    test_get_resources_with_stub_mgr OK
TestFaults
    test_400_fault_json OK
    test_400_fault_xml OK
    test_...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/tests/test_virt.py'
--- nova/tests/test_virt.py 2011-04-04 20:17:04 +0000
+++ nova/tests/test_virt.py 2011-04-07 21:34:25 +0000
@@ -479,7 +479,7 @@
479479
480 fake_timer = FakeTime()480 fake_timer = FakeTime()
481481
482 self.create_fake_libvirt_mock(nwfilterLookupByName=fake_raise)482 self.create_fake_libvirt_mock()
483 instance_ref = db.instance_create(self.context, self.test_instance)483 instance_ref = db.instance_create(self.context, self.test_instance)
484484
485 # Start test485 # Start test
@@ -488,6 +488,7 @@
488 conn = libvirt_conn.LibvirtConnection(False)488 conn = libvirt_conn.LibvirtConnection(False)
489 conn.firewall_driver.setattr('setup_basic_filtering', fake_none)489 conn.firewall_driver.setattr('setup_basic_filtering', fake_none)
490 conn.firewall_driver.setattr('prepare_instance_filter', fake_none)490 conn.firewall_driver.setattr('prepare_instance_filter', fake_none)
491 conn.firewall_driver.setattr('instance_filter_exists', fake_none)
491 conn.ensure_filtering_rules_for_instance(instance_ref,492 conn.ensure_filtering_rules_for_instance(instance_ref,
492 time=fake_timer)493 time=fake_timer)
493 except exception.Error, e:494 except exception.Error, e:
494495
=== modified file 'nova/virt/libvirt_conn.py'
--- nova/virt/libvirt_conn.py 2011-04-07 21:08:16 +0000
+++ nova/virt/libvirt_conn.py 2011-04-07 21:34:25 +0000
@@ -1404,18 +1404,13 @@
1404 # wait for completion1404 # wait for completion
1405 timeout_count = range(FLAGS.live_migration_retry_count)1405 timeout_count = range(FLAGS.live_migration_retry_count)
1406 while timeout_count:1406 while timeout_count:
1407 try:1407 if self.firewall_driver.instance_filter_exists(instance_ref):
1408 filter_name = 'nova-instance-%s' % instance_ref.name
1409 self._conn.nwfilterLookupByName(filter_name)
1410 break1408 break
1411 except libvirt.libvirtError:1409 timeout_count.pop()
1412 timeout_count.pop()1410 if len(timeout_count) == 0:
1413 if len(timeout_count) == 0:1411 msg = _('Timeout migrating for %s. nwfilter not found.')
1414 ec2_id = instance_ref['hostname']1412 raise exception.Error(msg % instance_ref.name)
1415 iname = instance_ref.name1413 time.sleep(1)
1416 msg = _('Timeout migrating for %(ec2_id)s(%(iname)s)')
1417 raise exception.Error(msg % locals())
1418 time.sleep(1)
14191414
1420 def live_migration(self, ctxt, instance_ref, dest,1415 def live_migration(self, ctxt, instance_ref, dest,
1421 post_method, recover_method):1416 post_method, recover_method):
@@ -1544,6 +1539,10 @@
1544 """1539 """
1545 raise NotImplementedError()1540 raise NotImplementedError()
15461541
1542 def instance_filter_exists(self, instance):
1543 """Check nova-instance-instance-xxx exists"""
1544 raise NotImplementedError()
1545
15471546
1548class NWFilterFirewall(FirewallDriver):1547class NWFilterFirewall(FirewallDriver):
1549 """1548 """
@@ -1851,6 +1850,21 @@
1851 return 'nova-instance-%s' % (instance['name'])1850 return 'nova-instance-%s' % (instance['name'])
1852 return 'nova-instance-%s-%s' % (instance['name'], nic_id)1851 return 'nova-instance-%s-%s' % (instance['name'], nic_id)
18531852
1853 def instance_filter_exists(self, instance):
1854 """Check nova-instance-instance-xxx exists"""
1855 network_info = _get_network_info(instance)
1856 for (network, mapping) in network_info:
1857 nic_id = mapping['mac'].replace(':', '')
1858 instance_filter_name = self._instance_filter_name(instance, nic_id)
1859 try:
1860 self._conn.nwfilterLookupByName(instance_filter_name)
1861 except libvirt.libvirtError:
1862 name = instance.name
1863 LOG.debug(_('The nwfilter(%(instance_filter_name)s) for'
1864 '%(name)s is not found.') % locals())
1865 return False
1866 return True
1867
18541868
1855class IptablesFirewallDriver(FirewallDriver):1869class IptablesFirewallDriver(FirewallDriver):
1856 def __init__(self, execute=None, **kwargs):1870 def __init__(self, execute=None, **kwargs):
@@ -2040,6 +2054,10 @@
20402054
2041 return ipv4_rules, ipv6_rules2055 return ipv4_rules, ipv6_rules
20422056
2057 def instance_filter_exists(self, instance):
2058 """Check nova-instance-instance-xxx exists"""
2059 return self.nwfilter.instance_filter_exists(instance)
2060
2043 def refresh_security_group_members(self, security_group):2061 def refresh_security_group_members(self, security_group):
2044 pass2062 pass
20452063