← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1492342] [NEW] ComputeNode pci_device_pools field changes from empty PciDevicePoolList to None after save()

 

Public bug reported:

If a ComputeNode object has its pci_device_pools field set to an empty
PciDevicePoolList object and then that node object is saved via the
save() method, the pci_device_pools field of the same object is changed
to None.  This due to the following flow:

nova.objects.compute_node.ComputeNode.save()
    nova.objects.compute_node.ComputeNode._from_db_object()
        nova.objects.pci_device_pool.from_pci_stats()

from_pci_stats() returns None instead of an empty PciDevicePoolList as I
would have expected.  This can cause comparisons of a node object to
fail after doing a save() because this field changes.  See the script
below for an example.

"""
#!/usr/bin/python
import copy
import sys

from nova import config
from nova import context as ctxt
from nova.objects import base
from nova.objects import compute_node
from nova.objects import hv_spec
from oslo_config import cfg
from oslo_log import log as logging
from nova.objects import pci_device_pool

CONF = cfg.CONF
config.parse_args(sys.argv[0:1])

logging.setup(cfg.CONF, 'nova')
LOG = logging.getLogger(__name__)

context = ctxt.get_admin_context()
node = compute_node.ComputeNodeList.get_all(context)[0]
node.pci_device_pools = pci_device_pool.PciDevicePoolList([])
node_before_save = copy.deepcopy(node)

LOG.info('node.pci_device_pools before save: %s' % node.pci_device_pools)
node.save()
LOG.info('node.pci_device_pools after save: %s' % node.pci_device_pools)

LOG.info('base.obj_equal_prims(node_before_save, node, ["updated_at"]) = %s' %
         base.obj_equal_prims(node_before_save, node, ['updated_at']))
"""

** Affects: nova
     Importance: Undecided
         Status: New

-- 
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/1492342

Title:
  ComputeNode pci_device_pools field changes from empty
  PciDevicePoolList to None after save()

Status in OpenStack Compute (nova):
  New

Bug description:
  If a ComputeNode object has its pci_device_pools field set to an empty
  PciDevicePoolList object and then that node object is saved via the
  save() method, the pci_device_pools field of the same object is
  changed to None.  This due to the following flow:

  nova.objects.compute_node.ComputeNode.save()
      nova.objects.compute_node.ComputeNode._from_db_object()
          nova.objects.pci_device_pool.from_pci_stats()

  from_pci_stats() returns None instead of an empty PciDevicePoolList as
  I would have expected.  This can cause comparisons of a node object to
  fail after doing a save() because this field changes.  See the script
  below for an example.

  """
  #!/usr/bin/python
  import copy
  import sys

  from nova import config
  from nova import context as ctxt
  from nova.objects import base
  from nova.objects import compute_node
  from nova.objects import hv_spec
  from oslo_config import cfg
  from oslo_log import log as logging
  from nova.objects import pci_device_pool

  CONF = cfg.CONF
  config.parse_args(sys.argv[0:1])

  logging.setup(cfg.CONF, 'nova')
  LOG = logging.getLogger(__name__)

  context = ctxt.get_admin_context()
  node = compute_node.ComputeNodeList.get_all(context)[0]
  node.pci_device_pools = pci_device_pool.PciDevicePoolList([])
  node_before_save = copy.deepcopy(node)

  LOG.info('node.pci_device_pools before save: %s' % node.pci_device_pools)
  node.save()
  LOG.info('node.pci_device_pools after save: %s' % node.pci_device_pools)

  LOG.info('base.obj_equal_prims(node_before_save, node, ["updated_at"]) = %s' %
           base.obj_equal_prims(node_before_save, node, ['updated_at']))
  """

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


Follow ups