Пример #1
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')
Пример #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')
Пример #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())
     self.assertRemotes()
Пример #4
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())
     self.assertRemotes()
Пример #5
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)