← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1501080] [NEW] VMwareVMOpsTestCase.test_get_datacenter_ref_and_name can fail with KeyError

 

Public bug reported:

This is actually being seen on a very old version of nova but still
applies to the code on master:

FAIL: nova.tests.virt.vmwareapi.test_vmwareapi_vmops.VMwareVMOpsTestCase.test_get_datacenter_ref_and_name_with_no_datastore
tags: worker-0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "nova/tests/virt/vmwareapi/test_vmwareapi_vmops.py", line 172, in test_get_datacenter_ref_and_name_with_no_datastore
    self._test_get_datacenter_ref_and_name()
  File "nova/tests/virt/vmwareapi/test_vmwareapi_vmops.py", line 153, in _test_get_datacenter_ref_and_name
    dc_info = _vcvmops.get_datacenter_ref_and_name(instance_ds_ref)
  File "nova/virt/vmwareapi/vmops.py", line 1704, in get_datacenter_ref_and_name
    "Datacenter", ["name", "datastore", "vmFolder"])
  File "/usr/local/lib/python2.7/dist-packages/mock.py", line 955, in __call__
    return _mock_self._mock_call(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mock.py", line 1018, in _mock_call
    ret_val = effect(*args, **kwargs)
  File "nova/tests/virt/vmwareapi/test_vmwareapi_vmops.py", line 139, in fake_call_method
    ds_ref=ds_ref))
  File "nova/virt/vmwareapi/fake.py", line 692, in __init__
    create_network()
  File "nova/virt/vmwareapi/fake.py", line 750, in create_network
    _create_object('Network', network)
  File "nova/virt/vmwareapi/fake.py", line 84, in _create_object
    _db_content[table][table_obj.obj] = table_obj
KeyError: 'Network'


We should make sure that _db_content has a default value in it before we try putting entries into it:

https://github.com/openstack/nova/blob/master/nova/tests/unit/virt/vmwareapi/fake.py#L77

** Affects: nova
     Importance: Low
     Assignee: Matt Riedemann (mriedem)
         Status: Triaged


** Tags: testing vmware

** Changed in: nova
       Status: New => Triaged

** Changed in: nova
   Importance: Undecided => Low

** Changed in: nova
     Assignee: (unassigned) => Matt Riedemann (mriedem)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1501080

Title:
  VMwareVMOpsTestCase.test_get_datacenter_ref_and_name can fail with
  KeyError

Status in OpenStack Compute (nova):
  Triaged

Bug description:
  This is actually being seen on a very old version of nova but still
  applies to the code on master:

  FAIL: nova.tests.virt.vmwareapi.test_vmwareapi_vmops.VMwareVMOpsTestCase.test_get_datacenter_ref_and_name_with_no_datastore
  tags: worker-0
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "nova/tests/virt/vmwareapi/test_vmwareapi_vmops.py", line 172, in test_get_datacenter_ref_and_name_with_no_datastore
      self._test_get_datacenter_ref_and_name()
    File "nova/tests/virt/vmwareapi/test_vmwareapi_vmops.py", line 153, in _test_get_datacenter_ref_and_name
      dc_info = _vcvmops.get_datacenter_ref_and_name(instance_ds_ref)
    File "nova/virt/vmwareapi/vmops.py", line 1704, in get_datacenter_ref_and_name
      "Datacenter", ["name", "datastore", "vmFolder"])
    File "/usr/local/lib/python2.7/dist-packages/mock.py", line 955, in __call__
      return _mock_self._mock_call(*args, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/mock.py", line 1018, in _mock_call
      ret_val = effect(*args, **kwargs)
    File "nova/tests/virt/vmwareapi/test_vmwareapi_vmops.py", line 139, in fake_call_method
      ds_ref=ds_ref))
    File "nova/virt/vmwareapi/fake.py", line 692, in __init__
      create_network()
    File "nova/virt/vmwareapi/fake.py", line 750, in create_network
      _create_object('Network', network)
    File "nova/virt/vmwareapi/fake.py", line 84, in _create_object
      _db_content[table][table_obj.obj] = table_obj
  KeyError: 'Network'

  
  We should make sure that _db_content has a default value in it before we try putting entries into it:

  https://github.com/openstack/nova/blob/master/nova/tests/unit/virt/vmwareapi/fake.py#L77

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1501080/+subscriptions


Follow ups