def _create_fake_pci_device(self, ctxt=None):
     if not ctxt:
         ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'pci_device_get_by_addr')
     db.pci_device_get_by_addr(ctxt, 1, 'a').AndReturn(fake_db_dev)
     self.mox.ReplayAll()
     self.pci_device = pci_device.PciDevice.get_by_dev_addr(ctxt, 1, 'a')
Exemple #2
0
 def _create_fake_pci_device(self, ctxt=None):
     if not ctxt:
         ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'pci_device_get_by_addr')
     db.pci_device_get_by_addr(ctxt, 1, 'a').AndReturn(fake_db_dev)
     self.mox.ReplayAll()
     self.pci_device = pci_device.PciDevice.get_by_dev_addr(ctxt, 1, 'a')
Exemple #3
0
 def test_get_by_dev_addr(self):
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'pci_device_get_by_addr')
     db.pci_device_get_by_addr(ctxt, 1, 'a').AndReturn(fake_db_dev)
     self.mox.ReplayAll()
     self.pci_device = pci_device.PciDevice.get_by_dev_addr(ctxt, 1, 'a')
     self.assertEqual(self.pci_device.product_id, 'p')
     self.assertEqual(self.pci_device.obj_what_changed(), set())
 def test_get_by_dev_addr(self):
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'pci_device_get_by_addr')
     db.pci_device_get_by_addr(ctxt, 1, 'a').AndReturn(fake_db_dev)
     self.mox.ReplayAll()
     self.pci_device = pci_device.PciDevice.get_by_dev_addr(ctxt, 1, 'a')
     self.assertEqual(self.pci_device.product_id, 'p')
     self.assertEqual(self.pci_device.obj_what_changed(), set())
Exemple #5
0
 def test_get_by_dev_addr_RHOS_6_0_format(self):
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, 'pci_device_get_by_addr')
     db.pci_device_get_by_addr(ctxt, 1, 'a').AndReturn(fake_db_dev_rhos_6_0)
     self.mox.ReplayAll()
     self.pci_device = pci_device.PciDevice.get_by_dev_addr(ctxt, 1, 'a')
     self.assertEqual(self.pci_device.product_id, 'p')
     self.assertEqual(self.pci_device.obj_what_changed(),
                      set(['numa_node', 'extra_info']))
     self.assertEqual(self.pci_device.numa_node, 0)
     self.assertEqual(self.pci_device.extra_info, {})
     self.assertRemotes()
Exemple #6
0
 def get_by_dev_addr(cls, context, compute_node_id, dev_addr):
     db_dev = db.pci_device_get_by_addr(context, compute_node_id, dev_addr)
     return cls._from_db_object(context, cls(), db_dev)
Exemple #7
0
 def get_by_dev_addr(cls, context, compute_node_id, dev_addr):
     db_dev = db.pci_device_get_by_addr(
         context, compute_node_id, dev_addr)
     return cls._from_db_object(context, cls(), db_dev)
Exemple #8
0
 def _create_fake_pci_device(self):
     ctxt = context.get_admin_context()
     self.mox.StubOutWithMock(db, "pci_device_get_by_addr")
     db.pci_device_get_by_addr(ctxt, 1, "a").AndReturn(fake_db_dev)
     self.mox.ReplayAll()
     self.pci_device = pci_device.PciDevice.get_by_dev_addr(ctxt, 1, "a")